Adds taxicab metric calculation columns to a dataframe.
Arguments
- data
data.frame, needed Data frame containing columns for deliberate constraints and automatic constraints.
- dc
character, optional Name of the column containing deliberate constraints. Default is "Deliberate.Constraints".
- ac
character, optional Name of the column containing automatic constraints. Default is "Automatic.Constraints".
Value
data frame containing the quadrant depths. Columns include "sticky", "hybrid", "free", "directed", "total_depth", and "quadrant". The value of quadrant is 1-4, corresponding to top-left, top-right, bottom-left, bottom-right.
Details
The function calculates the quadrant depths based on the deliberate and automatic constraints provided in the data file. The quadrant depths are calculated using the taxicab norm. Only one depth will be populated per observation, depending on the quadrant the observation falls into. The remaining three depths will be set to 0.
Examples
# Calculate quadrant depths from survey data
data_file <- system.file("extdata", "sample_data.csv", package = "ThinkingGrid")
if (file.exists(data_file)) {
data_file <- read.csv(data_file)
depth_results <- add_depths(data_file, dc = "dc", ac = "ac")
}