[R] Concatenate a Variable

From: Carla Rebelo <crebelo_at_liaad.up.pt>
Date: Fri, 01 Feb 2008 10:47:23 +0000


Good morning!

I do not speak English very well and so I will try to explain the best I can. I have this:

> tabela[,1]

[1] a a b b a c b a c c c c c
Levels: a b c

>unique(tabela[,1])

[1] a b c
Levels: a b c

>var<-unique(tabela[,1])[1]

> var

[1] a
Levels: a b c

But if I concatenate like this
> cat("VAR: ", var, "\n")

I obtain
>VAR: 1
and I want to obtain
>VAR: a

How can I do this? Thanks!



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Fri 01 Feb 2008 - 14:21:08 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 01 Feb 2008 - 18:30:11 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive