Dear all, I have the following data frame:> raw.countVar1 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. - Gundala Viswanath
print(as.matrix(raw.count),quote=F) cat(as.character(raw.count$Var1)) Jacques VESLOT CEMAGREF - UR Hydrobiologie Route de C?zanne - CS 40061 13182 AIX-EN-PROVENCE Cedex 5, France T?l. + 0033 04 42 66 99 76 fax + 0033 04 42 66 99 34 email jacques.veslot at cemagref.fr>-----Message d'origine----- >De?: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] De la part >de Gundala Viswanath >Envoy??: mercredi 24 d?cembre 2008 08:35 >??: r-help at stat.math.ethz.ch >Objet?: [R] Using 'cat' on data frame > >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. > > > >- 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.
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.
Apparently Analagous Threads
- sliding window over a large vector
- selecting a subset of a matrix based on a value occurring in 5 records
- factor manipulation: edgelist to a matrix?
- density estimation
- [LLVMdev] LLVM ERROR: Program used external function 'printd' which could not be resolved!