### Script for building a Pretest Description from an Assessment ### Description file. ### Note: This will not work on the Assessment MODEL Description ### files which are the original Portal Export. This script needs ### final task IDs, but the Portal Export contains only Task Model ### IDs. Doing an AMDF to ADF Conversion (any mode) will generate the ### proper task IDs for this script to work. This script does not ### look at the probabilities. ### Note: The script does not currently handle demographic variables ### or scores. These must be added by hand. ### This part of the script loads the required software. #library(XML) #if(.Platform$OS.type == "unix") { # StatShop <- system("echo $STATSHOP", intern=TRUE) #} else if(.Platform$OS.type == "windows") { # StatShop <- system(paste(Sys.getenv("COMSPEC"),"/c","echo %STATSHOP%"), # intern=TRUE) } #source(paste(StatShop,"R","Asp","amd.R",sep=.Platform$file.sep)) #source(paste(StatShop,"R","Asp","pretestDescription.R",sep=.Platform$file.sep)) ### Assuming that the working directory contains the assessment model ### description file, this will find the filename. Note that if ### several are present in the directory, you may need to pick the ### right one. amds <- system("ls *.amd.xml",TRUE) amds ## Assume that the first one is the one we want. ### This will do a conversion retaining string values for the task ### values. amdToPD(amds,"StringCode.pd.xml",integerCode=NULL,omitCodes=omitCodeStrings) ### Change "StringCode.pd.xml" to the desired output filename. ### This will do a conversion to integer codes using Parscale style ### values, Low=0. amdToPD(amds,"ParscaleCode.pd.xml",integerCode=0,omitCodes=omitCode789) ### This will do a conversion to integer codes using BUGS style ### values, Low=1. amdToPD(amds,"ParscaleCode.pd.xml",integerCode=0, omitCodes=c("NA"="NA","Omit"="NA","Not Reached"="NA"))