knitr::opts_chunk$set(echo = FALSE,message=FALSE,warning=FALSE,
                      fig.width = 8,fig.height=8)

# Correlation matrix to look at Pli data

library(tidyverse)


# library(dplR)6. 
# library(corrplot)
# source("http://www.sthda.com/upload/rquery_cormat.r")

load("~/Documents/Git/pliDrought2019/data/pliDat.RData")

Description of ring dataset

The dataset of Pli ring data contains the following columns:

  1. Opening: Stand ID
  2. coreID: unique coreID for each core taken within an Opening
  3. Plot: Plot number
  4. Tree.Num: Tree number within the plot. Dead trees are labelled "1" and live trees are labelled "2".
  5. Year
  6. Type: ew = annual earlywood (mm), lw = annual latewood width (mm), rw = annual ring width (mm), mnd = minimum density of the annual ring (g/cm3), mxd = maximum density of the annual ring (gm/cm3), rwd = average density of the annual ring (g/cm3)
  7. Value: annual value
# Correlation matrix
x<-
  pliDat$ringData %>% 
  filter(Type=="lw") %>% 
  filter(Tree.Num==2) %>% # filter for live trees
  mutate(coreID=paste(Opening,coreID,sep="-")) %>% 
  dplyr::select(coreID,Year,Value) %>% 
  pivot_wider(names_from=coreID,values_from=Value) %>% 
  filter(Year>=1990) %>% 
  column_to_rownames("Year") 
  # detrend(method="Spline")
plotAdjTrees<-function(site,ringVar="rw") {

  # come up with list to remove trees that lack a pair
  plotList<-
    pliDat$ringData %>% 
    filter(Opening==site) %>% 
    filter(Type==ringVar) %>% 

    group_by(Plot) %>% 
    distinct(Tree.Num) %>% 
    group_by(Plot) %>% 
    summarise(Num.Trees=n()) %>% 
    filter(Num.Trees==2) %>% 
    pull(Plot)



    pliDat$ringData %>% 
    filter(Opening==site) %>% 
    filter(Type==ringVar) %>% 
    filter(Plot %in% plotList) %>% 


    mutate(Plot=paste("Plot",":",Plot,sep="")) %>% 
    mutate(Tree.Num=fct_recode(Tree.Num,Dead="1",Live="2")) %>% 
      rename(Tree=Tree.Num) %>% 
      filter(Year>=2000) %>% 

    ggplot()+
    aes(x=Year,y=Value,color=Tree,group=Tree)+
    geom_point()+
    geom_line()+
    facet_wrap(~Plot,ncol=2)+
      theme(legend.position="bottom",
            axis.text.x = element_text(angle = 270, vjust = 0.5, hjust=1))+

  scale_x_continuous(limits=c(2000,2018),breaks=seq(from=2000,to=2018,by=2),
                     # minor_breaks = seq(from=2000,to=2018,by=2),
                     name="Year")

}

Opening:

Let's compare annual variables between paired trees in Site r site2="264";site2.

plotAdjTrees(site=site2,ringVar="rw")+
  ylab("Annual ring width (mm)")

\newpage

plotAdjTrees(site="264",ringVar="rwd")+
  ylab("Mean ring density (g/cm3)")

ISSUES

  1. The UNBC lab tech simply assigned the year 2018 to the outermost ring of each dead tree. However, we do not know the true year the tree died. In order to determine the year of death for dead trees, I had originally planned to crossdate the trees using visual and statistical crossdating methods. However, this is proving to be difficult.


hgriesbauer/pliDrought2019 documentation built on Jan. 29, 2021, 6:51 p.m.