justification: Get or set justification for data frame columns

Description Usage Arguments Details Value See Also Examples

View source: R/justification.R

Description

The justification function extracts all assigned justify attributes from a data frame, and returns them in a named list. The function also assigns justify attributes from a named list.

Usage

1
2
3

Arguments

x

A data frame or tibble

value

A named list of justification values.

Details

If justification values are assigned to the "justify" attributes of the data frame columns, the justification function will extract those values. The function will return the justification values in a named list, where the names correspond to the name of the column that the justification was assigned to. If a column does not have a justify attribute assigned, that column will not be included in the list.

When used on the receiving side of an assignment, the function will assign justification to a data frame. The justification values should be in a named list, where each name corresponds to the name of the data frame column to assign values to.

Value

A named list of justification values.

See Also

fdata to display formatted data, value to create user-defined formats, and fapply to apply formatting to a vector.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# Take subset of data
df1 <- mtcars[1:10, c("mpg", "cyl") ]

# Print current state
print(df1)

# Assign justification
justification(df1) <- list(mpg = "left", cyl = "right")
widths(df1) <- list(mpg = 12, cyl = 10)

fdata(df1)


# Display justification
justification(df1)
widths(df1)

fmtr documentation built on July 25, 2021, 9:06 a.m.