[datatable-help] Is this supposed to happen?
Matthew Dowle
mdowle at mdowle.plus.com
Wed May 23 15:48:21 CEST 2012
No bug.
> DT=data.table(a=1:3)
> class(DT[,a])
[1] "integer"
> class(DT[,1,with=FALSE])
[1] "data.table" "data.frame"
See FAQ 1.3.
> Hi
>
> Is this another bug? These two queries are the same however they produce
> different results. On the first line I use the column number on the second
> I use the column name. In this case the column name is unique, and it is
> the second query that produces the correct results. Note that the first
> answer matches, after this when the column is designated by number it
> appears to be keeping the entry the same down all the rows.
>
> Sorry I cannot send a reproducible example here.
>
> Sean
>
> unlist(mapply(PG_Swap, OL.Table[,SwapContract], OL.Table[,210,
> with=FALSE]))
>
> First four results are
> 4.926100 5.601483 4.926100 4.926100
>
>
>
>
> unlist(mapply(PG_Swap, OL.Table[,SwapContract], OL.Table[,Curvem3] ))
>
> First four results are
> 4.9260996 13.1955345 204.3003283 6.7244788
>
>
> names(OL.Table)[210]
> [1] "Curvem3"
>
>
>
>
>
>
>
>
>
> -----Original Message-----
> From: Matthew Dowle [mailto:mdowle at mdowle.plus.com]
> Sent: 23 May 2012 14:03
> To: Creighton, Sean [ICG-MKTS]
> Cc: 'Matthew Dowle'
> Subject: RE: [datatable-help] Is this supposed to happen?
>
>
> Change repo to R-Forge. Or click link on homepage to R-Forge and command
> is there to paste onto the command line. Chris may be able to give some
> tips/warnings about keeping up with dev. I think it's best to svn up and
> compile from source; I don't know how reliable R-Forge's daily build is
> these days (it used to be extremely unreliable). But beware that even the
> source tarball is only updated once a day, which is why we say: svn up.
>
>> Hi
>>
>> Thanks for coming back so quickly, I will try and file a bug report (I
>> have never done that before).
>>
>> Can I force R to get version 1.8.1? update.packages() leaves me on
>> 1.8.0.
>>
>> Thanks again
>> Sean
>>
>>
>>
>> -----Original Message-----
>> From: Matthew Dowle [mailto:mdowle at mdowle.plus.com]
>> Sent: 23 May 2012 13:16
>> To: Creighton, Sean [ICG-MKTS]
>> Cc: datatable-help at lists.r-forge.r-project.org
>> Subject: Re: [datatable-help] Is this supposed to happen?
>>
>>
>> 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.ht
>>> m l 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/datatabl
>>> e
>>> -help
>>>
>>
>>
>>
>
>
>
More information about the datatable-help
mailing list