Learn R Programming

ufs (version 0.3.1)

CIM: Conceptual Independence Matrix

Description

Conceptual Independence Matrix

Usage

CIM(data, scales, outputFile = NULL, outputWidth = 100,
  outputHeight = 100, outputUnits = "cm", faMethod = "minres",
  n.iter = 100, skipRegex = NULL, headingLevel = 2,
  printAbbreviations = TRUE, drawPlot = TRUE, returnPlotOnly = TRUE)

# S3 method for CIM knit_print(x, headingLevel = x$input$headingLevel, quiet = TRUE, echoPartial = FALSE, partialFile = NULL, ...)

Arguments

data

The dataframe containing the variables.

scales

The scales: a names list of character vectors, where the character vectors specify the variable names, and the names of each character vector specifies the relevant scale.

outputFile

The file to write the output to.

outputWidth, outputHeight, outputUnits

The width, height, and units for the output file.

faMethod

The method to pass on to psych::fa().

n.iter

The number of iterations to pass on to psych::fa().

skipRegex

A character vector of length 2 containing two regular expressions; if the two scales both match one or both of those regular expressions, that cell is skipped.

headingLevel

The level for the heading; especially useful when knitting an Rmd partial.

printAbbreviations

Whether to print a table with the abbreviations that are used.

drawPlot

Whether to draw the plot or only return it.

returnPlotOnly

Whether to return the plot only, or the entire object.

x

The object to print.

quiet

Whether to be quiet or chatty.

echoPartial

Whether to echo the code in the Rmd partial.

partialFile

Can be used to override the Rmd partial file.

...

Additional arguments are passed on the respective default methods.

Value

A ggplot2::ggplot() plot.

Examples

Run this code
# NOT RUN {
### Load data from psych package
data(bfi, package= 'psych');

### Specify scales
bfiScales <-
  list(Agreeableness     = paste0("Agreeableness_item_", 1:5),
       Conscientiousness = paste0("Conscientiousness_item_", 1:5),
       Extraversion      = paste0("Extraversion_item_", 1:5),
       Neuroticism       = paste0("Neuroticism_item_", 1:5),
       Openness          = paste0("Openness_item_", 1:5));

names(bfi) <- c(unlist(bfiScales),
                c('gender', 'education', 'age'));

### Only select first two and the first three items to
### keep it quick; just pass the full 'bfiScales'
### object to run for all five the full scales
CIM(bfi,
    scales=lapply(bfiScales, head, 3)[1:2],
    n.iter=10);

# }

Run the code above in your browser using DataLab