Converts a list of DataSet
objects to a data.frame
Source: R/utilities-data-set.R
dataSetToDataFrame.Rd
Converts a list of DataSet
objects to a data.frame
Arguments
- dataSets
A list of
DataSet
objects or a singleDataSet
- names
Optional character vector of custom names to assign to the datasets. If provided, must have the same length as the number of DataSet objects. This allows renaming datasets, which is particularly useful when multiple datasets have the same original name.
Value
DataSet objects as data.frame with columns name, xValues, yValues,
yErrorValues, xDimension, xUnit, yDimension, yUnit, yErrorType, yErrorUnit,
molWeight, lloq, and a column for each meta data that is present in any
DataSet
.
Examples
# Create datasets with duplicate names
ds1 <- DataSet$new(name = "Obs")
ds1$setValues(xValues = c(1, 2), yValues = c(10, 20))
ds2 <- DataSet$new(name = "Obs")
ds2$setValues(xValues = c(3, 4), yValues = c(30, 40))
# Convert to tibble with custom names
tibble_data <- dataSetToTibble(list(ds1, ds2), names = c("Study1", "Study2"))
unique(tibble_data$name) # Returns c("Study1", "Study2")
#> [1] "Study1" "Study2"