我正试图使一种习惯功能,而这种功能则需要参考,而我所希望的那一栏的名称则需要适用。 然而,我却在忙于要求我履行职责。
When I enter the name of the column without parentheses, I get "Error: object Area not found". When I enter the column name as a character, I get "Error in model.frame.default(form, data) : variable lengths differ (found for Treatment )".
我猜测,我需要在本职能范围内重塑我的栏目,但我不知道需要做些什么。
AssumTests <- function(data, aspect){
# Homogeneity of Variance test
lt <- leveneTest(aspect ~ Treatment,
data = data)
model <- lm(aspect ~ Treatment, data = data)
# Normality residuals as group
qq <- ggqqplot(residuals(model))
st <- shapiro_test(residuals(model))
# Normality test by group
qqfac <- ggqqplot(data, paste(aspect), facet.by = "Treatment")
spfac <- data %>%
group_by(Treatment) %>%
shapiro_test(aspect)
list = list(lt, qq, st, qqfac, spfac)
return(list)
}
AssumTests(FluorByTreatment_Iter1.df, "Area")
Crossposted to:
UPDATE:
Got the first expressions to work with UPDATE2: Got the final expression to work, through this !data[[aspect]]
, but still having trouble with the last expression using dplyr piping. I tried the {{aspect}}
trick, but R is still recognizing the quotes: "Column "Area"
doesn t exist."