Learn R Programming

cmAnalysis (version 1.0.0)

checkConceptMapData: Validate Concept Map Data

Description

Checks whether the provided data frame meets the requirements for concept map data.

Usage

checkConceptMapData(CMData)

Value

Returns TRUE if all checks pass. If any check fails, an error is raised with a descriptive message.

Arguments

CMData

A data frame containing concept map data. This data frame must include the required columns: "sorterID", "statement", and "stackID".

Details

This function performs the following checks on the input data:

  • Verifies that CMData is a data frame.

  • Ensures the presence of required columns: "sorterID", "statement", and "stackID".

  • Confirms that there are at least 2 unique values in the "stackID" column.

  • Confirms that there are at least 2 unique values in the "sorterID" column.

  • Confirms that there are at least 2 unique values in the "statement" column.

Examples

Run this code
# Example of valid data
validData <- data.frame(
  sorterID = c("resp1", "resp1", "resp1", "resp2",
   "resp2", "resp2", "resp3", "resp3", "resp3"),
  statement = c("London", "Frankfurt", "Berlin", "London",
  "Frankfurt", "Berlin", "London", "Frankfurt", "Berlin"),
  stackID = c("capital city", "city", "capital city", 1, 2, 2, "A", "B", "A")
)
checkConceptMapData(validData) # Should return TRUE

# Example of invalid data (missing columns)
invalidData <- data.frame(
  sorterID = c(1, 2),
  stackID = c(1, 2)
)
# checkConceptMapData(invalidData) # Will return False as an error

Run the code above in your browser using DataLab