I am trying to run ggvis
in combination with data.table
, see code below.
I get the following error:
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(":=").
If I run the line mtcars[ , mpg2 := mpg / 2]
in the console there is no problem. So what is the problem? [I am still suspicious about the fact that both data.table
and ggvis
use :=
.
---
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
version 1.9.2
ggvis
from github 0.3.0.9001 as CRAN version complained about missing knit_print
.
I have updated to data.table 1.9.3 and everything works like it should now. Thanks!