title: Assign output of RScript to makefile variable
body: <p>I'm trying to automate some R analysis using a makefile.  The analysis is a monthly data analysis and report.  It's working well so far, but to expand it I'd like to have the default action to be to create the current report, but be able to specifiy a month if required.</p>
  
  <p>I'm having trouble assigning the default report period (calculated by an R script) to a makefile variable.</p>
  
  <p>Makefile</p>
  
  <pre><code># Assign a data identifier. 
  #IRL could use R to assign current if not specified as an arg to make
  month :=     $(Rscript './R/reportperiod.R')
  
  test:
      echo $(month)
  </code></pre>
  
  <p>and the reportperiod.R script is</p>
  
  <p>require(lubridate)</p>
  
  <pre><code>cat(format(floor_date(as.POSIXct(Sys.time())-10*24*60*60, unit="month"), format="%Y%b"))
  </code></pre>
  
  <p>but this just displays</p>
  
  <pre><code>echo 
  </code></pre>
  
  <p>implying the script value hasn't been assigned to the variable.</p>