[datatable-help] Is this supposed to happen?

Matthew Dowle mdowle at mdowle.plus.com
Wed May 23 14:15:37 CEST 2012


Hi,
Interesting. Please file a bug.report(package="data.table").
As you say internally it looks like it's converting the position to a name
and then matching again, which isn't right.
In the meantime in v1.8.0 :
set(X,i=NULL,j=2L,value=200L)
In 1.8.1 the i is by default NULL so it's just :
set(X,j=2L,value=200L)
or just
set(X,,2L,200L)
Matthew

> Hi
> 	        X 	<-	data.table(a=rep(1:3,1:3),b=31:36,c=7:12)
> 		X
> 		setnames(X,	2,	"a" )  ## two column named "a" now
> 		X
> 		X[,2:=200L, with=FALSE  ]	# Change the entries of column 2
> 		X[,2, with=FALSE  ]		        # Instead of changing column 2, the code
> appears to have done a look up on the column names and picked the first
> match
> 		X
>
> Can anybody tell me how to change column 2 in this example when I have
> duplicate column names?
>
> Thanks
> Sean
>
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Is-this-supposed-to-happen-tp4631075.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