R markdown, Error in eval, object '...' not found
your first chunk is fine. for the second one you need to load the packages you used before calling them in your syntax:
{r}
library(anova)
library(tukeyhsd)
intR <- aov(RESP ~ Temperature*pH, data = scallopData)
summary(intR)
TukeyHSD(intR)
Thije Zuidewind
Updated on June 04, 2022Comments
-
Thije Zuidewind almost 2 years
So I'm doing some statistical analysis in R and I would like to have the output in a markdown file. The code works perfectly when using it in my R session but when I knit the file to pdf none of my objects can be found.
So I read in the data and do some minor adjustments which works out fine. Though in the second block it can't find the object RESP which is one of the columns in my data frame. I tried phrasing it as scallopData$RESP but then it can't find the object scallopData so that doesn't help.
```{r} setwd("C:/Users/Zokids/Desktop/R-studio") scallopData <- read.table("scallopDATA.csv", header = T, sep = ";", na.strings = "NA", dec = ",") scallopData$pH <- as.factor(scallopData$pH) scallopData$Temperature <- as.factor(scallopData$Temperature) ``` ```{r} intR <- aov(RESP ~ Temperature*pH, data = scallopData) summary(intR) TukeyHSD(intR) ```
I get the error, Error in eval(expr, envir, enclos) : object 'RESP' not found Calls: ... eval -> -> model.frame.default -> eval -> eval
The solution is probably really obvious but I don't have that much experience with markdown yet.