[datatable-help] Fwd: problems with modifying colnames

Michael Nelson michael.nelson at sydney.edu.au
Fri Jul 25 04:41:19 CEST 2014


This is a known issue

https://github.com/Rdatatable/data.table/issues/512


________________________________________
From: datatable-help-bounces at lists.r-forge.r-project.org [datatable-help-bounces at lists.r-forge.r-project.org] on behalf of Francois Pepin [fpepin at gmail.com]
Sent: Friday, 25 July 2014 11:27 AM
To: datatable-help at lists.r-forge.r-project.org
Subject: [datatable-help] Fwd: problems with modifying colnames

Hi everyone,

I’m hitting a weird bug which I think might be data.table’s fault.

x<-data.table(a=1,b=2)
xn<-colnames(x)
xn
#[1] "a" "b"
x[,c:=3]
xn
[1] "a" "b" "c"


I would expect xn to stay the same value even if we change the columns in x.

There’s an easy workaround with copy(xn), but it’s weird and
surprising enough that I wanted to let others know about it.

Could someone check to see if this is reproducible? I’ll be happy to
file the bug report if it’s a genuine bug.

Thanks,

Francois

R version 3.1.0 (2014-04-10)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
[1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8       LC_NAME=C
[9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] data.table_1.9.3

loaded via a namespace (and not attached):
[1] plyr_1.8.1    Rcpp_0.11.2   reshape2_1.4  stringr_0.6.2
_______________________________________________
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