Stores answer to item k to the Cat object's answers slot.
## S4 method for signature 'Cat'storeAnswer(catObj, item, answer, returnJSON =FALSE)## S4 method for signature 'character'storeAnswer(catObj, item, answer, returnJSON =FALSE)
Arguments
catObj: An object of class Cat or class json.
item: An integer indicating the index of the question item
answer: The answer to the item to be updated
returnJSON: Boolean indicating whether the updated Cat object should be returned as a JSON object. Defaults to FALSE.
Returns
The function storeAnswer returns an updated object of class Cat with the answers slot reflecting the newly stored answer to the indicated item. All previously stored answers remain the same, and all unanswered questions remain NA.
Details
The function storeAnswer updates the Cat object, but the updated object must be assigned to an object for the changes to be stored. See Examples .
Examples
## Loading ltm Cat objectdata(ltm_cat)## Printing current answers slotgetAnswers(ltm_cat)## Storing answer of 0 to item 1ltm_cat <- storeAnswer(ltm_cat, item =1, answer =0)## Now object reflects answer to item 1getAnswers(ltm_cat)
Author(s)
Haley Acevedo, Ryden Butler, Josh W. Cutler, Matt Malis, Jacob M. Montgomery, Tom Wilkinson, Erin Rossiter, Min Hee Seo, Alex Weil