Skip to content
Back to formatted view

Raw Message

Message-ID: <009fb483-ff67-4397-9c0e-1e1470b72420@email.android.com>
Date: 2011-11-07T16:29:43Z
From: Jeff Newmiller
Subject: R-bash beginneR
In-Reply-To: <SNT116-W333757E042CBF219C1A05EC6D90@phx.gbl>

This is not an R question. Use the print function in R and use backticks in bash.
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.

"David A." <dasolexa at hotmail.com> wrote:

>
>Hi,
>
>I am trying to run some R commands into my bash scripts and want to use
>shell variables in the R commands and store the output of R objects
>into shell variables for further usage in downstream analyses. So far I
>have managed the first, but how to get values out of R script? I am
>using  "here documents" (as a starter, maybe something else is simpler
>or better; suggestions greatly appreciated).
>
>A basic random example:
>
>#!/bin/sh
>MYVAR=2
>R --slave --quiet --no-save <<EEE
>x<-5
>
>z<-x/$MYVAR
>zz<-x*$MYVAR
>EEE 
>
>
>How get the values of z and zz into shell variables?
>
>
>Thanks
>
>D
> 		 	   		  
>	[[alternative HTML version deleted]]
>
>______________________________________________
>R-help at r-project.org mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.