five

Data from: Drivers of plant traits that allow survival in wetlands

收藏
Mendeley Data2024-06-25 更新2024-06-28 收录
下载链接:
https://datadryad.org/stash/dataset/doi:10.5061/dryad.7h44j0zqx
下载链接
链接失效反馈
官方服务:
资源简介:
###Setup### ###installing of glwdr package### devtools::install_github("jsta/glwdr") ############################ library(glwdr) library(raster) library(vegan) ###extract BioClim at the resolution=2.5 wc_bio2.5 <- getData("worldclim", var="bio", res=2.5) ###turning the raster file into spatial points wc2.5<- rasterToPoints(wc_bio2.5, spatial=FALSE) ###omit the NA points wc2.5na=na.omit(as.data.frame(wc2.5)) ###using vegan package to do the PCA pcaBio2.5=rda(wc2.5na[,-c(1,2)],scale = T) ###plot the result biplot(pcaBio2.5,display = "sp") biplot(pcaBio2.5,display = "si") PCAsites2.5=scores(pcaBio2.5, choices = 1:2, display = "si") PCA19va=scores(pcaBio2.5, choices = 1:2, display = "species") PCA_results2.5=cbind(wc2.5na[,1:2],PCAsites2.5)###combine results with x-y coordinates ########################rasterize the PCA result, with each cell=2.5 minutes r <- raster(ncols=2160, nrows=900) n <-1944000 r2_pca1 <- rasterize(PCA_results2.5[, 1:2], r, PCA_results2.5[, 3], fun=mean) r2_pca2 <- rasterize(PCA_results2.5[, 1:2], r, PCA_results2.5[, 4], fun=mean) DB_cor=read.csv("database_coordinates.csv",sep=",")###read the coordinates of wetland trait database DB_PCA1_2.5=extract(r2_pca1,DB_cor)###match the PCA result to corresponding DB coordinates DB_PCA2_2.5=extract(r2_pca2,DB_cor) DB_PCA_2.5=cbind(DB_PCA1_2.5,DB_PCA2_2.5)###produce the data sheet contains PCA1 & PCA2 write.csv(DB_PCA_2.5,"DB2.5_PCA1&PCA2 Results.csv")###save the result
创建时间:
2023-06-28
二维码
社区交流群
二维码
科研交流群
商业服务