R-Sweave v2.2 by Gilbert Ritschard (gilbert.ritschard@unig.ch) Support for R, Sweave and knitr - R-Sweave-8.zip for WinEdt 8 - R-Sweave-7.zip for WinEdt 7 - R-Sweave-6.zip for WinEdt 6 (no longer supported, last version v2.1) - R-Sweave-55.zip for WinEdt 5.5 (no longer supported) - R-support is based on the RWinEdt stuff (menu, highlighting, tool bar buttons). The support is here made available in a standard WinEdt session instead of running it in a limited stand alone WinEdt instance. - support (sweave.edt, menu, buttons, ...) for sweave, the R program which transforms LaTeX .Rnw files with R chunks into a LaTeX files with the R chunks replaced by their R outcome. - Since version v2.0, support for knitr (http://yihui.name/knitr/). - Since version v2.1, support for inverse search to .Rnw file. For the macro to run correctly, the following R packages should be installed in your R system: - cacheSweave - knitr - markdown - tools - stringr We also recommend to transfer the Sweave.sty file from the c:\Program Files\R\R-x.xx.x\share\texmf\ directory to a directory searched by your TeX system. Alternatively, you can add the above directory in the list of paths that TeX will search. In any of these two cases, add a \usepackage{Sweave} in the preamble of your LaTeX document. For inverse search you need a PDF reader supporting it. You also need to install Duncan Murdoch's patchDVI R library, which is available from R-Forge with the following R command (needs latest version of R) install.packages("patchDVI", repos="http://R-Forge.R-project.org") Most of the credit of the R-support goes to Uwe Ligges, the author of RWinEdt. Many thanks to him for allowing me to reuse his material. The update for WinEdt 6 has been done by Karl Koeller. The much nicer button images in the WinEdt 6 version of the support are also due to Karl Koeller. Many thanks to him for his invaluable contribution. Karl also updated the winEdt 6 version for WinEdt 7. Karl wrote the new install and uninstall procedures used for version 2.2 (R-Sweave-7 only) which should allow a smooth transition to WinEdt 8. The included RWinEdt stuff is under GPL-2 licence, thus we distribute this R-Sweave support also under GPL licence. Licence: GPL v2 or newer (http://www.gnu.org/copyleft/gpl.html) ============================================================= v2.2 Changes since v2.1.2 - New install and uninstall procedures to solve potential conflicts with the install of other packages. ============================================================= v2.1.2 Changes since v2.1.1 - Fixed a color issue in the Switches.ini file for WinEdt 6. ============================================================= v2.1.1 Changes since v2.1 - Fixed badly placed PopTagsandRegisters in Sweave.edt and knitr.edt. ============================================================= v2.1 Changes since v2.0.1 - Use of the console for Sweave and knitr, which allows to follow the evolution during execution of the R chunks. - Support for inverse search based on Duncan Murdoch's patchDVI R package. - Few minor bug fixes in the install macro. ============================================================= v2.0.1 Changes since v2.0 - Bug fixes: - Changed remaining "%B\Contrib" to "%b\Contrib" in R-sweave_install.edt, R-sweave_uninstall.edt, knitr.edt, Sweave.edt - Changed .bmp to .png in R-sweave_install.edt of V7. ============================================================= v2.0 Changes since v1.4 - Support for knitr (in WinEdt 6 and 7 version only) - for Rnw file, runs as with Sweave, i.e., pdftexifies the generated .tex when there are no errors, and shows the error log when errors are reported. - there are also a menu item and a toolbar button to knit .Rhtml, .Rmd and .Rrst files (see http://yihui.name/knitr/ for details and example files) and displaying the resulting .html (from .Rhtml and .Rmd) with the default browser. - the installation can be done from any folder and the whole support is installed in %b by the install macro. - menu items now give access to _Run.log and _Err.log . ============================================================= v1.4 Changes since v1.3 - There is now a distribution for WinEdt 7. - Default install adds two drop-down buttons in the toolbar: one for Sweave and one for R. - sweave.edt now invokes StartWorking("Running Sweave..."); to indicate that Sweave is running. ============================================================= v1.3 Changes since v1.2 - There is now a distribution for WinEdt 6. - Possibility to control the 32bit/64bit choice with %!4 - Uses now SetInfo(9,"Sweave") (Compatible with WinEdt 6) - Uninstall macro (WinEdt 6 only) ============================================================= v1.2 Changes since v1.1 - adapted for R-2.12.0 which uses now ...\bin\i386 (for the 32bit version) ...\bin\x64 (for the 64bit version) the default installed setting is for bin\i386, you should change that manually if you want to use x64 (see below how to pass registry to Sweave.edt and specially LetReg(7, ...)) ============================================================= v1.1 Changes since first version: - support and menu item for Stangle (for concatenating all chunks into a single .R file) ============================================================= Installation Instructions: ========================= There are specific zip file for each distribution: version WinEdt 7, WinEdt 6 and one for older version, namely WinEdt 5.5. Just select the one which is appropriate for you. !!! If you had a previous version of R-Sweave installed, be sure !!! to delete all related items from mainmenu.ini and from !!! toolbars.ini !!! R-Sweave_uninstall.edt will do it only if you did not customize !!! any items after installation !! 1. Unpack the R-Sweave.zip, preferably in an empty folder. 2. Open WinEdt. 3. Make a backup of your present configuration (using options/maintenance/backup). 4. Launch the "R-Sweave_install.edt" macro (For instance by opening this .edt file in WinEdt and pressing Ctrl-Shift-F9). In WinEdt 6 and upper, you will have two default drop-down buttons: one for Sweave and knitr, and one for R. This can indeed be customized. In WinEdt 5.5, you may add R-Sweave related buttons to the Tool Bar through the "Enter Tool Bar Setup..." dialog (contextual menu from the tool bar). However, you should first restart WinEdt to have access to the R-Sweave buttons. Now, you should be done. Default installation is for the 64bit version of R 2.12.0 or higher. If you have only access to the 32bit version: Before insatlling, open the MainMenu.ini file (or R-Sweave.dat file for the 5.5 version) provided with the support and substitute in it all occurrences of LetReg(4,'\x64') with LetReg(4,'\i386') or LetReg(4,'') if you have an older version than R 2.12.0. =============================================================== Usage instructions: ================== You can customize the menu items. Here are the arguments (registry) that can be passed to the Sweave.edt macro: LetReg(6,"xxx"); where xxx can be pdf, dvi, R, Stop, Direct the latter being an alias of pdf. LetReg(7,"R installation path"); can be used to tell the macro where it can find the R binaries. If empty, sweave.edt uses the value given by the Windows registry. LetReg(8,"xxx"); where xxx can be: cache : for running cacheSweave instead of Sweave. knitr : for running knitr instead of Sweave. R : for running Stangle instead of Sweave. Stangle just concatenates all chuncks into a single %n.R file. Indeed when choosing this option, the %!6 register will be ignored. LetReg(9,"open"); When set, Sweave.edt just opens an R console. LetReg(4,"yyy"); where "yyy" can be either "\i386" (32bit), "\x64" (64bit) if you are running R version 2.12.0 or higher, or "" for R version < 2.12.0 . Arguments that can be passed to knitr.edt are: LetReg(6,xxx); where XXX can be pdf, dvi, R or stop For files with extension .Rmd or .Rhtml: when not "stop" or "R" knit outcome is processed and shown with default application for .html extension. LetReg(7,"R installation path"); can be used to tell the macro where it can find the R binaries. If empty, sweave.edt uses the value given by the Windows registry. LetReg(4,"yyy"); where "yyy" can be either "\i386" (32bit), "\x64" (64bit) if you are running R version 2.12.0 or higher, or "" for R version < 2.12.0 . ================================================================ Good luck and enjoy. Gilbert