R语言里做生态位分化分析(1)背景知识查询

使用到的R包是 ENMtools,这个R包对应的github主页是
https://github.com/danlwarren/ENMTools
发现ggtree的作者Y叔也关注了这个R包的作者的github。那这个作者也是个大佬无疑了。
这个R包对应的论文
ENMTools 1.0: an R package for comparative ecological biogeography

https://nsojournals.onlinelibrary.wiley.com/doi/full/10.1111/ecog.05485
这个作者还有youtube账号专门介绍这个R包
https://www.youtube.com/@danlwarren
这个作者的github主页还有专门的一个仓库作为这个R包的教程
https://github.com/danlwarren/ENMTools-Tutorials
做生态位分化分析需要用到的函数是identity.test(),两个物种的经纬度,还有一个环境数据
这个R包对应的主页的文档里获取环境数据用到的是 geodata 这个R包
geodata对应的github主页
https://github.com/rspatial/geodata
这个R包里有世界气候数据( glocal climate data WorldClim)
这些数据对应的网站
https://worldclim.org/data/worldclim21.html
关于数据的基本介绍
This is WorldClim version 2.1 climate data for 1970-2000. This version was released in January 2020. There are monthly climate data for minimum, mean, and maximum temperature, precipitation, solar radiation, wind speed, water vapor pressure, and for total precipitation. There are also 19 “bioclimatic” variables.
这里的数据单位是 10 minutes 30 seconds。我开始以为是时间上的单位,查了一下原来是 地理上的单位,一个位置的经纬度 是度 分 秒

image.png
19个 bioclimatic 数据
https://worldclim.org/data/bioclim.html

image.png
还有海拔数据
这些数据可以直接使用R语言的命令来下载
比如下载 19个 bioclimatic

install.packages(“ENMTools”)

library(ENMTools)

remotes::install_github(“rspatial/geodata”)

library(geodata)
library(terra)
env <- worldclim_global(var=’bio’, res=10, path = “./”)
这个env 是一个SpatRaster对象,这里有19个数据
可以直接用plot画图展示
plot(env[[1]])

image.png
还可以对这个数据进行裁剪,只展示特定的范围的数据
env01.crop <- crop(env[[1]], extent(-10, 17, 39, 48))

plot(env01.crop)
这里 -10 17 是经度范围 39 48 是维度范围

image.png
这个数据可以转换成数据框用ggplot2去作图
terra::as.data.frame(env[[1]],xy=TRUE) -> env1.data

head(env1.data)
library(ggplot2)
ggplot(env1.data, aes(x = x, y = y, fill = wc2.1_10m_bio_1)) +
geom_raster() +
scale_fill_gradient(low = “white”, high = “blue”)

image.png
也可以单独下载某个国家的数据,用到的函数是 worldclim_country()
下载链接是 https://geodata.ucdavis.edu/climate/worldclim/
这里好想没有中国的bioclimatic数据
欢迎大家关注我的公众号
小明的数据分析笔记本

声明:文中观点不代表本站立场。本文传送门:https://eyangzhen.com/416899.html

(0)
联系我们
联系我们
分享本页
返回顶部