Running a rmd file (R-markdown) on remote cluster

Viewed 20

I have a rmd file and would like to run that on a university remote cluster. But have not been able. I appreciate help.

let's say I named the rmd file as "mycode.rmd" and below is its sample example.

title: "title"
output:
  html_document: 
    toc: true 
    toc_depth: 3  
    number_sections: true  
    theme: united  
    highlight: tango  
header-includes:
- \usepackage{amsthm}

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, warning = FALSE, message = FALSE)
rm(list = ls())

library(readr)

data =  read_csv("df.csv")
.
.
.

Here is an step by step procedure I did

  1. got connected to the cluster I loaded the R module on the cluster
  2. installed the packages in the code and set the R library environment variable (R_LIBS) to include my R package directory
    export R_LIBS=~/Rlibs

a) After copying the file in the cluster's given storage space I tried to create a binary file to run. Here is the code in the cmd

R mycode.Rmd -o run.exe

I got the following error:

ARGUMENT 'mycode.Rmd' __ ignored __ WARNING: unknown option '-o' ARGUMENT 'run.exe' __ ignored __

b) I also tried this code

 R rmarkdown::render"('mycode.Rmd',output_file='result.html')" -o run.exe

The error was the same.

is the above a way to do it but commands are wrong? If not how can I run a rmd file on a cluster.

Finally, The cluster is using Slurm so once the binary is created I will need to write a sbatch file and run the binary.

0 Answers
Related