Something really strange is happening here. In the code below, I create a variable called temp . I have to call him twice before I can understand what it is. For instance. The first time I call it, the console shows nothing. The second time, it shows data.table / data.frame what it is. Can someone help me understand what is going on here?
library(magrittr) library(data.table) myDT <- as.data.table(mtcars) temp <- myDT %>% melt(id.vars = c('cyl', 'mpg', 'hp'), measure.vars = c('vs','am','gear','carb'), variable.name = 'Data') %>% extract( value > 0) %>% extract( , value := NULL)
What does my console do (the first call does nothing):
> temp > temp cyl mpg hp Data 1: 4 22.8 93 vs 2: 6 21.4 110 vs 3: 6 18.1 105 vs 4: 4 24.4 62 vs 5: 4 22.8 95 vs ... ...
source share