tags:

views:

111

answers:

2

In R, I use the print function for output but I always get an ugly output. If I do print("hello world")

the output is [1] "hello world"

Is there a function/way to print output and just get the text I want ?

Thanks

+5  A: 

Please read the fine manuals and discover cat(), sprintf(), ... and much much more.

Dirk Eddelbuettel
thank you. exactly what I needed, finding the manuals is the hard part with r :)
Jorge Guzman
Pardon me? Your R installation comes with six manuals, and the r-project.org website isn't exactly hidden either.
Dirk Eddelbuettel
@Dirk Eddelbuettel: I think what he means is that sometimes is difficult to find **what you need** in the manuals. Sometimes there's too many options! :) Anyway @Jorge Guzman also have a look at the `??` operator to search the manual and at the `RSiteSearch` command to search for commands in the R-help mailing list, help pages etc.
nico
I have to agree with nico, contra dirk: in python (an overtly designed language) you can be quite confident that you know all the (mere 30 or so) keywords in the basic language, and aware of the major elements of the Standard Library. Even after some years of using R I keep finding functions available by default that do things that I had always done by writing scripts of my own. I love R, but it does have an almost biological level of complexity if you want to understand it properly...
Michael Dunn
+1  A: 

Simply cat to print on stdout and message to print on stderr. sprintf (working exactly as in C) and paste are helpful when generating the output.

mbq