The 'get_ausplots' function in the 'ausplotsR' package extracts and compiles AusPlots data. Up to 8 different types of data can be obtained by setting the corresponding function arguments to TRUE/FALSE (i.e. 'site_info', 'structural_summaries', 'veg.vouchers', 'veg.PI', 'basal.wedge', 'soil_subsites', 'soil_bulk_density', and 'soil_character'). AusPlots data are extracted in to a list containing data frames, one data frame for data type requested. Other functions in the 'ausplotsR' can be used to pre-process the AusPlots raw data, preparing it for exploration, visualisation, and/or analysis (i.e. 'species_table', 'fractional_cover', 'growth_form_table', 'single_cover_value', and 'basal_area' functions). Each of these pre-processing functions returns data stored in a data frame.
Often we want to store the AusPlots data that we have extracted and/or created (e.g. via pre-processing and enriching the data frame with additional data) for future work. The advantages in doing so include:
- Saving time: Loading AusPlots data from a file is typically much faster that extracting it live with the function 'get_ausplots' (and even faster that extracting it and pre-processing it).
- Reproducibility: Extraction of AusPlots data is live, so it is possible that the data obtained between identical (i.e. with the same arguments) requests differ. Storing the data that we have used in our manipulations/visualisations/analyses in files allows reproducibility and seamless continuity of work.
- Portability: The data frames saves into files can be open by other software (e.g. spreadsheets packages, statistical packages,….).
To store data contained in data frames we can used the functions 'write.table', 'write.csv', and 'write.csv2' in the 'utils' package (included in the R installation). See the functions help page for further details (i.e. ‘? write.table’).
- 'write.table': Prints an R object, preferably a matrix or data frame, to a file or connection (“generalized files”, such as possibly compressed files, URLs, pipes, etc.). It allows great flexibility in the way the object it stored in the file via the function arguments.
- 'write.csv': Wrapper for writing ‘CSV’ files in the format used in most countries (uses “.” for the decimal point and “,” as separator). Specifically, it sets the 'write.table' arguments to ‘sep=”,”’, ‘dec=”.”’, ‘qmethod = "double"’, and ‘col.names = NA’ if ‘row.names = TRUE’ (the default) and to ‘TRUE’ otherwise.
- 'write.csv2': Wrapper for writing ‘CSV’ files in the format used in some Wester European locales (uses “,” for the decimal point and “.” as separator). Specifically, it sets the 'write.table' arguments to ‘sep=”.”’, ‘dec=”,”’, ‘qmethod = "double"’, and ‘col.names = NA’ if ‘row.names = TRUE’ (the default) and to ‘TRUE’ otherwise.
List are generic vectors containing other objects. They typically contain rugged data (i.e. data not in ‘rectangular’ form such as data contained in a matrix or data frame). This makes them unsuitable to be stored in a file using 'write.table' and its derivative functions. We can save lists (or other R objects) to a 'RData' file using the 'save' function in the 'base' package (included in the R installation). 'RData' files are specific to R and can store multiple R objects into a single file. The list can then be read back into R from the file by using the functions 'load' or 'attach' (or 'data' in some cases). See the functions help page for further details (i.e. ‘? save’, ‘? load’, and ‘? attach’).
Examples of how to save AusPlots data into files are presented below. Examples include saving data frames using the functions 'write.table' and 'write.csv', as well as saving list using the function 'save'.
Example 1: Save an AusPlots retrived Data Frame, using 'write.table'
Example 2: Save an AusPlots derived Data Frame (generated for pre-processing), using 'write.csv'
Example 3: Save an AusPlots retrived list, using 'save'