使用Rmarkdown时在data.table中找不到列

使用Rmarkdown时在data.table中找不到列,r,shiny,data.table,r-markdown,R,Shiny,Data.table,R Markdown,我想知道为什么在以下代码中找不到物种列: ```{r echo=FALSE} inputPanel( selectInput("s", label = "Species:", choices = unique(iris$Species)) ) renderPlot({ iris.dt <- data.table(iris) ggplot(iris.dt[Species == input$s], aes(Sepal.Length, Sepal.Wid

我想知道为什么在以下代码中找不到物种列:

```{r echo=FALSE}
inputPanel(
  selectInput("s", label = "Species:",
              choices = unique(iris$Species))
)

renderPlot({
  iris.dt <- data.table(iris)
  ggplot(iris.dt[Species == input$s], aes(Sepal.Length, Sepal.Width)) + geom_point()
})
`{r echo=FALSE}
输入面板(
选择输入(“s”,label=“种类:”,
选择=唯一(虹膜$物种))
)
渲染图({

iris.dt在我的设置中运行良好:win_7、R_3.3.2、Shinny_1.0.0、data.table_1.10.4、ggplot2_2.2.1如果我运行Rmarkdown文档,我会得到错误:找不到对象“物种”。我也没有问题。看起来data.table没有加载。
Output created: C:/Users/xxxxx/AppData/Local/Temp/Rtmp0Af32S/file243c5299469.html
Warning: Error in [.data.frame: object 'Species' not found
Stack trace (innermost first):
    105: [.data.frame
    104: [.data.table
    103: [
    102: ggplot
    101: renderPlot [<text>#8]
     91: <reactive:plotObj>
     80: plotObj
     79: origRenderFunc
     78: output$out6967b1458d9fe4b5
      3: <Anonymous>
      2: do.call
      1: rmarkdown::run