Download .RData and .csv files from FTP using RCurl (or any other method)
You can try breaking it into two steps: first download the file, then load it.
download.file(downloadURL, "temp.rData")
load("temp.rData")
or sticking with rCurl you can try:
bin = getBinaryURL(downloadURL, ...yourOtherParams...)
writeBin(bin, "temp.rData")
load("temp.rData")
Download or Connect csv data from FTP wiht R
For the case of a sftp-server I use 'getURL' function from RCurl package
For your input, and an sfpt-server, the first call would download the file.
Maybe its similar for a regular ftp-connection(second call)?
# sftp
RCurl::getURL(url = "sftp://user123:Test123@example.com/my_file/example.csv")
# maybe works for a ftp connection
RCurl::getURL(url = "ftp://user123:Test123@example.com/my_file/example.csv")
hope it helps :)
Loading ftp directly to R dataframe - how to see the original text?
I found a solution, which is very simple, but works nonetheless:
library(data.table)
r <- fread("ftp://ftp.ais.dk/ais_data/aisdk_20141001.csv")
This blog was helpfull
downloading files from the secure ftp server with R
It sounds like the question is "how do I avoid timeouts in rcurl?"
Increase the value of CURLOPT_CONNECTTIMEOUT. This is really just the same problem as Setting Curl's Timeout in PHP .
Edit, from comments below:
x<-getURL(url, userpwd="<id>:<passwd>", connecttimeout=60) // 60 seconds, e.g.
Download zipped files from ftp via RCurl
Here is my solution:
library(RCurl)
url<- "ftp://adress/"
filenames <- getURL(url, userpwd="USER:PASSWORD", ftp.use.epsv = FALSE, dirlistonly = TRUE) #reading filenames from ftp-server
destnames <- filenames <- strsplit(filenames, "\r*\n")[[1]] # destfiles = origin file names
con <- getCurlHandle( ftp.use.epsv = FALSE, userpwd="USER:PASSWORD")
mapply(function(x,y) writeBin(getBinaryURL(x, curl = con, dirlistonly = FALSE), y), x = filenames, y = paste("C:\\temp\\",destnames, sep = "")) #writing all zipped files in one directory
Hopefully for anybody it's usefull!
Regards,
Florian
How to read RData file with R
This worked for me:
load(url("https://github.com/tvganesh/yorkrData/raw/master/IPL/IPL-T20-matches/Chennai%20Super%20Kings-Deccan%20Chargers-2008-05-06.RData"))
I get a dataframe overs
from the RData-file.
The url is taken from the Download-button of the github-page to get the raw file.
Related Topics
Subsetting Data Based on Dynamic Column Names
How to Read Column Names 'As Is' from CSV File
How to Log Transform the Y-Axis of R Geom_Histogram in the Right Direction
Generating a Date from a String with a 'Month-Year' Format
How to Add a Legend for the Secondary Axis Ggplot
How to Pass Multiple Group_By Arguments and a Dynamic Variable Argument to a Dplyr Function
R Shiny - Checkboxes and Action Button Combination Issue
How to Create a Dropdown List in a Shiny Table Using Datatable When Editing the Table
Why Isn't the R Function Sink() Writing a Summary Output to My Results File
Changing Line Color in Ggplot Based on Slope
In R Data.Frame, Promote Rownames to Actual Column
Install R Packages in Azure Ml
Uri Routing for Shinydashboard Using Shiny.Router
Combining Grid.Table and Base Package Plots in R Figure
Why Are Probabilities and Response in Ksvm in R Not Consistent