[R] Question regarding print

Greg Snow Greg.Snow at imail.org
Thu Jun 17 20:00:42 CEST 2010


The cat function is probably the best approach, but if your really feel the need to use print then you can just assign blank names (now it will be a named vector and slower in heavy calculations, but the printing is different).  Try something like:

> names(x) <- rep( '', length(x) )
> print(x)
# or
> x

This of course leads to the question of how to prevent the blank line(s).  The best answer there is use the cat function (or some other specialized function to print your objects (which will probably use cat)).

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Adolf STIPS
> Sent: Thursday, June 17, 2010 8:20 AM
> To: r-help at r-project.org
> Subject: [R] Question regarding print
> 
> 
> Hi,
> 
> Does anybody know how to have output from print, without the leading
> [1]?
> (Or must I use cat/write?)
> 
> >out="r15"
> >print(out,quote=FALSE)
> [1] r15
> 
> And I definitely do not want the leading [1] as I want to construct a
> table
> from this.
> 
> Ciao, Adolf
> 
> 
> 
> 
> ------------------------------------------------
> Adolf Stips (new email: adolf.stips at jrc.ec.europa.eu)
> Global Environment Monitoring unit
> CEC Joint Research Centre, TP 272
> I-21027 Ispra, Italy
> Tel: +39-0332-789876
> Fax: +39-0332-789034
> I know that I do not know, but even that not for sure!
> ------------------------------------------------
> "The views expressed are purely those of the writer and may not in any
> circumstances be regarded as stating an official position of the
> European
> Commission."
> 
> ______________________________________________
> 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