table_prep | R Documentation |
This function prepares the data pivotal for tabulation. It is intended to use as a first step in the creation of a report pivotal table. It is not likely that this function will be used as stand-alone
table_prep(dfrm, x, y, var, fill = "", type = "latex", convchar = TRUE)
dfrm |
the data frame for which the table should be generated |
x |
vector of x variable(s) in the data frame |
y |
vector of y variable(s) in the data frame (will be cast to generate long format) |
var |
variable within the data frame with the values to be placed in the table |
fill |
character vector of one indicating the character to use in case of missing values |
type |
character vector of one indicating the type of table to generate, see details |
convchar |
logical indicating if special characters should be masked |
This function only prepares the data for pivotal tabulation. The base of the function is the dcast function from plyr to reshape the data and the generation of a table header object to indicate how headers should be placed within the table. The function also specifies a type argument which includes "latex" or "html", this is necessary to identify specific character handling (convchar) that differs between HTML and LaTeX.
The function returns a list with the original dataframe, the table header, table data and other table specifications
data(Indometh)
table_prep(Indometh,"time","Subject","conc")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.