# Rscript

Today I learned about Rscript, a way to call R from the command line.
Let's say I want to perform the following Chi-Square test in R, from the command line.

x=matrix(c(143,75, 213,69),nrow=2); chisq.test(x)

Then I can do so from the command line as follows.

Rscript -e \"x=matrix(c(143,75, 213,69),nrow=2); chisq.test(x)

Which means that I can capture the result in Ruby as follows:

a=`Rscript -e \"x=matrix(c(143,75, 213,69),nrow=2); chisq.test(x)\"`