title: Running an R script that involves Packages from Python Code
body: <p>So I'm currently working on a simple python code to run a simple R script. The R script is only about 6 lines but uses the package "pracma". Using the subprocesses module in python, It runs the script but with the typical "Error in library(pracma) : there is no package called 'pracma' ". I am just looking for a simple solution to be able to run R scripts that have non-base packages installed. I know you can somehow do this using rpy2, but I cannot get that to install using pip, and I'm also using Anaconda3. </p>
  
  <p>All in all, I'd just like a simple package that runs R scripts that have packages installed in them. Any help would be greatly appreciated.</p>
  
  <p>This is the relevant piece of my Python code:</p>
  
  <pre><code>sp.run('Rscript Hausdorff.R', shell=True)
  
  bFile = open("HausdorffData/hausdorff.txt", "r")
  result = bFile.read()
  bFile.close()
  hausdorff_dist = float(result)
  
  return hausdorff_dist
  </code></pre>
  
  <p>This is my R script:</p>
  
  <pre><code>library(pracma)
  
  setwd('HausdorffData')
  
  PointsA &lt;- as.matrix(read.table("HFileA.txt", header = FALSE))
  PointsB &lt;- as.matrix(read.table("HFileB.txt", header = FALSE))
  
  H = hausdorff_dist(PointsA, PointsB)
  write(H, file = "hausdorff.txt",ncolumns = 1, append = FALSE)
  </code></pre>
  
  <p>This produces the following error:</p>
  
  <pre><code>Error in library(pracma) : there is no package called 'pracma'
  Execution halted
  </code></pre>