The data frame storage works as a cache area where data frames are temporary stored.
Several functions can add one or multiple data frames to the dataquieR data frame storage area:
prep_load_workbook_like_file()
, add to the storage
area all the spreadsheets of an Excel workbook files (i.e., multiple
data frames);
prep_load_folder_with_metadata()
, add to the storage
area all the metadata files and the study data files that are inside one
folder;
prep_add_data_frames()
, add one data frame to the
storage area.
In addition, whenever prep_get_data_frame()
fetches a
single data frame this is also added to the data frame storage.
The following functions can be used to see or modify the content of this storage area:
prep_list_dataframes()
, to obtain the content of
this storage area, that is not visible in the Global
Environment;
prep_get_data_frame()
, to get a data frame from the
dataquieR data frame storage area and have it available in the Global
Environment;
prep_purge_data_frame_cache()
, to delete everything
from this storage area;
prep_remove_from_cache()
, to delete only one
specific data frame from this storage area.
When a table is available in the dataquieR storage area, it can be directly used in a dataquieR function by its name.
Example:
library (dataquieR)
# Import the dataquier metadata example for the synthetic data
prep_load_workbook_like_file("meta_data_v2")
# Look at the content of the dataquieR data frame storage area
prep_list_dataframes()
## [1] "cross-item_level" "dataframe_level"
## [3] "expected_id" "item_level"
## [5] "meta_data_v2.xlsx|cross-item_level" "meta_data_v2.xlsx|dataframe_level"
## [7] "meta_data_v2.xlsx|expected_id" "meta_data_v2.xlsx|item_level"
## [9] "meta_data_v2.xlsx|missing_table" "meta_data_v2.xlsx|segment_level"
## [11] "meta_data_v2|cross-item_level" "meta_data_v2|dataframe_level"
## [13] "meta_data_v2|expected_id" "meta_data_v2|item_level"
## [15] "meta_data_v2|missing_table" "meta_data_v2|segment_level"
## [17] "missing_table" "segment_level"
Now you can just use “item_level” in the meta_data
argument to check for data type mismatches.
datatype_mismatch <- int_datatype_matrix(study_data = "study_data",
meta_data = "item_level")