[R] c weirdness

Duncan Murdoch murdoch.duncan at gmail.com
Wed Nov 7 22:00:40 CET 2012


On 07/11/2012 3:53 PM, Sam Steingold wrote:
> is there a way to avoid c() appending ".0" and ".1" to seed?

Don't give it a named vector.  You can use the unname() function to 
strip the names from tab:

c("nons"=1, "seed"=unname(tab[1]))

> --8<---------------cut here---------------start------------->8---
> > c("nons"=1, "seed"=3)
> nons seed                       ## good!
>     1    3
> > c("nons"=1, "seed"=tab[1])
>     nons  seed.0                 ## don't want ".0"!
>        1 2344600
> > c("nons"=1, "seed"=tab[2])
>    nons seed.1                   ## don't want ".1"!
>       1   6843
> > tab
>        0       1
> 2344600    6843
> --8<---------------cut here---------------end--------------->8---
>




More information about the R-help mailing list