check.data: Check for Required Data Format

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/check.data.R

Description

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

Usage

1
2
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.

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, …, z1, a2, b2, …, z2, ..., etc., up to a9, b9, …, z9 if the data are as large as 234x234, or if the data are larger than 234x234, the labeling is v1, v2, …, 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.

Value

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

Author(s)

Thomas Kiefer, Ali Uenlue. Based on original MATLAB source by Ehtibar N. Dzhafarov.

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
## 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))

fechner documentation built on May 2, 2019, 8:49 a.m.