data.table

Published by onesixx on

 

> A <- as.data.frame(a)
> A
      a
1    NA
2  TRUE
3 FALSE
4    NA
> AA <- as.data.table(A)
> AA[,(nn):=NULL]
Error in eval(lhs, parent.frame(), parent.frame()) : 
  object 'nn' not found
> AA[,(nn):=NA]
Error in eval(lhs, parent.frame(), parent.frame()) : 
  object 'nn' not found
> AA[,.(nn):=NA]
Error in eval(lhs, parent.frame(), parent.frame()) : 
  object 'nn' not found
> AA[,nn:=NA]
> AA[,nn:=NULL]
> AA[,nn:=NULL]
Warning message:
In `[.data.table`(AA, , `:=`(nn, NULL)) :
  Adding new column 'nn' then assigning NULL (deleting it).
> AA
       a
1:    NA
2:  TRUE
3: FALSE
4:    NA
> AA[a==TRUE,nn:=TRUE]

 

 

Categories: Reshaping

onesixx

Blog Owner

Leave a Reply

Your email address will not be published.