wcmd
creates a Winsteps command file object. as.wcmd
converts a list to an object of class “wcmd”. read.wcmd
and write.wcmd
read and write command files to and from text files.
wcmd(title = "R2Winsteps Run", data, item1, ni, name1,
namelen = item1 - name1, codes = 0:1, csv = "y", hlines = "y",
tfile = NULL, arglist = NULL, anchor = NULL, labels = NULL,
extra = NULL)as.wcmd(x)
read.wcmd(filename)
write.wcmd(cmd, filename)
a title for the Winsteps run, as a string
data set filename
integer, fixed width column number of the first item
integer, number of items
integer, fixed width column number of the first character of the person name
integer, number of characters in person name, defaulting to the difference between item1
and name1
vector of response codes with default c(0, 1)
character indicating how output files should be written, as csv ("y"
, default) or as tab delimited ("n"
). In order to read in and manipulate files using R2Winsteps, this must be "y"
, and the Winsteps default which includes headers must not change (hlines = "y"
)
character indicating whether or not to include header lines in output files, with default "y"
, as required for using functions such as read.ifile
and read.pfile
numeric vector of table numbers to be included in output
optional list of additional arguments to be appended to the command file, where the name of each list element will be pasted into a string with the value of the element, as name = "value"
optional matrix of item anchor values, with item sequences in column 1 and anchor values in column 2
optional string vector of item labels, to be pasted after the &END
statement in the command file
optional vector of additional commands, similar to arglist
, but where element names are ignored and each element is simply pasted into the command file separated by new lines
list of arguments to be converted into an object of class “wcmd”
path to which the command file will be written, or from which it will be read
command file object to be written
Returns a command file as a list of arguments
The Winsteps command file specifies the structure of a persons by items matrix and includes all arguments necessary to run the model. Arguments without defaults, which are currently required in the “wcmd” class, are data
, item1
, ni
, and name1
. Winsteps accepts a variety of arguments and data specification options within the command file and only a selection of these are currently supported by the “wcmd” class, not including those necessary for polytomous models. Thus, for the greatest flexibility, the command file should be written by hand. For details, see the Winsteps manual.
Using write.wcmd
, the command file is written to filename
by separating all arguments and item labels with new lines. As all arguments are read and written as text strings, any argument with integer values such as codes
may also be specified as a string, e.g., codes = "01"
.
The command file can also be used to facilitate reading and writing of data files in R. See read.wdat
and write.wdat
for details.
# NOT RUN {
# Create
tempcmd <- tempfile()
cmd <- wcmd(title = "R2Winsteps Example", data = "example.dat",
item1 = 1, ni = 15, name1 = 16, namelen = 5,
labels = paste("i", 1:15, sep = ""), hlines = "Y")
# Write and read
write.wcmd(cmd, tempcmd)
cmd2 <- read.wcmd(tempcmd)
# }
Run the code above in your browser using DataLab