Package 'jmetrik'

Title: Tools for Interacting with 'jMetrik'
Description: The main purpose of this package is to make it easy for userR's to interact with 'jMetrik' an open source application for psychometric analysis. For example it allows useR's to write data frames to file in a format that can be used by 'jMetrik'. It also allows useR's to read *.jmetrik files (e.g. output from an analysis) for follow-up analysis in R. The *.jmetrik format is a flat file that includes a multiline header and the data as comma separated values. The header includes metadata about the file and one row per variable with the following information in each row: variable name, data type, item scoring, special data codes, and variable label.
Authors: J. Patrick Meyer <[email protected]>
Maintainer: J. Patrick Meyer <[email protected]>
License: GPL (>= 3)
Version: 1.1
Built: 2025-03-05 04:31:48 UTC
Source: https://github.com/cran/jmetrik

Help Index


Tools for interacting with 'jMetrik'

Description

jmetrik provides tools for using R and the external program 'jMetrik' togther. In particular, it provides tools for reading and writing files in *.jmetrik format. This format is required by 'jMetrik' and it is a flat file with a header and comma separated values. However, a *.jmetrik file is not simply a CSV file. The header includes much more information about the data than is typically found in a CSV file. 'jMetrik' is an open source Java application for psychometric analysis. It may be downloaded from http://www.ItemAnalysis.com.

Details

See jmetrikWrite and http://www.ItemAnalysis.com for more information about the *.jmetrik file format.


Reads a *.jmetrik file into a data frame.

Description

A *.jmetrik file can be created with jmetrikWrite or by the 'jMetrik' program. See http://www.ItemAnalysis.com.

Usage

jmetrikRead(fileName, maxScan = 500)

Arguments

fileName

The complete path and file name of the *.jmetrik file that is being read.

maxScan

The maximum number of rows to scan. This number should be at least the number of variables int eh data file.

Value

a data frame

Examples

x<-jmetrikRead(fileName=system.file("extdata", "exam1iparam.jmetrik", package = "jmetrik"))

Writes a file in *.jmetrik format.

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

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 [email protected]

Examples

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