data.table - Data Tables in R: manipulating a column with/without a subset filter -


suppose have data table

library(data.table) ff=data.table(date=c("2013-01-01","2013-01-02","2013-01-03","2013-02-02"),x=c(1,2,3,4));   setkey(ff,date) 

then works ff[,as.date(date)] doesn't ff['2013-01-01',as.date(date)] latter throwing error

"error in as.date.default(date) : not know how convert 'date' class “date”"

as @justin pointed out, fixed in next release.
temp workaround 1.8.10 daisychain [][] in:

 ff['2013-01-01'][, as.date(date)]   # or, if want dt back:  ff['2013-01-01'][, list(as.date(date))] 

Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -