Loading...
 
Tiki and PluginR

Tiki and PluginR


Re: a better R workflow on a webserver

posts: 40 France

I think I got some generic solution
Th R script is:

create_Rda.R
Copy to clipboard
args < - commandArgs(trailingOnly = TRUE) dir < - args[1] input.path < - args[2] output.path < - args[3] setwd(dir) s4r < - read.delim(file=input.path, header=TRUE, sep="|", skip="1", quote="") save(s4r, file=output.path)


Then it is called by the shell script which crontab launches

Copy to clipboard
#!/bin/bash STATS_FOLDER="export_stats_files/" STATS_FILE="stats_4_R.txt" # this is the csv which contains the data in STATS_FOLDER RDA_FILE="stats_4_R.Rda" # This will be created in STATS_FOLDER RDA_FILE_TMP="stats_4_R_tmp.Rda" # this is a temporary file to ensure RDA_FILE remains available during processing /usr/bin/Rscript create_Rda.R "${STATS_FOLDER}" "${STATS_FILE}" "${RDA_FILE_TMP}" echo -n "Rda file " diff -q "${STATS_FOLDER}/${RDA_FILE_TMP}" "${STATS_FOLDER}/${RDA_FILE}" > /dev/null && (echo "OK"; /bin/rm "${STATS_FOLDER}/${RDA_FILE_TMP}" ) || (echo "Replace"; /bin/mv "${STATS_FOLDER}/${RDA_FILE_TMP}" "${STATS_FOLDER}/${RDA_FILE}")
There are no comments at this time.

Upcoming Events

1)  18 Apr 2024 14:00 GMT-0000
Tiki Roundtable Meeting
2)  16 May 2024 14:00 GMT-0000
Tiki Roundtable Meeting
3)  20 Jun 2024 14:00 GMT-0000
Tiki Roundtable Meeting
4)  18 Jul 2024 14:00 GMT-0000
Tiki Roundtable Meeting
5)  15 Aug 2024 14:00 GMT-0000
Tiki Roundtable Meeting
6)  19 Sep 2024 14:00 GMT-0000
Tiki Roundtable Meeting
7) 
Tiki birthday
8)  17 Oct 2024 14:00 GMT-0000
Tiki Roundtable Meeting
9)  21 Nov 2024 14:00 GMT-0000
Tiki Roundtable Meeting
10)  19 Dec 2024 14:00 GMT-0000
Tiki Roundtable Meeting