r - Downloading data via ftp to use in shinyapp causes readRDS unknown input format error -
i having trouble downloading data external ftp-source use in shinyapp. http://shinyapps.io not allow writing file on server, must avoid , try saving externally ftp , later read directly memory there.
see wes sauder @ https://stackoverflow.com/a/32631356/3493503 got started.
library(rcurl) <- "test" saverds(a, file="data.rdata") data_path <- my_data_path url <- my_ftp_url ftpupload(data_path, to=url, connecttimeout=120) #upload bin = getbinaryurl(url, verbose = true, ftp.use.epsv = true) readrds(rawconnection(bin))
uploading works fine, can download file filezilla afterwards , read readrds. however, trying download in r above code not work:
> library(rcurl) > <- "test" > saverds(a, file="data.rdata") > data_path <- "**************" > url <-"ftp://******************/results.rdata" > ftpupload(data_path, to=url, connecttimeout=120) #upload ok 0 > bin = getbinaryurl(url, verbose = true, + ftp.use.epsv = true) * trying ***.***.***.***... * connected ******************** port 21 (#0) < 220---------- welcome pure-ftpd [privsep] [tls] ---------- < 220-you user number 9 of 50 allowed. < 220-local time 10:43. server port: 21. < 220-this private system - no anonymous login < 220-ipv6 connections welcome on server. < 220 disconnected after 15 minutes of inactivity. > user ******** < 331 user ******** ok. password required > pass ******** < 230 ok. current restricted directory / > pwd < 257 "/" current location * entry path '/' > epsv * connect data stream passively * ftp_perform ends secondary: 0 < 229 extended passive mode ok (|||31331|) * trying ********... * connecting ******** port 31331 * connected ******** port 21 (#0) > type < 200 type 8-bit binary > size results.rdata < 213 50 > retr results.rdata < 150 accepted data connection * maxdownload = -1 * getting file size: 50 * remembering in dir "" < 226-file transferred < 226 0.000 seconds (measured here), 0.66 mbytes per second * connection #0 host ******** left intact > readrds(rawconnection(bin)) error in readrds(rawconnection(bin)) : unknown input format
for matter of completeness, tried
load(rawconnection(bin)) error in load(rawconnection(bin)) : input not start magic number compatible loading connection source(rawconnection(bin)) error in source(rawconnection(bin)) : rawconnection(bin):1:1: unexpected input 1: ^
any solution/explanation/input appreciated.
i uploaded file via filezilla containing rds-object http://webkartet.no/data.rdata try. causes same error.
note: tried follow in comment-section of wes sauders answer, not able so, apparently due lack of se-points. tried find solutions on without success.
other information
platform x86_64-w64-mingw32
arch x86_64
os mingw32
system x86_64, mingw32
status
major 3
minor 3.1
year 2016
month 06
day 21
svn rev 70800
language r
version.string r version 3.3.1 (2016-06-21) nickname bug in hairusing windows 7
Comments
Post a Comment