################# ################ ### PROCESS THE DATA FOR NVS rm(list = ls()) source("process.fun.R") library(reshape) data.tree <- read.csv("../../output/formatted/NVS/tree.csv", stringsAsFactors = FALSE) data.tree <- subset(data.tree,subset=!is.na(data.tree[["D"]])) ## change sp data.traits <- read.csv("../../output/formatted/NVS/traits.csv") data.traits$sp <- paste("sp",data.traits$sp,sep=".") data.tree$sp <- paste("sp",data.tree$sp,sep=".") # vector of ecoregion name ecoregion.unique <- unique(data.tree[["ecocode"]]) #### lapply function system.time(lapply(ecoregion.unique, FUN = fun.data.per.ecoregion, data.tot = data.tree, weight.full.plot = NA, site.name = "NVS", data.TRAITS = data.traits))