[datatable-help] Problem with := in datatable 1.7.0
Matthew Dowle
mdowle at mdowle.plus.com
Fri Oct 21 02:52:32 CEST 2011
Thanks for reporting. Now fixed in 1.7.1.
(The long warning message is correct though.)
Matthew
On Thu, 2011-10-20 at 14:45 -0700, mhwaliji wrote:
> I tried out the new version of data.table using the following command.
>
> svn checkout svn://svn.r-forge.r-project.org/svnroot/datatable/pkg@373
>
> However, I get the following error with :=. Note that it set all the values
> of y to 1, not just the rows selected. Is this a new bug, or am I perhaps
> retrieving from the wrong repository?
>
> > DT <- data.table(x=rep(c(1, 2), each=5), y=11:20)
> > DT[x == 1, y := x]
> x y
> [1,] 1 1
> [2,] 1 1
> [3,] 1 1
> [4,] 1 1
> [5,] 1 1
> [6,] 2 1
> [7,] 2 1
> [8,] 2 1
> [9,] 2 1
> [10,] 2 1
> Warning message:
> In `[.data.table`(DT, x == 1, `:=`(y, x)) :
> Coerced numeric RHS to integer to match the column's type; may have
> truncated precision. Either change the column to numeric first (by creating
> a new numeric vector length 10 (nrows of entire table) yourself and
> assigning that; i.e. 'replace' column), or coerce RHS to integer yourself
> (e.g. 1L or as.integer) to make your intent clear (and for speed). Or, set
> the column type correctly up front when you create the table and stick to
> it, please.
>
> Thanks,
> Muhammad
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Problem-with-in-datatable-1-7-0-tp3923534p3923534.html
> Sent from the datatable-help mailing list archive at Nabble.com.
> _______________________________________________
> datatable-help mailing list
> datatable-help at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help
More information about the datatable-help
mailing list