Whoops thats what I get for trying to recreate examples by memory. Bug report: https://r-forge.r-project.org/tracker/index.php?func=detail&aid=1711&group_id=240&atid=975
On 16 December 2011 11:10, Matthew Dowle <[email protected]> wrote: > > Agreed. That doesn't seem to be precisely what you really had at the > prompt (notice the 10 vs 100) but a good find, yes, please raise. > >> 99% positive this is a bug but I like to get confirmation before >> making reports. Still on 2.12.1 64-bit R on Linux, latest SVN version >> of data.table with debugging turned on. >> >> If you do >> >> DT <- data.table(x=1:10) >> >> DT[, a := letters] >> >> >> You will get the error: >> >> Error in `[.data.table`(DT, , `:=`(a, letters)) : >> Tried to assign 26 items to target of 100 (can recycle but must be >> exact multiple). If users ask us to change this to a warning, we will >> change it; please ask maintainer('data.table'). >> >> >> Which is fine. However, the state of DT after that is that DT has two >> columns, x (the column it started with) and a, a column full of NULL >> values. If I then try to do something like >> >> DT[, a:=5] >> >> It will say the following error: >> >> Error in `[.data.table`(DT, , `:=`(a, 5)) : >> cannot coerce type 'double' to vector of type 'NULL' >> >> >> Finally, if I make DT bigger, and try the same thing: >> >> DT <- data.table(x=1:1e6) >> DT[, a := letters] >> >> It will give me the same error message, but now the state of DT is >> even more screwed up. If I try to just print DT I get: >> >>> DT >> Error in names(ans) = names(x) : >> 'names' attribute [2] must be the same length as the vector [1] >> _______________________________________________ >> datatable-help mailing list >> [email protected] >> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help >> > > _______________________________________________ datatable-help mailing list [email protected] https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help
