Learn R Programming

fechner (version 1.0-3)

check.data: Check for Required Data Format

Description

check.data is used to check whether the data are of required format.

Usage

check.data(X, format = c("probability.different", "percent.same", "general"))

Arguments

X
a required square matrix or data frame of numeric data. No NA, NaN, Inf, or -Inf values are allowed.
format
an optional character string giving the data format to be checked. This must be one of "probability.different", "percent.same", or "general", with default "probability.different", and may be abbreviated to a unique prefix.

Value

If the data are of required format, check.data returns a matrix of the data with rows and columns labeled.

Details

The data must be a matrix or a data frame, have the same number of rows and columns, and be numeric consisting of real numbers. In particular, no infinite, undefined, or missing values are allowed. This is the general data format. The probability-different and percent-same formats, in addition, require that the data lie in the intervals $[0, 1]$ and $[0, 100]$, respectively. If all of the requirements for a data format are satisfied, the data are returned as a matrix with rows and columns labeled; otherwise the function produces respective messages.

The labeling is as follows.

  1. If the data are entered without any labeling of the rows and columns: The function does the labeling automatically, as $a1, b1, \ldots, z1$, $a2, b2, \ldots, z2$, ..., etc., up to $a9, b9, \ldots, z9$ if the data are as large as $234x234$, or if the data are larger than $234x234$, the labeling is $v1, v2, \ldots, vN$, where $NxN$ is the dimension of the data (and $N > 234$).
  2. If the data are entered with either row or column labeling: In that case, the row or column labels are assigned to the columns or rows, respectively.
  3. If the data are entered with row and column labeling: Since the labeling of both the rows and columns is now provided by the user manually, the same labeling must be used for both. If this is the case, the labeling is adopted. Otherwise the function produces a respective message.

References

Dzhafarov, E. N. and Colonius, H. (2006) Reconstructing distances among objects from their discriminability. Psychometrika, 71, 365--386.

Dzhafarov, E. N. and Colonius, H. (2007) Dissimilarity cumulation theory and subjective metrics. Journal of Mathematical Psychology, 51, 290--304.

Uenlue, A. and Kiefer, T. and Dzhafarov, E. N. (2009) Fechnerian scaling in R: The package fechner. Journal of Statistical Software, 31(6), 1--24. URL http://www.jstatsoft.org/v31/i06/.

See Also

check.regular for checking regular minimality/maximality; fechner, the main function for Fechnerian scaling. See also fechner-package for general information about this package.

Examples

Run this code
## dataset \link{wish} is of probability-different format
check.data(wish)

## dataset \link{morse} is of percent-same format
check.data(morse, format = "percent.same")

## a matrix without any labeling of rows and columns, of general format
## check.data does the labeling automatically
(X <- ((-1) * matrix(1:16, nrow = 4)))
check.data(X, format = "general")

## examples of data that are not of any of the three formats

## message: data must be matrix or data frame
check.data(as.character(matrix(1:16, nrow = 4)))

## message: data must have same number of rows and columns
check.data(matrix(1:12, nrow = 4))

## message: data must be numbers
check.data(matrix(LETTERS[1:16], nrow = 4))

Run the code above in your browser using DataLab