In general, OpenLongData objects require a filepath to be created, if the user wants to use real data. For ABC, the files are not taken from Biolincc, and there is an intermediate step where users are expected to run a SAS macro on the data to create the appropriate file directory.
The validator function for OpenLongABC objects should account for this, and should throw errors that tell users to run the SAS macro if needed.
Code to modify:
OpenLongAbc <- S7::new_class(
name = "OpenLongAbc",
package = 'OpenLong',
parent = OpenLongData,
validator = function(self) {
if(length(self@filepath) == 1){
# TODO: Brian to add a check for valid filepath
# (ping Byron to discuss this and see example in Mesa object)
}
}
)
And here is an example showing one possible error that will be thrown if someone tries to create a MESA data object but they don't give a filepath that links to a directory that matches the structure of the Biolincc directory:
OpenLongMesa <- S7::new_class(
name = "OpenLongMesa",
package = 'OpenLong',
parent = OpenLongData,
validator = function(self) {
if(length(self@filepath) == 1){
if("Primary" %nin% list.files(self@filepath)){
paste0(
"Primary directory not found in filepath: \'", self@filepath, "\'.",
"\n- filepath should be the location of",
" BioLincc MESA data on your device."
)
}
}
}
)
In general,
OpenLongData
objects require a filepath to be created, if the user wants to use real data. For ABC, the files are not taken from Biolincc, and there is an intermediate step where users are expected to run a SAS macro on the data to create the appropriate file directory.The validator function for OpenLongABC objects should account for this, and should throw errors that tell users to run the SAS macro if needed.
Code to modify:
And here is an example showing one possible error that will be thrown if someone tries to create a MESA data object but they don't give a filepath that links to a directory that matches the structure of the Biolincc directory: