diff --git a/R/format.function.R b/R/format.function.R index b77dfd2785827228ece1284b9ffef1165d6d3e42..1f5255e5228c89e2361730b5b033c935a100ed60 100644 --- a/R/format.function.R +++ b/R/format.function.R @@ -8,6 +8,19 @@ ###### ###### ## FUNCTION TO PLOT MAP OF TREE +##' .. Function to plot map of tree with circle function of their dbh.. +##' +##' .. content for \details{} .. +##' @title +##' @param plot.select the plot for which draw the map +##' @param x +##' @param y +##' @param plot vectore of plot id for each tree +##' @param D diameter in cm +##' @param inches controling the circle size +##' @param ... +##' @return +##' @author Kunstler fun.circles.plot <- function(plot.select,x,y,plot,D,inches,...){ x.t <- x[plot==plot.select] y.t <- y[plot==plot.select] @@ -108,8 +121,20 @@ print("columns removed") return( (data.merge)) } -#### function with X Y coordinates based on a neighborhood of radius R - +#### +##' .. function compute competition index with X Y coordinates based on a neighborhood of radius R .. +##' +##' .. content for \details{} .. +##' @title +##' @param obs.id id of the observation (if one tree as multiple growth measurement one obs.id per measurment +##' @param xy.table table with x.y of teh individual +##' @param diam diam in cm +##' @param sp species +##' @param Rlim radius of neighborhood search +##' @param parallel run in paralle or not ? +##' @param rpuDist run with GPU distance computation +##' @return a data frame with nrow = length of obs.id and ncol =unique(sp) +##' @author Kunstler BA.SP.FUN.XY <- function(obs.id,xy.table,diam,sp,Rlim,parallel=FALSE,rpuDist=FALSE){ rownames(xy.table) <- obs.id if(rpuDist){ diff --git a/merge.data.PARACOU.R b/merge.data.PARACOU.R index 0451855c4165429be2564d55bf8e356c729d3e5b..f614a4ce4ecd005f1440a8f0743b2b436387b491 100644 --- a/merge.data.PARACOU.R +++ b/merge.data.PARACOU.R @@ -1,12 +1,15 @@ ### MERGE paracou DATA ### Edited by FH -rm(list = ls()); source("./R/format.function.R"); library(reshape) +rm(list = ls()) +source("./R/format.function.R") +library(reshape) ######################### ## READ DATA #################### ### read individuals tree data -data.paracou <- read.table("./data/raw/DataParacou/20130717_paracou_1984_2012.csv",header=TRUE,stringsAsFactors=FALSE,sep = ";", na.strings = "NULL") +data.paracou <- read.table("./data/raw/DataParacou/20130717_paracou_1984_2012.csv", + header=TRUE,stringsAsFactors=FALSE,sep = ";", na.strings = "NULL") #barplot(apply(!is.na(data.paracou[,paste("circ_",1984:2012,sep="")]),MARGIN=2,FUN=sum),las=3) # select good columns @@ -16,9 +19,12 @@ data.paracou <- data.paracou[,c("foret","parcelle","carre","arbre","vernaculaire colnames(data.paracou) <- c("forest","plot","subplot","tree","vernacular","taxonid","x","y","circum2001","code2001","circum2005","code2005","circum2009","code2009","yeardied","typedeath") ### change numeric separator -for(k in 7:14) { - data.paracou[,k] <- gsub(",",".",data.paracou[,k]); data.paracou[,k] <- as.numeric(data.paracou[,k]) } ## Replace all , in decimals with . -data.paracou$treeid <- apply(data.paracou[,1:4],1,paste,collapse="."); ## Create a tree id +numeric.col.name <- c("x","y","circum2001","code2001","circum2005","code2005","circum2009","code2009") +for(k in numeric.col.name){ + data.paracou[,k] <- gsub(",",".",data.paracou[,k]); data.paracou[,k] <- as.numeric(data.paracou[,k]) + } ## Replace all , in decimals with . + +data.paracou$treeid <- apply(data.paracou[,c("plot","subplot","tree")],1,paste,collapse="."); ## Create a tree id data.paracou <- data.paracou[,c(ncol(data.paracou),1:(ncol(data.paracou)-1))] ## ## plot each plot diff --git a/merge.data.SWISS.R b/merge.data.SWISS.R index 5bbef522d2a789645da18ae4c7bd86d4a320fffb..96ce7cc91dde631f44ff9f225d5d3bf9035348d9 100644 --- a/merge.data.SWISS.R +++ b/merge.data.SWISS.R @@ -11,8 +11,12 @@ data.swiss2 <- read.csv("./data/raw/DataSwiss/LFI23.csv",header=TRUE,stringsAsFa data.swiss3 <- read.csv("./data/raw/DataSwiss/LFI34.csv",header=TRUE,stringsAsFactors =FALSE) data.swiss <- rbind(data.swiss1, data.swiss2, data.swiss3) rm(data.swiss1, data.swiss2, data.swiss3) -data.swiss <- data.swiss[order(data.swiss$BANR),]; data.swiss <- data.swiss[,c(2:19)] -colnames(data.swiss) <- c("Inventid","siteid","treeid","x","y","spcode","sp.name","year","dbh1","dbh2","ba1","ba2","ba_diff","dbh_diff","repfactor1","repfactor2","ht1","ht2") +data.swiss <- data.swiss[order(data.swiss$BANR),] +data.swiss <- data.swiss[,c("INVNR","CLNR","BANR","X","Y","BAUMART","TEXT","VEGPER", + "BHD1","BHD2","BA1","BA2","BAI","BHD_DIFF","RPSTZ1","RPSTZ2","HOEHE1","HOEHE2")] + +colnames(data.swiss) <- c("Inventid","siteid","treeid","x","y","spcode","sp.name","year", + "dbh1","dbh2","ba1","ba2","ba_diff","dbh_diff","repfactor1","repfactor2","ht1","ht2") ## Do not need to read in spp list as it is already available in data.swiss @@ -42,7 +46,7 @@ data.swiss$htot <- data.swiss$ht1 ## height of tree in m ## ECOREGION ################### ## Ecoregion not available for swiss data - +data.swiss$ecocode <- rep("A",nrow(data.swiss)) ###################### ## PERCENT DEAD ################### diff --git a/ms/table.data.progress.ods b/ms/table.data.progress.ods index 68bea2a36535ac1b09a0092518bfdb1e7801c0a7..45ad7a04fb61990b230d2d804cdfdd98e5175b1e 100644 Binary files a/ms/table.data.progress.ods and b/ms/table.data.progress.ods differ