首页 > 解决方案 > Worldclim:R中的getData()(纬度/经度坐标):utils :: unzip(zipfile,exdir = dirname(zipfile))中的错误:'exdir'不存在

问题描述

使用 getData() 在 .csv 文件中上传经度和纬度坐标:

很抱歉提出这样一个基本问题,但我是 R 新手,我无法使用函数 getData() 上传包含纬度和经度坐标的 .csv 文件。这个想法是在worldlcim中上传数据。

我使用的代码是:

bioclim.data <- getData(name = "worldclim",
                    var = "bio",
                    res = 2.5,
                    path "~/Documents/TerneyProposal/UpalPublishedPapers/Blue_Whale_Paper/Data_Blue_Whale_Project/Blue_Whale_GPS_CSV.csv")enter code here

但是,我不断收到此错误消息:

trying URL 'https://biogeo.ucdavis.edu/data/climate/worldclim/1_4/grid/cur/bio_2-5m_bil.zip'
Content type 'application/zip' length 129319755 bytes (123.3 MB)
==================================================
downloaded 123.3 MB


 Could not download file -- perhaps it does not exist
Error in utils::unzip(zipfile, exdir = dirname(zipfile)) : 
 'exdir' does not exist

我不明白这个消息,因为我的 .csv 文件不在 zip 文件中,而且当我使用函数 read.csv("data") 时,这个文件也很容易打开

非常亲切的问候,如果有人可以请建议?

提前谢谢了!

标签: rdirectorylatitude-longituderaster

解决方案


欢迎来到社区!这些类型的错误有点误导......我认为主要问题可能是您的文件不在它期望的文件夹中。跑:

getwd()

看看工作文件夹是什么......就是它所期望的文件。将文件移动到该文件夹​​中,或者您可以将会话的工作目录更改为文件所在的文件夹,方法是:

setwd("pathToYourFile")

如果您在 Windows 上,请记住将那些讨厌的更改\/.

试试看!


推荐阅读