checkConceptMapData: Validate Concept Map Data

View source: R/checkConceptMapData.R

checkConceptMapDataR Documentation

Validate Concept Map Data

Description

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

Usage

checkConceptMapData(CMData)

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.

Value

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

Examples

# 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


cmAnalysis documentation built on April 4, 2025, 4:27 a.m.