8-02-2012, 09:45 (+0100); Martin Maechler escriu:
> >>>>> "R Michael Weylandt <michael.weyla...@gmail.com>"
> >>>>> <michael.weyla...@gmail.com>
> >>>>>     on Tue, 7 Feb 2012 20:23:57 -0500 writes:
> 
>     > Possibly as.character() is what the OP was seeking
>     > Michael
> 
> or   format()   which is closer for numeric data
> 

Thanks for the suggestions, but none of these appears to do what I
need. Take a table such as

> a <- as.table(c(A=450,B=12))
> a
  A   B 
450  12 

The string that print() prints is " A B \n450 12 \n". Once you have
the string you can print it with cat() and get the same result as with
print().

> cat("  A   B \n450  12 \n")
  A   B 
450  12 

The function that I was looking for was one that given the table a in
the example would return the string described above. Apparently,
capture.output() can be used for that, although it returns the string
split into lines they can be joined together easily. So, case closed
:)

-- 
Bye, 
Ernest

______________________________________________
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