[R] Concatenate a Variable

Carla Rebelo crebelo at liaad.up.pt
Fri Feb 1 11:47:23 CET 2008


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!



More information about the R-help mailing list