[R] removing indexing
Duncan Murdoch
murdoch.duncan at gmail.com
Thu Nov 4 15:59:49 CET 2010
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
More information about the R-help
mailing list