Description Usage Arguments Value Examples
View source: R/functions_analysis.r
Performs tests on what has been passed on to soc.mca by the user.
1 | what.is.x(x)
|
x |
the active variables sent to soc.mca |
a character vector with an evaluation of whether x is data.frame, a list of data.frames, an indicator or a list of indicators.
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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | ## Not run:
# Valid scenarios ----
# X is a valid data.frame
x <- taste[, 2:7]
what.is.x(x)
# X is a valid indicator
x <- indicator(taste[, 2:7])
what.is.x(x)
# X is a valid list of data.frames with names
x <- list(nif = taste[, 2:3], hurma = taste[, 4:5])
what.is.x(x)
# X is a valid list of indicators
x <- list(nif = indicator(taste[, 2:3]), hurma = indicator(taste[, 4:5]))
what.is.x(x)
# Invalid scenarios ----
# X is a matrix - but not numeric
x <- as.matrix(taste[, 2:7])
what.is.x(x)
# X is a of data.frames list but does not have names
x <- list(taste[, 1:3], taste[, 4:5])
what.is.x(x)
# X is a list of indicators but does not have names
x <- list(indicator(taste[, 2:3]), indicator(taste[, 4:5]))
what.is.x(x)
# X is a data.frame and contains NA
x <- taste[, 2:7]
x[1,1] <- NA
what.is.x(x)
# X is a list of indicators and contains NA
x <- list(nif = indicator(taste[, 2:3]), hurma = indicator(taste[, 4:5]))
x[[1]][1,1] <- NA
what.is.x(x)
# X contains elements that are neither a matrix nor a data.frame
x <- list(nif = 1:10, taste[, 1:3], taste[, 4:7])
what.is.x(x)
# X contains both indicators and matrixes
x <- list(nif = taste[, 2:3], hurma = indicator(taste[, 5:6]))
what.is.x(x)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.