That was the answer, thanks a lot!<br><br><div class="gmail_quote">On Wed, Sep 12, 2012 at 1:12 AM, Matthew Dowle <span dir="ltr"><<a href="mailto:mdowle@mdowle.plus.com" target="_blank">mdowle@mdowle.plus.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
This sounds like :<br>
<br>
o   Chris Neff for #2146: using := to add a column to the result of a<br>
    simple column subset such as DT[,list(x)], or after changing all<br>
    column names with setnames(), was an error. Fixed and tests added.<br>
<br>
which was fixed just before 1.8.2 went to CRAN.<br>
<br>
Please run test.data.table() on the Windows machine to ensure it returns<br>
717 tests passed precisely. If not, then you managed to install a slightly<br>
older version of 1.8.2 from R-Forge in the one or two day window that was<br>
possible, after it was named 1.8.2 but before that fix was made. If so,<br>
reinstalling from CRAN should fix it.<br>
<div><div class="h5"><br>
<br>
> Hi together,<br>
><br>
> here's my code:<br>
><br>
> library(data.table)<br>
> test_fun <- function(DT, year) {<br>
><br>
>   adj_r2   <- DT[, list(Tau_1 = summary(lm(NI_1 ~<br>
> Total_Assets))$adj.r.squared,<br>
>                         Tau_2 = summary(lm(NI_2 ~<br>
> Total_Assets))$adj.r.squared)]<br>
><br>
><br>
>   adj_r2[, Year := as.integer(year)]<br>
><br>
>   adj_r2<br>
><br>
> }<br>
><br>
> DT <- data.table(NI_1 = rnorm(1000),<br>
>                  NI_2 = rnorm(1000),<br>
>                  Total_Assets = rnorm(1000))<br>
><br>
> test_fun(DT, 2000)<br>
><br>
> This gives me the following error on my windows machine:<br>
><br>
> Error in `[.data.table`(adj_r2, , `:=`(Year, as.integer(year))) :<br>
>   It appears that at some earlier point, names of this data.table have<br>
> been<br>
> reassigned. Please ensure to use setnames() rather than names<- or<br>
> colnames<-. Otherwise, please report to datatable-help.<br>
><br>
> My sessionInfo():<br>
><br>
> R version 2.15.1 (2012-06-22)<br>
> Platform: x86_64-pc-mingw32/x64 (64-bit)<br>
><br>
> locale:<br>
> [1] LC_COLLATE=German_Germany.1252  LC_CTYPE=German_Germany.1252<br>
>  LC_MONETARY=German_Germany.1252 LC_NUMERIC=C<br>
>  LC_TIME=German_Germany.1252<br>
><br>
> attached base packages:<br>
> [1] stats     graphics  grDevices utils     datasets  methods   base<br>
><br>
> other attached packages:<br>
> [1] data.table_1.8.2<br>
><br>
> loaded via a namespace (and not attached):<br>
> [1] tools_2.15.1<br>
><br>
> Interestingly, on my Linux machine, everything works fine:<br>
><br>
> Output there:<br>
>            Tau_1         Tau_2 Year<br>
> 1: -0.0006947528 -0.0005516822 2000<br>
><br>
> sessionInfo()<br>
><br>
> R version 2.15.1 (2012-06-22)<br>
> Platform: x86_64-pc-linux-gnu (64-bit)<br>
><br>
> locale:<br>
>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C<br>
> LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8<br>
> LC_MONETARY=en_US.UTF-8<br>
>  [6] LC_MESSAGES=en_US.UTF-8    LC_PAPER=C                 LC_NAME=C<br>
>            LC_ADDRESS=C               LC_TELEPHONE=C<br>
> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C<br>
><br>
> attached base packages:<br>
> [1] stats     graphics  grDevices utils     datasets  methods   base<br>
><br>
> other attached packages:<br>
> [1] iccFunctions_0.0.4 roxygen2_2.2.2     digest_0.5.2       dyn_0.2-8.1<br>
>      zoo_1.7-7          lubridate_1.1.0    data.table_1.8.2<br>
><br>
> loaded via a namespace (and not attached):<br>
> [1] brew_1.0-6      grid_2.15.1     lattice_0.20-10 plyr_1.7.1<br>
>  stringr_0.6.1   tools_2.15.1<br>
><br>
> Therefore, could someone with a Windows machine confirm this error?<br>
> Matthew, do you have an idea what is causing this?<br>
><br>
> Thanks in advance,<br>
><br>
> Christoph<br>
</div></div>> _______________________________________________<br>
> datatable-help mailing list<br>
> <a href="mailto:datatable-help@lists.r-forge.r-project.org">datatable-help@lists.r-forge.r-project.org</a><br>
> <a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help</a><br>
<br><br></blockquote></div>