my $R = Statistics::R->new(); $R->set( 'filenames', \@filenames ); $R->set( 'id', $id ); $R->set( 'par1', $par1 ); $R->set( 'par2', $par2 ); $R->run_from_file( "genoplot_by_id.build_df.R" ); $R->run_from_file( "genoplot_by_id.build_plot.R" ); $R->run( qq`setwd("$plot_dir")` ); $R->run( qq`ggsave( filename = paste("$plot_path", "$plot_format", sep = "."), plot = geno.plot, width = $plot_width, height = $plot_height)` ); #### # Array of R commands: my $out1 = $R->run( q`a <- 2`, q`b <- 5`, q`c <- a * b`, q`print("ok")` ); # Here-doc with multiple R commands: my $cmds = <run($cmds);