Description Usage Arguments Details Value Examples
Merge scores from pre-coded items
1 | mergeScores(result, resp, column, prefix = "", test.taker = NULL)
|
result |
result of scoring script. A matrix. |
resp |
Response data.frame from TAO or from pre-coded items. |
column |
String. The beginning of the name of the columns to merge with the results. If more columns start with the provided string, all of them are included. |
prefix |
Text to put before the variable name |
test.taker |
vector of test taker-ids for the response data.frame. If left empty, first column in resp is used as test.taker. |
The data from resp are merged into result based on the test.taker column (either 1st column in resp or the test.taker vector). Both numeric scores and scores which are part of a JSON object are processed.
MergeScores returns a data.frame with the same number of rows as result.
If there are duplets in the test-takers in resp, we first check if the order of test.takers in result and resp are exactly the same. If so, we cbind the scores (one by one).
If not, we unify duplicate test.takers by giving them the highest score they have achieved, and then merge with result - giving duplicate result test.takers the same highest value.
returns a result matrix
1 2 3 4 5 6 | result<-data.frame(id=c("a","b","a","b","c","d","a"))
resp<-data.frame(id=c("b","b","a","a","c","d","a"),X1_result=c(1,NA,2,2,1,3,NA),X2_party=c(2,1,3,1,2,3,NA),X20_dont=c(NA,2,1,2,1,3,NA))
result<-mergeScores(result=result,resp=resp,column="X1",prefix="CP_")
# Make sure not to import data from item X20
result<-mergeScores(result,resp,"X2[^0-9]","TM2_")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.