
Produce ROCK attributes in YAML format from a data frame or spreadsheet
Source:R/attributes_from_df.R, R/attributes_from_spreadsheet.R
attributes_from_rectangular_data.RdThis function takes a data frame and then writes them to a file in the correct format of ROCK attributes.
Usage
attributes_from_df(
x,
classInstanceId_col,
colsToInclude = names(x),
output = NULL,
delimiterString = rock::opts$get("delimiterString"),
attributeContainer = rock::opts$get("attributeContainers")[1],
silent = rock::opts$get("silent"),
encoding = rock::opts$get("encoding")
)
attributes_from_spreadsheet(
x,
classInstanceId_col,
colsToInclude = names(x),
col_renaming = NULL,
sheet = 1,
output = NULL,
delimiterString = rock::opts$get("delimiterString"),
attributeContainer = rock::opts$get("attributeContainers")[1],
silent = rock::opts$get("silent"),
encoding = rock::opts$get("encoding")
)Arguments
- x
For
attributes_from_df, the data frame; and forattributes_from_spreadsheet, the path to the spreadsheet (an argument toread_spreadsheet()).- classInstanceId_col
The column name of the column with the class instance identifiers.
- colsToInclude
The column names of the columns with the attributes.
- output
The filename to write the attributes to.
- delimiterString
When exporting to
.rockformat (as opposed to.ymlor.yaml), the delimiter to use to delimit the YAML.- attributeContainer
The name of the root-level YAML node to store the attributes in (the ROCK standard specifies this should be
ROCK_attributes).- col_renaming
A named character vector where the names are the current column names and the values are the new names to be used when writing the corresponding attributes.
- sheet
The index (or name) of the worksheet containing the attributes.