Reputation: 161
Hi i have multiple gpx files stored in a folder and i wish to read all of then in one go using R's SF package and put it under different names.
I tried this code : just like how its explained in most of the tutorials for .CSV files
setwd("C:\\Documents")
mydir = "feb 19 - Copy"
myfiles = list.files(path=mydir, pattern="\\.gpx", full.names=TRUE)
myfiles
The result i got is: character(0)
For the explanation purpose, the gpx traces can be freely downloaded from https://www.openstreetmap.org/traces and can be stored in a file and then explained
Please Help. Thanks in advance.
Upvotes: 1
Views: 983
Reputation: 161
The problem is solved. The mistake lies in the path of the directory as explained in the comment by Nicolas Velasquez. Checking for the problem using
setwd("C:\\Documents")
list.dirs()
and then verifying whether the folder is there or not. Through that code I identified that the directory is "./gps/feb 19 - Copy" and not just "feb 19 - Copy". So my new code is
mydir = "./gps/feb 19 - Copy"
And then reading the files using the following code chunk
myfiles = list.files(path=mydir, pattern=".+\\.gpx", full.names=TRUE)
myfiles
Upvotes: 1