以下是.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.
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.
stepsPerDay<-summarize(group_by(activity,date),steps=sum(steps,na.rm=T))
Data table stepsPerDay looks like this:
head(stepsPerDay)
一切都运行良好,直到最后一行,当它给我错误
>对象'stepsPerDay'未找到调用:<Anonymous> ... withCallingHandlers - > withVisible - > eval - > eval - > head另外:警告消息:1:在get_engine(options $ engine)中:未知语言引擎'Load' (必须通过knit_engines $ set()注册) . 2:在get_engine中(选项$引擎):未知语言引擎“更改”(必须通过knit_engines $ set()注册) . 3:在get_engine(options $ engine)中:未知语言引擎'Sum'(必须通过knit_engines $ set()注册) . 执行停止
我试过了
```java
head(stepsPerDay)
要么
summary(stepsPerDay)
要么
StepsPerDay
全部返回相同的错误 . 我相信该对象是在markdown文件中生成的,所以应该在那里 . 我不知道为什么找不到这个对象 . 谢谢你的帮忙!
1 回答
正如@rawr所提到的,我忘了把“r”放在括号中 .