jmetrikWrite: Writes a file in *.jmetrik format.

Description Usage Arguments Author(s) Examples

View source: R/jmetrik.R

Description

'jMetrik' is a stand alone program written in Java. It defines a file format that is just a plain text file with a header and comma delimited values. The header contains information about the variables in the file. There is one row in the header for each variable in the file. The header also includes meta information about the data such as the number of rows. This function will create a *.jmetrik file from a data frame. The jMetrik program and other informaiton is available at http://www.Itemanalysis.com

Usage

1
2
jmetrikWrite(x, fileName, scoring = NULL, codes = NULL, group = NULL,
  labels = NULL)

Arguments

x

A data frame

fileName

The complete path and name of the file to be written. The file siffix must be .jmetrik.

scoring

An optional character vector of item scoring. Each element in this vector has two sets of parentheses. The first set contains the response option codes. The second set contains the scores assigned to each option. There is a correspondence between each set of parentheses such that the first element in the code list corresponds to the first element in the score list.

codes

An optional character vector of special codes. Each element in this vector has two sets of parentheses. The first set contains the missing data, omitted, and not reached codes. The second set contains the scores assigned to each code. There is a correspondence between each set of parentheses such that the first element in the code list corresponds to the first element in the score list.

group

a character vector of codes that define the group membership of an item. One element for eahc item.

labels

An optional character vector of variable labels

Author(s)

J. Patrick Meyer support@itemanalysis.com

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#Create some data
id<-100+seq(1:10)
x<-sample(c("A", "B", "C", "D"), 10, replace=TRUE)
y<-sample(c("A", "B", "C", "D"), 10, replace=TRUE)
z<-sample(c(0,1,2,3), 10, replace=TRUE)
sc<-rnorm(10)
exdata<-as.data.frame(cbind(id, x, y, z, sc))
names(exdata)<-c("id", "item1", "item2", "item3", "score")

#A is the correct answer
aOK<- "(A,B,C,D)(1,0,0,0)"

#B is the correct answer
bOK<-"(A,B,C,D)(0,1,0,0)"

#polytomous item scoring
poly<-"(0,1,2,3)(0,1,2,3)"

#Special data codes e.g. missing and not reached responses
#These can be unique to each item or the same. Here they
#are the same.
datCodes<-"(NA,OM,NR)(0,0,0)"

#Create scoring, special data codes, and labels
scoring<-c("", aOK, bOK, poly, "")
codes<-c("", rep(datCodes, 3), "")
labels<-c("ID variable", "Test item 1", "Test item 2", "Test item 3", "Test score")

#write the file
jmetrikWrite(x=exdata, 
             fileName=file.path(tempdir(), "test-write.jmetrik"),
             codes=codes, 
             scoring=scoring, 
             labels=labels)
            

jmetrik documentation built on May 2, 2019, 1:27 p.m.