Multiple R job submissions at once in HPC ?

Hello,
I have a R-script which runs over multiple files in a loop say 45 CSV files. I can submit it 3 times with 15 files each time by changing the file numbers like
i=1:15 , i=16:30 and i=31:45 and remaining codes are the same.
R-script

library(tidyverse)
# fiel contaning lsit of files i.e. a.csv, b.csv....
obs_files=read.csv('station.csv', colClasses=c("Station"="character"))
obs_files=paste0(obs_files$Station, ".csv")
i=1:15
obs_files=obs_files[i]
setwd("C:/Users/obs")
obs_df <- lapply(obs_files, read_csv,col_types = cols())
func<- function(obs1){
  obs <- obs1
  obs_out=obs %>% 
    mutate(yr=year(time))
}
output=parallel::mcmapply(function(obs1){
  return(func(obs1))
}, obs1=obs_df,mc.cores=1,SIMPLIFY = FALSE)

Is this possible to submit a bash-code/R script that can submit the 3-jobs at once? In addition, I want to update the output.out and error for each job. in the following code.

bash code:

#!/bin/bash
#PBS -l nodes=1:ppn=20,walltime=05:00:00
#PBS -m e
#PBS -o output.out
#PBS -e error
module load R/4.0
Rscript ~/r_script1.R

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.