Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


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.

...

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'.

Boxes with grey background contain code snippets, and boxes with white background containt code (text) outputs.

...

Div
stylebackground-color: #F8F9F9; border: 1px solid #666; font-size: 12px; padding: 0.5rem 0.5rem;
# ====================
# Saving AusPlots data
# ====================

# Provide Path for Directory where data will be stored
file.path = "C:/Users/uqbblanc/Documents/TERN/CWDir_TutBasicAusPlots"

# Extract Date and Create a String to Represent it. To be used as Part of the File Name
today = toString(Sys.Date())
today

...

Div
stylebackground-color: #F8F9F9; border: 1px solid #666; font-size: 12px; padding: 0.5rem 0.5rem;
date.s = paste(substr(today,start=3,stop=4),substr(today,start=6,stop=7), 
               substr(today,start=9,stop=10),sep="") 
date.s


Div
stylebackground-color: white; border: 1px solid #666; font-size: 12px; padding: 0.5rem 0.5rem;
## [1] "190625"

...

Div
stylebackground-color: #F8F9F9; border: 1px solid #666; font-size: 12px; padding: 0.5rem 0.5rem;
# Load 'auplotsR' library and Extract some AusPlots data
library(ausplotsR)
AP.data.l = get_ausplots( my.Plot_IDs=c("SATFLB0004", "QDAMGD0022", "NTASTU0002"), 
                          structural_summaries=TRUE, basal.wedge=TRUE)


Div
stylebackground-color: white; border: 1px solid #666; font-size: 12px; padding: 0.5rem 0.5rem;
## User-supplied Plot_IDs located.

...

Div
stylebackground-color: #F8F9F9; border: 1px solid #666; font-size: 12px; padding: 0.5rem 0.5rem;
# Save an AusPlots retrived Data Frame, using 'write.table'
# =========================================================

# Visualise summary of the retrived Raw Basal Wedge data
summary(AP.data.l$veg.basal)

...

Div
stylebackground-color: #F8F9F9; border: 1px solid #666; font-size: 12px; padding: 0.5rem 0.5rem;
# Create Name of the file to be stored (including the date)
file.name = paste("AP_3Sites_BasalWedge",date.s,sep="_")
file.name


Div
stylebackground-color: white; border: 1px solid #666; font-size: 12px; padding: 0.5rem 0.5rem;
## [1] "AP_3Sites_BasalWedge_190625"

...

Div
stylebackground-color: #F8F9F9; border: 1px solid #666; font-size: 12px; padding: 0.5rem 0.5rem;
# Add the "txt" extension
file.name = paste(file.name,"txt",sep=".")
file.name


Div
stylebackground-color: white; border: 1px solid #666; font-size: 12px; padding: 0.5rem 0.5rem;
## [1] "AP_3Sites_BasalWedge_190625.txt"

...

Div
stylebackground-color: #F8F9F9; border: 1px solid #666; font-size: 12px; padding: 0.5rem 0.5rem;
# Save the Raw Basal Wedge data to a Text File with columns separated by tabs
write.table(AP.data.l$veg.basal, paste(file.path, file.name, sep="/"), sep="\t")



Example 2: Save an AusPlots derived Data Frame (generated for pre-processing), using 'write.csv'

...

Div
stylebackground-color: #F8F9F9; border: 1px solid #666; font-size: 12px; padding: 0.5rem 0.5rem;
# Save an AusPlots derived Data Frame (generated for pre-processing), using 'write.csv'
# =====================================================================================

# Compute Basal Area from Raw Basal Wedge data
AP.3Sites.BAperPlot = basal_area(AP.data.l$veg.basal, by.spp=FALSE, by.hits=FALSE)

# Visualise summary of the retrived Basal Area data
summary(AP.3Sites.BAperPlot)

...

Div
stylebackground-color: #F8F9F9; border: 1px solid #666; font-size: 12px; padding: 0.5rem 0.5rem;
# Create Name of the file to be stored (including the date)
file.name = paste("AP_3Sites_BasalArea",date.s,sep="_")
file.name


Div
stylebackground-color: white; border: 1px solid #666; font-size: 12px; padding: 0.5rem 0.5rem;
## [1] "AP_3Sites_BasalArea_190625"

...

Div
stylebackground-color: #F8F9F9; border: 1px solid #666; font-size: 12px; padding: 0.5rem 0.5rem;
# Add the "txt" extension
file.name = paste(file.name,"csv",sep=".")
file.name


Div
stylebackground-color: white; border: 1px solid #666; font-size: 12px; padding: 0.5rem 0.5rem;
## [1] "AP_3Sites_BasalArea_190625.csv"

...

Div
stylebackground-color: #F8F9F9; border: 1px solid #666; font-size: 12px; padding: 0.5rem 0.5rem;
# Save the Basal Area data to a Text File with columns separated by tabs
write.csv(AP.3Sites.BAperPlot, paste(file.path, file.name, sep="/"))



Example 3: Save an AusPlots retrived list, using 'save'

...

Div
stylebackground-color: #F8F9F9; border: 1px solid #666; font-size: 12px; padding: 0.5rem 0.5rem;
# Save an AusPlots retrived list, using 'save'
# ============================================

# Visualise the Data Frames included in the retrived list containing AusPlots data
names(AP.data.l)


Div
stylebackground-color: white; border: 1px solid #666; font-size: 12px; padding: 0.5rem 0.5rem;
## [1] "site.info"   "struct.summ" "veg.basal"   "veg.vouch"   "veg.PI"     
## [6] "citation

...

Div
stylebackground-color: #F8F9F9; border: 1px solid #666; font-size: 12px; padding: 0.5rem 0.5rem;
# Create Name of the file to be stored (including the date)
file.name = paste("AP_3Sites_SiteVegInfo",date.s,sep="_")
file.name


Div
stylebackground-color: white; border: 1px solid #666; font-size: 12px; padding: 0.5rem 0.5rem;
## [1] "AP_3Sites_SiteVegInfo_190625"

...

Div
stylebackground-color: #F8F9F9; border: 1px solid #666; font-size: 12px; padding: 0.5rem 0.5rem;
# Add the "txt" extension
file.name = paste(file.name,"RData",sep=".")
file.name


Div
stylebackground-color: white; border: 1px solid #666; font-size: 12px; padding: 0.5rem 0.5rem;
## [1] "AP_3Sites_SiteVegInfo_190625.RData"

...

Div
stylebackground-color: #F8F9F9; border: 1px solid #666; font-size: 12px; padding: 0.5rem 0.5rem;
# Save the list containing all retrived AusPlots data
save(AP.data.l, file=paste(file.path, file.name, sep="/"))
#load(file=paste(file.path, file.name, sep="/"))