\name{recodeMissingHandlers} \alias{recodeMissingHandlers} \title{Creates a set of recode missing handlers corresponding a coding scheme.} \description{ This takes a list of missing handler (\code{originalHandler}) and a coding scheme in the style of \code{omitCodeStrings} and produces a new list of handlers all with the value of \code{handler} set to \sQuote{Recode}. This can be used in a pretest description file to change the coding of missing values. } \usage{ recodeMissingHandlers(originalHandlers, codeTable = omitCodeGENASYS) } %- maybe also 'usage' for other objects documented here. \arguments{ \item{originalHandlers}{A list of \code{MissingCode} objects.} \item{codeTable}{A named character vector with the names corresponding to the \code{type} fields of the \code{MissingCode} objects and the values corresponding to the coding for the missing values.} } \details{ If the data file uses a different coding scheme for missing values than the Assessment Model Description expects, then the data needs to be recoded. The StatShop Pretest converter tool will do that recoding, but needs a appropriate meta-data in the Pretest Description file. This function produces a new set of \code{MissingCode} options, all of type \sQuote{Recode} which does the job. The recoding is looked up by the \code{type} field in the \code{codeTable} argument. If no coding is found for a type, then the original handler is maintained. } \value{ A list of \code{MissingCode} objects, all of type \sQuote{Recode}, of the same length as \code{originalHandlers}. } \references{ \url{http://research.ets.org/~ralmond/StatShop/dataFormats.html} } \author{Russell Almond } \seealso{\code{\link{MissingCode}}, \code{\link{omitCodeStrings}}, \code{\link{xmlMissingCode}} \code{\link{xmlPretestDescription}} } \examples{ roh <- recodeMissingHandlers(defaultMissingCodes) recodeMissingHandlers(defaultMissingCodes,omitCode789) \dontshow{ stopifnot( length(roh) == length(defaultMissingCodes), all(sapply(roh,function(m) m$type) == sapply(defaultMissingCodes,function(m) m$type)) ) for (i in 1:length(defaultMissingCodes)) { hold <- defaultMissingCodes[[i]] hnew <- roh[[i]] if (is.na(omitCodeGENASYS[hold$type])) { stopifnot(identical(hold,hnew)) } else { stopifnot(hnew$handler == "Recode", hnew$newval == omitCodeGENASYS[hold$type]) } } } } \keyword{manip}% at least one, from doc/KEYWORDS