ChooseItems | R Documentation |
This functions provides the basis on which the item selection App works.
ChooseItems(
idata,
maxvar,
constrvars = NULL,
constrmins = NULL,
constrmaxs = NULL
)
idata |
A data frame containing information about all the items. |
maxvar |
A character string defining the variable for which the sum will be maximised by the choice of items. |
constrvars |
A character vector denoting the variable on which other contraints may be placed. |
constrmins |
A numeric vector of the minima that the sums of the "constrvars" must add up to. Must be same length as "constrvars". |
constrmaxs |
A numeric vector of the maxima that the sums of the "constrvars" must add up to. Must be same length as "constrvars". |
A vector denoting the indices of the rows of the data frame that were selected.
#summary information for 11 items worth 20 marks
item.summary.data=data.frame(
item=1:11
,Max=c(1,1,1,1,1,2,2,2,2,2,5)
,Mean=c(0.02,0.23,0.61,0.65,0.56
,1.34,1.44,1.2,1.07,0.32,3.67)
,R_rest=c(0.14,0.46,0.59,0.63,0.42
,0.55,0.53,0.68,0.72,0.49,0.49)
)
#select an optimal 8 mark test (max R_rest per mark)
#with mean score between 5 and 6 marks)
choice=ChooseItems(item.summary.data,"R_rest"
,constrvars = c("Max","Mean")
,constrmins = c(8,5)
,constrmaxs = c(8,6))
item.summary.data[choice,]
#check choices satisfy constraints
apply(item.summary.data[choice,],2,sum)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.