loadStAttrib
is a data loading function for creating an st_attrib
object.
loadStAttrib
can read itemset-level attributes from a data.frame
or a .csv file.
loadStAttrib(object, item_attrib)
itemset-level attributes. Can be a data.frame
or the file path of a .csv file.
The content should at least include an 'STID' column that matches with itemset IDs (the 'STID' column) of the item_attrib
object.
an item_attrib
object. Use loadItemAttrib
for this.
loadStAttrib
returns a st_attrib
object.
data
a data.frame
containing itemset-level attributes.
dataset_reading
for examples.
## Read from data.frame:
itempool_reading <- loadItemPool(itempool_reading_data)
itemattrib_reading <- loadItemAttrib(itemattrib_reading_data, itempool_reading)
stimattrib_reading <- loadStAttrib(stimattrib_reading_data, itemattrib_reading)
## Read from file: write to tempdir() for illustration and clean afterwards
f <- file.path(tempdir(), "stimattrib_reading.csv")
write.csv(stimattrib_reading_data, f, row.names = FALSE)
stimattrib_reading <- loadStAttrib(f, itemattrib_reading)
file.remove(f)
#> [1] TRUE