In R, why does is.na cause data.table to display the data.table as ouput? Version 1.9.4 -


the data.table package (which amazingly useful) still prints data.table output in following scenario. known issue? seems occur when is.na used.

earlier posting reference

di <- data.table(iris) di[is.na(sepal.length),color := "blue"] packageversion("data.table")   sepal.length sepal.width petal.length petal.width   species   1:          5.1         3.5          1.4         0.2    setosa   2:          4.9         3.0          1.4         0.2    setosa   3:          4.7         3.2          1.3         0.2    setosa   4:          4.6         3.1          1.5         0.2    setosa   5:          5.0         3.6          1.4         0.2    setosa  ---                                                             146:          6.7         3.0          5.2         2.3 virginica 147:          6.3         2.5          5.0         1.9 virginica 148:          6.5         3.0          5.2         2.0 virginica 149:          6.2         3.4          5.4         2.3 virginica 150:          5.9         3.0          5.1         1.8 virginica > packageversion("data.table") [1] ‘1.9.4’ 

6/14/2015 edit: responses. indeed seems issue no records meet criteria, whereas is.na example example of general issue. confirm, line causes data.table display:

 di[sepal.length > 100,color := "blue"] 

by way, if column exists data.table still gets displayed if no records found. so:

d2 <- data.table(iris) d2[,clr := na] d2[sepal.length > 100, clr := "blue"] 

sounds authorities aware of , have tackled. can work around issue in meantime.


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -