1
votes

Uploading longitude and latitude coordinates in a .csv file using getData():

I am sorry for asking such a basic question but I am new to R, and I am having trouble uploading my .csv file containing latitude and longitude coordinates using the function getData(). The idea is to upload the data in worldlcim.

The code I used was:

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

However, I keep on getting this error message:

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

I don't understand this message because my .csv file is not in a zip file, and this file also opens easily when I use the function read.csv("data")

Very kind regards if anyone could please kindly advise?

Many thanks in advance!

1

1 Answers

0
votes

Welcome to the community! These kinds of errors are a bit misleading... I think the main issue is probably that your file is not in the folder it expects. Run:

getwd()

to see what the working folder is... that is where it's expecting the file. Either move the file into that folder, or you can change your session's working directory to the folder where the file is, by writing:

setwd("pathToYourFile")

If you're on windows, remember to change those pesky \ to /.

Give it a try!