# NOT RUN {
format_type_sum(1, NULL)
pillar(1)
type_sum.accel <- function(x) {
structure("kg m/s^2", width = 8, class = "type_sum_accel")
}
format_type_sum.type_sum_accel <- function(x, width, ...) {
if (!is.null(width) && width < attr(x, "width")) {
x <- substr(x, 1, width)
}
style_subtle(x)
}
accel <- structure(9.81, class = "accel")
pillar(accel)
# }
Run the code above in your browser using DataCamp Workspace