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.

...

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



Preparation

.

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: white; border: 1px solid #666; font-size: 12px; padding: 0.5rem 0.5rem;
## [1] "2019-06-25"

.

.

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.

.

.

.

Example 1: Save an AusPlots retrived Data Frame, using 'write.table'

.

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: white; border: 1px solid #666; font-size: 12px; padding: 0.5rem 0.5rem;
##  site_location_name site_location_visit_id site_location_id
##  Length:95          Min.   :53705          Min.   :60122   
##  Class :character   1st Qu.:58429          1st Qu.:60122   
##  Mode  :character   Median :58429          Median :61138   
##                     Mean   :57395          Mean   :60635   
##                     3rd Qu.:58658          3rd Qu.:61138   
##                     Max.   :58658          Max.   :61138   
##    point_id         herbarium_determination veg_barcode       
##  Length:95          Length:95               Length:95         
##  Class :character   Class :character        Class :character  
##  Mode  :character   Mode  :character        Mode  :character  
##                                                               
##                                                               
##                                                               
##       hits        basal_area_factor   basal_area     site_unique       
##  Min.   : 1.000   Min.   :-1.0000   Min.   :-1.000   Length:95         
##  1st Qu.: 2.000   1st Qu.: 0.1000   1st Qu.: 0.300   Class :character  
##  Median : 5.000   Median : 0.1000   Median : 0.900   Mode  :character  
##  Mean   : 5.979   Mean   : 0.2495   Mean   : 1.885                     
##  3rd Qu.: 8.500   3rd Qu.: 0.5000   3rd Qu.: 2.875                     
##  Max.   :20.000   Max.   : 2.0000   Max.   :14.000

.

.

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: white; border: 1px solid #666; font-size: 12px; padding: 0.5rem 0.5rem;
##  site_unique        basal_area_m2_ha
##  Length:3           Min.   :3.994   
##  Class :character   1st Qu.:5.947   
##  Mode  :character   Median :7.900   
##                     Mean   :6.631   
##                     3rd Qu.:7.950   
##                     Max.   :8.000

.

.

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="/"))

.

.

.