[R] names function not working at the 2nd place in a program
gunter.berton at gene.com
Fri Jul 27 00:21:56 CEST 2012
Actually, better to use the names() extractor.
Sent from my iPhone -- please excuse typos.
On Jul 26, 2012, at 3:08 PM, Rui Barradas <ruipbarradas at sapo.pt> wrote:
> About the cause of your problem, it's difficult to have an idea without any code. But maybe it's helpfull to know that 'names' is an attribute, so you can see its value with
> attr(x, "names") # just 'names' attribute
> attributes(x) # values of all attributes
> Hope this helps,
> Rui Barradas
> Em 26-07-2012 22:19, zz escreveu:
>> I am using names function to name an array.
>> It works first time when I use *as.numeric(names(myVar1)*
>> However, at a place later, when I tried to use a very similar line of code
>> *as.numeric(names(myVar2)*, it always returned 'numeric(0)' (or if I only
>> type 'names(myVar2), it gave me NULL'.
>> Both myVar1 and myVar2 are type of integer. The only difference that I can
>> tell is where the names function are called in my code.
>> Does anyone have an idea what may cause the problem?
>> Thanks in advance.
>> View this message in context: http://r.789695.n4.nabble.com/names-function-not-working-at-the-2nd-place-in-a-program-tp4638004.html
>> Sent from the R help mailing list archive at Nabble.com.
>> R-help at r-project.org mailing list
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help