Passing variables and values from an R script to a shell script I'm working with a shell script(#!/bin/sh) and I wanted to know if there is a way to call variables with their values from an Rscript that I have called in my Shell script.
If that doesn't make sense I want to create, for example a data frame 
data=data.frame(a=seq(1,5), b=seq(1,5)) in a script called test.r
and then call that variable, with it's content in my shell script, i.e to print it with an echo: 

echo $data
The Bash feature you want is called command substitution, e.g:

echo $(./test.r)


That will echo the output of your Rscript. Alternatively you could capture it in an environment variable.