Description Usage Arguments Details Examples
Set or retrieve a column type of a colorful data frame
1 2 3 |
x |
a colorful data frame |
cols |
column names to set or retrieve |
value |
character vector with column types |
Rather than directly assigning a style to a column (which is possible
using the col.styles
element) it is preferable to change a style
associated with a column type. Several such types are defined in the
default styles:
character
numeric
integer
factor
identifier
pval
match
hidden
default
Of course, new column types may be defined and their formatting defined in a theme or a particular data frame style.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | mc <- colorDF(mtcars)
col_type(mc, "gear") <- "factor"
col_type(mc, "gear")
col_type(mc) <- list(gear="factor", cyl="integer")
## Note: the *class* of the columns did not change!
## Chaning column type merely changes the way it is displayed
class(mc[["gear"]])
## Hide some columns
col_type(mc, c("disp", "hp")) <- "hidden"
## Create a new type and style
col_type(mc, "carb") <- "carbstyle"
df_style(mc)$type.styles$carbstyle <- list(fg="red", decoration="bold")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.