I have the following code for analyzing some experiment data:
# Load Data
data <- read.csv("./HHT/Processed_Data/data_.csv")
data %>%
  group_by(Round) %>%
  get_summary_stats(Q1.1, type="mean_sd")
# Friedman Test
res.fried <- friedman.test(y = data$Q1.1, 
                           groups = data$Round, 
                           blocks = data$P_ID)
This works fine. I would like to write a function to quickly run the same test while only changing the y value. I wrote the following:
friedman <- function(column) {
  res <- friedman.test(y = data$column, groups = data$Round, blocks = data$P_ID)
  return(res)
}
friedman(Q1.1)
When I try to call the function, I get the following error:
Error in friedman.test.default(y = data$column, groups = data$Round, blocks = data$P_ID) :  'y', 'groups' and 'blocks' must have the same length
