texi2dvi() error when running a .Rnwscript with LaunchControl

后端 未结 1 1678
无人及你
无人及你 2021-01-14 01:20

I\'m trying to compile a knitr script on a timer using LaunchControl (a launchd GUI for scheduling cron-like jobs on OSX).

I have a dispatcher.R script that does th

相关标签:
1条回答
  • 2021-01-14 01:32

    To run a .Rnw file using LaunchControl for task scheduling, create the following files in the same directory. Then, run the *.sh script in the scheduler. Voila! The problem I was encountering in my original post was the LaunchControl doesn't (by default, at least) read ~/.bash_profile, so adding the PATH variable into the .sh script resolves this.

    1) Your *.Rnw script

    This is any knitr script that you can compile without issue from RStudio.

    2) A *.R script

    #!/Library/Frameworks/R.framework/Resources/Rscript
    library("knitr")
    setwd("~/some_directory")
    knit2pdf("yourscript.Rnw", output = "yourscript.tex")
    

    3) A *.sh script

    Make sure that you have the PATH variable to your LaTeX installation.

    #! /bin/bash 
    
    PATH="/usr/texbin:${PATH}"
    export PATH
    
    Rscript yourscript_dispatcher.R
    

    This solution works on OSX Yosemite 10.10.5 on R version 3.3.2 (2016-10-31).

    0 讨论(0)
提交回复
热议问题