On 04/11/2010 10:53 AM, Luis Ridao wrote:
R-help,

I was wondering how to remove indexing from an output, e.g.,

>  aVector<-1:10
>  aVector
  [1]  1  2  3  4  5  6  7  8  9 10

>  someFunction(aVector)
1  2  3  4  5  6  7  8  9 10


The cat() function gives you lots of flexibility in how things print. Your example is a little complicated, because you appear to want the spacing that print() gives without the indexing, which probably means using sprintf() or format(). If that's just a relic of cut and paste, then

cat(aVector, "\n")

is fine. (The \n is optional; it goes to a new line.) If you really want the fancy spacing, something like

cat(format(aVector), "\n")

Duncan Murdoch

______________________________________________
R-help@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.

Reply via email to