test_matrix_form | R Documentation |
Useful functions for writing tests and examples, and a starting point for
more sophisticated custom matrix_form
methods.
basic_matrix_form(
df,
indent_rownames = FALSE,
parent_path = NULL,
ignore_rownames = FALSE,
add_decoration = FALSE,
fontspec = font_spec(),
split_labels = NULL,
data_labels = NULL,
num_rep_cols = 0L
)
basic_listing_mf(
df,
keycols = names(df)[1],
add_decoration = TRUE,
fontspec = font_spec()
)
df |
( |
indent_rownames |
( |
parent_path |
( |
ignore_rownames |
( |
add_decoration |
( |
fontspec |
( |
split_labels |
( |
data_labels |
( |
num_rep_cols |
( |
keycols |
( |
If some of the column has a obj_format assigned, it will be respected for all column
values except for label rows, if present (see parameter split_labels
).
A valid MatrixPrintForm
object representing df
that is ready for
ASCII rendering.
A valid MatrixPrintForm
object representing df
as a listing that is ready for ASCII
rendering.
basic_listing_mf()
: Create a MatrixPrintForm
object from data frame df
that
respects the default formats for a listing object.
mform <- basic_matrix_form(mtcars)
cat(toString(mform))
# Advanced test case with label rows
library(dplyr)
iris_output <- iris %>%
group_by(Species) %>%
summarize("all obs" = round(mean(Petal.Length), 2)) %>%
mutate("DataRow_label" = "Mean")
mf <- basic_matrix_form(iris_output,
indent_rownames = TRUE,
split_labels = "Species", data_labels = "DataRow_label"
)
cat(toString(mf))
mform <- basic_listing_mf(mtcars)
cat(toString(mform))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.