sideBySide | R Documentation |
Makes it easier to compare two or more objects by printing them in side-by-side columns.
sideBySide(x, PRINTFUN = NULL) ## S3 method for class 'sideBySide' print(x, ..., PRINTFUN = attr(x, ".PRINTFUN"), sep = " | ", width = getOption("width", 80))
x |
a list of one or more objects to be printed.
If |
PRINTFUN |
the function (or name of the function) to use to print the elements of |
sep |
a character string used as the separator between the side-by-side printouts of
the elements of |
width |
a positive integer giving the desired width of the printout, in characters. |
... |
the arguments passed to |
options("width")
is reduced by a factor of length(x)
.
The elements of x
are (virtually) printed with that width setting.
The (virtually) printed lines are pasted together so the objects
in x
are printed side by side.
If the print methods for the objects do
not keep within the requested reduced width, then the printed outputs will not
be printed side by side. You might need to expand options("width")
, and
your window width, to get nice results.
returns an object like x
with the class "sideBySide"
attached and
an attribute, ".PRINTFUN"
,
giving the default printing function to use.
sideBySide(list(NaiveFactorial=sapply(1:10,function(i)prod(1:i)), ViaGamma=gamma((1:10)+1))) # may need options(width=124) sideBySide(list(Default=terms(y ~ 1), NoIntercept=terms(y ~ -1)), PRINTFUN="str")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.