Hi all,
I had a set of files which I split into two (.control and .case) using bash script. Now I want to run the R function "t.test" on it. Is there a way to run/call the R function within the bash script such that the names are stored in variable and I want to use the same name in R function as well. the script which I have right now is
Code:
cd $PBS_O_WORKDIR
for FileName in $(cat Artery_Aorta-ListOfScoreFilesForScript.txt);
do
cat "$FileName" | awk -v fn="$FileName" '{if ($3 == 1) {print $6 >>fn".control"} else if ($3 == 2) {print $6 >>fn".case"}}';
Rscript t.test($FileName.control, $FileName.case, alternative = "two.sided", paired = FALSE, var.equal = FALSE)
done;
I also want to output the result of the t.test into the same variable $FileName along with the .test extension.