• Stars
    star
    124
  • Rank 288,207 (Top 6 %)
  • Language
    R
  • License
    MIT License
  • Created about 9 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Utilities for running R on a remote server

rmote

gif

Running R on a remote server

R users often find themselves needing to log in to a remote machine to do analysis. Sometimes this is due to data restrictions, computing power on the remote machine, etc. Users can ssh in and run R in a terminal, but it is not possible to look at graphics, etc.

There are currently three approaches that I am aware of to deal with this:

  1. Install RStudio Server on the remote server and use that from a web browser on your local machine. Graphics output is shown in the IDE.
  2. Use X11 forwarding (ssh -X|Y). Graphics output is sent back to your machine.
  3. Use VNC with a linux desktop environment like KDE or GNOME.

Whenever possible, #1 is by far the best way to go and is one of the beautiful things about RStudio Server. #2 is not a good choice - plots are very slow to render, the quality is terrible, and it doesn't support recent advances in plot outputs like htmlwidgets (unless you launch firefox through X11, which will mean you might get to look at one plot per hour). #3 is okay if it is available and you are comfortable working in one of these desktop environments.

There could be other obvious ways to deal with this that I am oblivious to.

A problem

Often we do not have the choice of installing RStudio Server or a desktop environment on the remote machine. Also, some users prefer to work in a terminal sending commands from a favorite text editor on a local machine, but still want to see graphics. We would like to have something better than X11 forwarding to view graphics and other output when running R in a terminal on a remote machine.

A solution

The rmote package is an attempt to make working in R over ssh on a server a bit more pleasant in terms of viewing output. It uses servr on the remote machine to serve R graphics as they are created. These can be viewed on the local machine in a web browser. The user's local browser will automatically refresh each time a new output is available.

Currently there is support for lattice, ggplot2, htmlwidgets, and help output.

Usage

  1. Choose a port to run your remote server on (default is 4321)

  2. ssh into the remote machine, mapping the port on the remote back to your local machine:

    ssh -L 4321:localhost:4321 -L 8100:localhost:8100 user@remote
    

    I also add port 8100 so I can forward shiny apps back to my local machine on a dedicated port.

  3. On the remote machine launch R and install the latest version of servr and rmote (one time only)

    install.packages("rmote", repos = c(CRAN = "http://cran.rstudio.com",
      tessera = "http://packages.tessera.io"))

    or alternatively

    devtools::install_github(c("yihui/servr", "hafen/rmote"))

    Note that this package will probably never be on CRAN since it overwrites some standard R S3 methods.

  4. Run the following in R on the remote:

    rmote::start_rmote()

    To view some of the options for this, see ?start_rmote. One option is the port, which needs to match the one your forwarded in step 2 (4321 is the default.)

  5. On your local machine, open up your web browser to localhost:4321

    Now as you create compatible plots on your remote machine, your browser on your local fmachine will automatically update to show the results. For example, try running each of the following in succession on the server:

    ?plot
    
    qplot(mpg, wt, data=mtcars, colour=cyl)
    
    dotplot(variety ~ yield | year * site, data=barley)
    
    library(rbokeh)
    figure() %>% ly_hexbin(rnorm(10000), rnorm(10000))

This process is slightly more tedious than ssh -X for initial setup, but much faster and more functional.

Other useful utilities

Another interesting package to check out that allows you to control R on a remote machine from your local R session is - remoter.

If you must work on a remote terminal, here are some additional utilities that help make things nice:

Installation

CRAN Build Status codecov.io

This package is not yet on CRAN. To install the latest development version you can install from the cloudyr drat repository:

# latest stable version
install.packages("rmote", repos = c(getOption("repos"), "http://cloudyr.github.io/drat"))

Or, to pull a potentially unstable version directly from GitHub:

if(!require("ghit")){
    install.packages("ghit")
}
ghit::install_github("cloudyr/rmote")

cloudyr project logo

More Repositories

1

aws.s3

Amazon Simple Storage Service (S3) API Client
R
381
star
2

googleComputeEngineR

An R interface to the Google Cloud Compute API, for launching virtual machines
R
152
star
3

googleCloudStorageR

Google Cloud Storage API to R
R
103
star
4

MTurkR

R Client for the MTurk Requester API
R
91
star
5

RoogleVision

R Package for Image Recognition using Google Cloud Vision
R
76
star
6

limer

A LimeSurvey R Client
R
67
star
7

Rmonkey

A Survey Monkey R Client
R
53
star
8

aws.ec2

AWS EC2 Client Package
R
45
star
9

ghit

Lightweight GitHub Package Installer
R
43
star
10

bigQueryR

R Interface with Google BigQuery
R
41
star
11

aws.lambda

AWS Lambda Client Package
R
32
star
12

aws.signature

Amazon Web Services Request Signatures
R
31
star
13

cloudyr.github.io

the cloudyr project website
CSS
29
star
14

aws.polly

Client for AWS Polly
R
23
star
15

AzureStor

Interface to Azure storage accounts. Submit issues and PRs at https://github.com/Azure/AzureStor
R
22
star
16

AzureRMR

Interface to Azure Resource Manager: authenticate, get subscriptions, get resource groups. Submit issues and PRs at https://github.com/Azure/AzureRMR.
R
19
star
17

AzureKusto

R interface to Kusto/Azure Data Explorer. Submit issues and PRs at https://github.com/Azure/AzureKusto
R
18
star
18

cloudcidrs

Tools to Obtain and Work with Cloud Provider CIDR Blocks in R
R
16
star
19

Microsoft365R

Interface to Microsoft 365 (formerly Office 365). Submit issues and PRs at https://github.com/Azure/Microsoft365R.
R
16
star
20

aws.iam

AWS IAM Client Package
R
15
star
21

pyMTurkR

A Client for the MTurk Requester API
R
15
star
22

awspack

Amazon Web Services Bundle Package
Shell
15
star
23

aws.alexa

Client Package for the Amazon Alexa Web Information Service
R
13
star
24

aws.dynamodb

Client Package for the Amazon DynamoDB Service
R
13
star
25

AzureAuth

OAuth 2.0 authentication with Azure Active Directory. Submit issues and PRs at https://github.com/Azure/AzureAuth
R
13
star
26

aws.ec2metadata

Access to EC2 Instance Metadata
R
12
star
27

aws.comprehend

AWS Comprehend Client
R
12
star
28

aws.sns

Amazon Simple Notification Service (SNS) API Client
R
12
star
29

AzureContainers

Containers in Azure: AKS, ACR, ACI. Submit issues and PRs at https://github.com/Azure/AzureContainers.
R
11
star
30

rdatastore

R package for accessing google datastore
R
11
star
31

roto.athena

Access Amazon's AWS Athena API via reticulate and AWS official Python boto3 module
R
11
star
32

aws.sqs

Amazon Simple Queue Service (SQS) API Client
R
11
star
33

travisci

Travis-CI API Client Package
R
10
star
34

crowdflower

Crowdflower.com API Client
R
8
star
35

AzureVM

Manage virtual machines in Azure. Submit issues and PRs at https://github.com/Azure/AzureVM
R
8
star
36

roto.s3

Access and Orchestrate Amazon Simple Storage Service
R
7
star
37

aws.secrets

R
7
star
38

aws.ses

Amazon Email Service (SES) API Client
R
7
star
39

googleCloudVisionR

Google Cloud Vision API to R
R
6
star
40

qualtrics

An R Client for Qualtrics
R
6
star
41

aws.cloudwatch

AWS CloudWatch Client Package
R
6
star
42

gcloudR

Load all Google Cloud APIs at once
R
5
star
43

appveyor

Appveyor API Client Package
R
5
star
44

AzureVision

Interface to Azure Computer Vision API. Submit issues and PRs at https://github.com/Azure/AzureVision
R
4
star
45

pkgtemplate

Style guide-consistent package template for the cloudyr project
Shell
4
star
46

AzureKeyVault

R interface to Azure Key Vault. Submit issues and PRs at https://github.com/Azure/AzureKeyVault
R
4
star
47

aws.transcribe

Client for AWS Transcribe
R
4
star
48

AzureGraph

Simple interface to the Microsoft Graph API. Submit issues and PRs at https://github.com/Azure/AzureGraph
R
4
star
49

aws.athena

R
3
star
50

aws.ml

AWS Machine Learning Client
R
3
star
51

microworkers

Microworkers.com R Client
R
3
star
52

aws.glacier

AWS Glacier Client Package
R
3
star
53

aws.translate

Client for AWS Translate
R
3
star
54

circleci

Circle CI API Client Package
R
2
star
55

aws.code

Amazon Code-Commit, -Deploy, -Pipeline API Client
R
2
star
56

aws.batch

2
star
57

MTurkRGUI

A Graphical User Interface for MTurkR
R
2
star
58

aws.sagemaker

1
star
59

AzureVMmetadata

R interface to VM instance metadata. Submit issues and PRs at https://github.com/Azure/AzureVMmetadata.
R
1
star
60

aws.efs

Amazon Web Services Elastic File System Client
R
1
star
61

AzureCosmosR

Interface to Azure Cosmos DB. Submit issues and PRs at https://github.com/Azure/AzureCosmosR.
R
1
star