[R] Using 'cat' on data frame

David Winsemius dwinsemius at comcast.net
Wed Dec 24 15:26:35 CET 2008


On Dec 24, 2008, at 2:35 AM, Gundala Viswanath wrote:

> Dear all,
>
> I have the following data frame:
>
>> raw.count
>                                    Var1
>                 Freq
> 1     AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA   707
> 2     AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAC    14
> 3     AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAT     3
>
> But why when printint it using 'cat', it doesn't print
> the desired string "AAA" ?
>
>> cat(raw.count$Var1, "\n")
> 1 2 3
>
> What's wrong with my cat command above.

"What's wrong" is that Var1 is a factor rather than a character  
vector. Veslot's answers provide the proper method for dealing with  
that situation.

-- 
David Winsemius
>
>
>
>
> - Gundala Viswanath
>
> ______________________________________________
> 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.



More information about the R-help mailing list