Commit 64c0e8b9 authored by fhui28's avatar fhui28
Browse files

bringing in traits to BCI R script

No related merge requests found
Showing with 8 additions and 5 deletions
+8 -5
......@@ -21,7 +21,7 @@ for(k in 2:7) {
sort = T, by = "TreeID") }
data.bci1 <- data.bci2
cat("Census", k, "now included\n") }
rm(data.bci1, data.bci2, data.bci3, sub.bci)
rm(data.bci1, data.bci2, sub.bci)
big.bci <- big.bci[order(big.bci$TreeID),]; colnames(big.bci)[c(7:8)] <- c("DBH1","Date1")
data.bci <- big.bci; rm(big.bci)
......@@ -39,8 +39,12 @@ length(unique(data.bci$sp))
######################################
## MASSAGE TRAIT DATA
############################
## THERE ARE HEIGHT VARAIBLES IN THE TRAITS DATA, BUT WE WILL NEED TO DISCUSS WHICH ONES TO USE
## Use HEIGHT_AVG, LMALAM_AVD, SEED_DRY, BUT I DO NOT KNOW WHICH WOOD DENSITY VARIABLE TO USE
data.trait <- read.csv("./data/raw/DataBCI/BCITRAITS_20101220.csv",stringsAsFactors=FALSE, header = T)
data.trait$Latin <- apply(data.trait[,1:2], 1, paste, collapse = " ")
data.bci <- merge(data.bci, data.trait[,c(ncol(data.trait),3,7:10,13,15,18,20:21)], by = "Latin", all.x = T)
data.bci <- data.bci[order(data.bci$TreeID),]
##########################################
## FORMAT INDIVIDUAL TREE DATA
#############
......@@ -53,13 +57,13 @@ data.bci$year <- as.numeric(difftime(data.bci$Date2, data.bci$Date1, units = "we
data.bci$G <- 10*(data.bci$DBH1-data.bci$DBH1)/data.bci$year ## diameter growth in mm per year - BASED ON UNROUNDED YEARS
data.bci$D <- data.bci[["DBH1"]];
data.bci$plot <- data.bci[["Quadrat"]] ## plot code?
data.bci$htot <- rep(NA,length(data.bci[["G"]])) ## DOES IT COME FROM THE TRAITS DATA?
data.bci$htot <- data.bci$HEIGHT_AVG
data.bci$sp.name <- data.bci$Latin
######################
## ECOREGION
###################
## bci has only 1 eco-region?
## bci has only 1 eco-region
######################
## PERCENT DEAD
......@@ -76,7 +80,6 @@ data.bci <- merge(data.bci,data.frame(plot=names(perc.dead),perc.dead=perc.dead)
###################
## Remove data with dead == 1
table(data.bci$dead)
## Nothing to remove
vec.abio.var.names <- c("MAT","MAP") ## MISSING
vec.basic.var <- c("treeid","sp","sp.name","plot","D","G","dead","year","htot","x","y","perc.dead")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment