Re: [R] separate and arrange outputs

From: Jerome Asselin <jerome.asselin.stat_at_gmail.com>
Date: Tue, 26 Apr 2011 16:06:13 -0400

On Tue, 2011-04-26 at 19:46 +0200, ivan wrote:
> Hello,
>
> given that a self made function produces multiple outputs, is there a
> possibility to separate latter by stars or simply by blank lines? Are there
> funtions for the arrangement of the output in general?

You can create a class for your object and then write a "print" method.

Example:

a <- list(a=2, b=c(2,2,2))
class(a) <- "myclass"
print.myclass <- function(x)
{
  print(x[[1]])
  cat("***********\n")
  print(x[[2]])
}

This yields:

> a

[1] 2



[1] 2 2 2

HTH, Jerome



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. Received on Tue 26 Apr 2011 - 20:08:38 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 27 Apr 2011 - 09:00:33 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive