fattr<- | R Documentation |
Assign formatting attributes to a vector
fattr(x) <- value
x |
The vector or data frame column to assign attributes to. |
value |
A named vector of attribute values. |
The fattr
function is a convenience function for assigning
formatting attributes to a vector. The function accepts a named list of
formatting attributes. Valid names are 'format', 'width', 'justify',
'label' and 'description'.
See fattr
for additional details.
fdata
to apply formats to a data frame,
fapply
to apply formats to a vector.
# Create vector
a <- c(1.3243, 5.9783, 2.3848)
# Assign format attributes
fattr(a) <- list(format = "%.1f")
# Apply format attributes
fapply(a)
# [1] "1.3" "6.0" "2.4"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.