Thank you for your reply Hadley. I updated my code as you suggest, using curl_fetch_memory
from curl
package, instead of getURL
from rCurl
, and now the script looks as follows:
library(curl)
library(shiny)
library(DT)
h <- new_handle(CONNECTTIMEOUT = 300)
handle_setopt(handle = h, httpauth = 1, userpwd = 'userlogin:password')
response <- curl::curl_fetch_memory("ftp://ftpupload.net/myfolder/mydata.txt", handle = h)
data <- rawToChar(resp$content) #Get raw data
data <- data.frame(x = strsplit(data , "\n", "", fixed = TRUE)[[1]]) #Separate in lines
data <- data %>% separate(x, "\t", into = c('Column A', 'Column B', 'Column C'), extra = "merge") #Separate in columns
data<- data[-1,] #Remove the first line
ui <- fluidPage(
fluidRow(dataTableOutput('table'))
)
server <- function(input, output) {
output$table <- renderDataTable(
datatable(data, options = list(paging = FALSE))
)
}
shinyApp(ui = ui, server = server)
It stills running perfectly in local host. Unfortunately the error stills ocurring in shinyapps.io. The following message is given:
An error has occurred
The application failed to start (exited with code 1).
`Registered S3 method overwritten by 'xts':
method from
as.zoo.xts zoo
Attaching package: ‘DT’
The following objects are masked from ‘package:shiny’:
dataTableOutput, renderDataTable
rgdal: version: 1.4-4, (SVN revision 833)
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 2.2.2, released 2017/09/15
Path to GDAL shared files: /usr/share/gdal/2.2
GDAL binary built with GEOS: TRUE
Loaded PROJ.4 runtime: Rel. 4.9.2, 08 September 2015, [PJ_VERSION: 492]
Path to PROJ.4 shared files: (autodetected)
Linking to sp version: 1.3-1
Warning in fun(libname, pkgname) :
rgeos: versions of GEOS runtime 3.5.1-CAPI-1.9.1
and GEOS at installation 3.5.0-CAPI-1.9.0differ
rgeos version: 0.5-1, (SVN revision 614)
GEOS runtime version: 3.5.1-CAPI-1.9.1
Linking to sp version: 1.3-1
Polygon checking: TRUE
Error in value[3L] :
Failed to connect to ftpupload.net port 21: Connection timed out
Calls: local ... tryCatch -> tryCatchList -> tryCatchOne ->
Execution halted