An error occurred while loading the file. Please try again.
-
Daniel Falster authored031fc187
#!/usr/bin/env Rscript
############################################# MERGE FRENCH DATA
path.formatted <- "output/formatted"
path.processed <- "output/processed"
library(plyr)
source("R/analysis/analysis-fun.R")
## load all sites
data <- load_all_formatted_data(path.formatted)
source("R/utils/plot.R")
source("R/utils/maps.R")
get_unique_plot_coords <- function(set, data){
i <- !duplicated(paste(data[[set]]$tree$Lon, data[[set]]$tree$Lat)) #find duplicates
data.frame(set = set, Lon = data[[set]]$tree$Lon[i], Lat = data[[set]]$tree$Lat[i], ecocode = data[[set]]$tree$ecocode[i], stringsAsFactors=FALSE)
}
x <- rbind.fill(lapply(names(data), get_unique_plot_coords, data=data))
write.csv(x, file.path(path.processed, "all.sites.coords.csv"), row.names=FALSE,quote=FALSE)
# Map for all sites
to.dev(world.map.all.sites(x, add.legend =TRUE),
png,file=file.path(path.processed, "world_map_all.png"), height =2000, width = 2000)
# make summary table
data.summary <- lapply(data, summarise.data)
tab.1 <- rbind.fill(lapply(data.summary,summary.table.1))
write.csv(tab.1, file.path(path.processed, "summary_tab.csv"), row.names = names(data.summary))