R 降价错误 "object '...' not found",与 dplyr
R markdown error "object '...' not found", with dplyr
以下是.rmd文件的部分内容。
## Loading and preprocessing the data
Load the data with dplyr and data.table package into a data table called activity.
```{Load, echo=TRUE}
library(dplyr)
library(data.table)
activity<-fread("activity.csv")
```
The date has character type. Use lubridate to produce a POSIX typed date for further processing.
```{Change date, echo=T}
library(lubridate)
activity<-mutate(activity,POSIXdate=activity[,date])
```
## What is mean total number of steps taken per day?
Use summarize function in dyplyr package to sum up steps variable, with activity grouped by dates, and store it into a new data table called stepsPerDay.
```{Sum each day, echo=TRUE}
stepsPerDay<-summarize(group_by(activity,date),steps=sum(steps,na.rm=T))
```
Data table stepsPerDay looks like this:
```{r, echo=F}
head(stepsPerDay)
```
一切正常,直到最后一行出现错误
object 'stepsPerDay' not found
Calls: <Anonymous> ... withCallingHandlers -> withVisible -> eval -> eval -> head
In addition: Warning messages:
1: In get_engine(options$engine) :
Unknown language engine 'Load' (must be registered via knit_engines$set()).
2: In get_engine(options$engine) :
Unknown language engine 'Change' (must be registered via knit_engines$set()).
3: In get_engine(options$engine) :
Unknown language engine 'Sum' (must be registered via knit_engines$set()).
Execution halted
我试过了
head(stepsPerDay)
或
summary(stepsPerDay)
或
StepsPerDay
所有return同样的错误。
我相信该对象是在降价文件中生成的,所以它应该在那里。我不知道为什么找不到该对象。
感谢您的帮助!
正如@rawr 提到的,我忘了将 "r" 放在括号中。
以下是.rmd文件的部分内容。
## Loading and preprocessing the data
Load the data with dplyr and data.table package into a data table called activity.
```{Load, echo=TRUE}
library(dplyr)
library(data.table)
activity<-fread("activity.csv")
```
The date has character type. Use lubridate to produce a POSIX typed date for further processing.
```{Change date, echo=T}
library(lubridate)
activity<-mutate(activity,POSIXdate=activity[,date])
```
## What is mean total number of steps taken per day?
Use summarize function in dyplyr package to sum up steps variable, with activity grouped by dates, and store it into a new data table called stepsPerDay.
```{Sum each day, echo=TRUE}
stepsPerDay<-summarize(group_by(activity,date),steps=sum(steps,na.rm=T))
```
Data table stepsPerDay looks like this:
```{r, echo=F}
head(stepsPerDay)
```
一切正常,直到最后一行出现错误
object 'stepsPerDay' not found Calls: <Anonymous> ... withCallingHandlers -> withVisible -> eval -> eval -> head In addition: Warning messages: 1: In get_engine(options$engine) : Unknown language engine 'Load' (must be registered via knit_engines$set()). 2: In get_engine(options$engine) : Unknown language engine 'Change' (must be registered via knit_engines$set()). 3: In get_engine(options$engine) : Unknown language engine 'Sum' (must be registered via knit_engines$set()). Execution halted
我试过了
head(stepsPerDay)
或
summary(stepsPerDay)
或
StepsPerDay
所有return同样的错误。 我相信该对象是在降价文件中生成的,所以它应该在那里。我不知道为什么找不到该对象。 感谢您的帮助!
正如@rawr 提到的,我忘了将 "r" 放在括号中。