Connecting R to Linux-Based Virtual Private Server (VPS) by DigitalOcean for Secure Data Access

Connecting R to Linux-Based Virtual Private Server (VPS) by DigitalOcean for Secure Data Access

I don’t manage my data with Excel, but primarily with SQL. I also don’t store any data on my local PC—not even SQL files. Instead, I keep everything on the server and access it whenever I need it. Previously, I shared how to import data to a cloud MySQL server and how to import data from the MySQL server into R.

How to Import Data to a Cloud MySQL Server (DigitalOcean) Using Python from Command Prompt
How to Import Data from MySQL Server to R?

Today, I will share an efficient way to manage databases using Linux-Based Virtual Private Server (VPS)

I use DigitalOcean as my cloud service provider.

https://www.digitalocean.com

I created Droplets on DigitalOcean, and each Droplets has its own dedicated public IP address. This IP address is the address of your server.

Next, I use WinSCP to upload data to the server using the IP.

https://winscp.net/eng

When you open WinSCP and log in using the server’s IP address, you will see two panels. The left panel shows your local PC, and the right panel shows the Linux server provided by DigitalOcean. You can transfer data to the server by dragging files between the panels.

I transferred one dataset, potato_image_database_2025.csv, to the server. If you want to set up a username and password, you’ll need to open the Console window and configure them there. I won’t explain how to do that in this post.

Next, I’ll import the data into R from this server. I developed a new R function to make the import process easier.

First, let’s install the function.

if(!require(remotes)) install.packages("remotes")
if(!requireNamespace("kimjkdata", quietly= TRUE)) {
  remotes::install_github("agronomy4future/kimjkdata", force= TRUE)
}
library(remotes)
library(kimjkdata)

Second, let’s import the data from the server.

df= kimjkdata("potato_image_database_2025.csv") 

When running the code, you will be required to enter the password.

When you enter the password, the data is imported into R.


We aim to develop open-source code for agronomy ([email protected])

© 2022 – 2025 https://agronomy4future.com – All Rights Reserved.

Last Updated: 30/11/2025

Comments are closed.