Learn R Programming

Rwinsteps (version 1.0-1.1)

wcmd: Winsteps Command File

Description

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.

Usage

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)

Arguments

title

a title for the Winsteps run, as a string

data

data set filename

item1

integer, fixed width column number of the first item

ni

integer, number of items

name1

integer, fixed width column number of the first character of the person name

namelen

integer, number of characters in person name, defaulting to the difference between item1 and name1

codes

vector of response codes with default c(0, 1)

csv

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")

hlines

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

tfile

numeric vector of table numbers to be included in output

arglist

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"

anchor

optional matrix of item anchor values, with item sequences in column 1 and anchor values in column 2

labels

optional string vector of item labels, to be pasted after the &END statement in the command file

extra

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

x

list of arguments to be converted into an object of class “wcmd”

filename

path to which the command file will be written, or from which it will be read

cmd

command file object to be written

Value

Returns a command file as a list of arguments

Details

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.

See Also

winsteps

Examples

Run this code
# 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