Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
278 views
in Technique[技术] by (71.8m points)

Why can R markdown not read my columns when I knit it?

Whenever I try to knit my data Rmarkdown comes up with the following error message. I have attached my code and the error messages. It is fine when i just run the code. MASS is one of the column headings in my data. The other column heading is TIME. There are 23 observations. Any help would be greatly appreciated!!!

```{r setup, include=TRUE}
knitr::opts_chunk$set(echo = TRUE)

```


```{r}
library(readr)
LSPILL <- read_csv("LSPILL.csv")
View(LSPILL)
spillmodel = lm(MASS~TIME, data = LSPILL)
summary(spillmodel)
coefficients(spillmodel)
plot(MASS~TIME, main = "scatterplot of mass of a spill vs time of a liquid spent on floor", xlab = "time of liquid spent on floor (minutes)", ylab = "mass of spill (pounds)", data = LSPILL )
abline(spillmodel)
anova(spillmodel)
cor(TIME, MASS)
(-0.9237634)^2
confint(spillmodel, level = 0.90)
newmass = data.frame(TIME = c(15))
predict(spillmodel, newdata = newmass, se.fit = T, interval = c("confidence"), level =0.99)
predict(spillmodel, newdata = newmass, se.fit = T, interval = c("prediction"), level = 0.99)
```

Here are the error messages:

Error in is.data.frame(y) : object (MASS) no found Calls: <Anonymous> ... withVisible -> eval -> eval -> cor -> is.data.frame Execution Halted

processing file: math-204-homework-3.Rmd
  |..............                                                        |  20%
  ordinary text without R code

  |............................                                          |  40%
label: setup (with options) 
List of 1
 $ include: logi TRUE

  |..........................................                            |  60%
  ordinary text without R code

  |........................................................              |  80%
label: unnamed-chunk-1

Quitting from lines 15-30 (math-204-homework-3.Rmd) 
Error in is.data.frame(y) : object 'MASS' not found
Calls: <Anonymous> ... withVisible -> eval -> eval -> cor -> is.data.frame
Execution halted
question from:https://stackoverflow.com/questions/65905180/why-can-r-markdown-not-read-my-columns-when-i-knit-it

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...