ggvis和data.table冲突?

时间:2014-08-18 15:48:45

标签: r data.table ggvis

我正在尝试将ggvisdata.table结合使用,请参阅下面的代码。 我收到以下错误:

Error in `:=`(mpg2, mpg/2) : 
  Check that is.data.table(DT) == TRUE. Otherwise, := and `:=`(...) 
  are defined for use     in j, once only and in particular ways. See help(":=").

如果我在控制台中运行mtcars[ , mpg2 := mpg / 2]行,则没有问题。那么问题是什么? [我仍然怀疑data.tableggvis使用:=这一事实。

---
title: "Untitled"
output: html_document
runtime: shiny
---

```{r echo = FALSE}
library(ggvis)
library(data.table)

mtcars %>%
  ggvis(x = ~wt, y = ~mpg) %>%
  layer_points()

mtcars = data.table(mtcars)
mtcars[, mpg2 := mpg / 2]  # gives error message

# code below does not work as the line above throws an error

mtcars %>%
  ggvis(x = ~wt, y = ~mpg2) %>%
  layer_points()

```

data.table版本1.9.2

来自github 0.3.0.9001的

ggvis作为CRAN版本抱怨缺少knit_print

1 个答案:

答案 0 :(得分:0)

我已经更新到data.table 1.9.3,一切都像现在一样。谢谢!