Reputation: 307
Want to download a csv-file from FTP-Server to R (it would be best to have the file as a dataframe in R).
Get an error-message when trying to download a csv-file from FTP-Server to R (which is local in my Mac).
url = "ftp://ftppath/www_logs/testfolder/"
download.file(URL,"test.csv", credentials = "xxx:yyyy")
Last query leads to:
Error in download.file(URL, "test.csv", credentials = "xxxyyy", :
unused arguments (credentials = "xxx:yyyy")
Upvotes: 3
Views: 8099
Reputation: 356
I think you get this error message because function download.file()
has no argument named credentials
.
I would try to pass the credentials as discussed here:
url = "ftp://username:password@ftppath/www_logs/testfolder/test.csv"
download.file(url, destfile = "test.csv")
If you want to load the file into an R data.frame, you could try something like this:
library(RCurl)
url <- "ftp://ftppath/www_logs/testfolder/test.csv"
text_data <- getURL(url, userpwd = "username:password", connecttimeout = 60)
df <- read.csv(text = text_data)
Upvotes: 7