The goal is to store an object that can then be stored as a pin on R Studio Connect. I would prefer not to download the file on my local machine as this is a manual step. I want to automate the pulling of the data using the SFTP connection.
I currently am able to download files from my SFTP connection using the sftp package in r. After some research, I was able to create an object using this code:
connection <- sftp::sftp_connect(
server = "host_server.com",
folder = "/file/folder",
username = "user_name",
password = "password",
protocol = "sftp://",
port = 22,
timeout = 30)
fileurl <- paste0(connection$url, "/", "filename.csv.zip")
port <- as.integer(connection$port)
userpwd <- connection$userpass
timeout <- connection$timeout
test <- RCurl::getBinaryURL(url = fileurl,
port = port,
userpwd = userpwd,
connecttimeout = timeout,
.opts = list(),
dirlistonly = FALSE)
At the moment, I'm stuck on how to then transfer this object to something that can be read by humans. Is there a step that I'm missing in between since the file that I'm trying to retrieve is a zip file?