storeAnswer {catSurv} | R Documentation |
Update Answer to Single Item
Description
Stores answer to item k
to the Cat
object's answers
slot.
Usage
## 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 |
item |
An integer indicating the index of the question item |
answer |
The answer to the |
returnJSON |
Boolean indicating whether the updated |
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.
Value
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
.
Author(s)
Haley Acevedo, Ryden Butler, Josh W. Cutler, Matt Malis, Jacob M. Montgomery, Tom Wilkinson, Erin Rossiter, Min Hee Seo, Alex Weil
Examples
## Loading ltm Cat object
data(ltm_cat)
## Printing current answers slot
getAnswers(ltm_cat)
## Storing answer of 0 to item 1
ltm_cat <- storeAnswer(ltm_cat, item = 1, answer = 0)
## Now object reflects answer to item 1
getAnswers(ltm_cat)