Description Usage Arguments Details Value See Also Examples
Forms a dataset by applying flexible rules for numeric formatting, accentuation and filtering.
1 2 3 4 5 6 7 8 9 10 11 12 13 | form(data, ...)
## S3 method for class 'data.frame'
form(data, format = "%.3f", formatcolumns = list(),
marker = list(), symbols = list(), groups = list(),
groups_only = FALSE, filterrows = character(),
filtercolumns = character())
## S3 method for class 'matrix'
form(data, ...)
## S3 method for class 'table'
form(data, format = "%i", ...)
|
data |
A dataset with numeric values and other typed data.
Every column will be coerced to |
format |
Default C-formatting (see |
formatcolumns |
A list with column-specific C-formatting of numerical
values. The format is identical to |
marker |
A list with marking rules which are going to be applied
to user-specified columns of |
symbols |
A list with symbols to visually highlight all cells where the
marking rules of |
groups |
A list with vectors of regular expressions that are going to be
applied to the row names of |
groups_only |
A logical value indicating whether to apply the marker rules only groupwise. |
filterrows |
A vector of regular expressions which are applied to
the row names of |
filtercolumns |
A vector of regular expressions which are applied to
the column names of |
The function allows the user to format all kinds of numeric or
character data on the fly, e.g. resulting output from computations.
It can be employed greatly to automatically prepare data and results
to review it directly in the R session or to export it to a
dynamically designed LaTeX table code via latex
.
The package and this function will be improved by missing
functionality on a regular basis. The author is eager to receive
your suggestions in order to improve the dynamics and power of
PlainT and form
. Please write to Fabian Raters
(mail@qrat.de).
The function returns a formatted character dataset of class
form
which inherits of data.frame
.
For exporting the formed frame, see latex
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ## forming mtcars
mtcarsf <- form(data = mtcars,
format = "%i",
formatcolumns = list("%5.1f" = "disp",
"%3i" = "hp",
"%4.1f" = "qsec",
"%4.2f" = c("drat", "wt")),
marker = list(min = c("mpg", "cyl", "disp", "hp", "drat",
"wt", "qsec"),
max = c("mpg", "cyl", "disp", "hp", "drat",
"wt", "qsec"),
"v==1" = "am"),
symbols = list("**v" = "max.all",
"..v" = "min.all",
"[v]" = "v==1"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.