If the only goal is to edit R code externally, it is already possible with knitr: http://yihui.name/knitr/demo/externalization/
And a general solution of sending program code to the terminal might be more useful. Regards, Yihui -- Yihui Xie <xieyi...@gmail.com> Phone: 515-294-2465 Web: http://yihui.name Department of Statistics, Iowa State University 2215 Snedecor Hall, Ames, IA On Sun, Dec 16, 2012 at 6:14 AM, Liviu Andronic <landronim...@gmail.com> wrote: > On Thu, Dec 13, 2012 at 8:04 PM, Scott Kostyshak <skost...@lyx.org> wrote: >> I wonder if this ticket has something to say about implementation: >> http://www.lyx.org/trac/ticket/7404 >> If each inset had an option to "edit externally" then the user could >> set the "edit command" to whatever he/she wanted. >> > I'm not sure that this would work. For one, this would imply that each > chunk is opened in a different R session, which is suboptimal. > > Yihui's idea could prove immensely useful, but we need a document-wide > solution. Here's a half-baked proposal for implementation: > - Define an 'Sweave load workspace' custom inset that would allow to > <<echo=F>>= > load('<workspace>') > @ > > where '<workspace>' can be './.RData' or whatever the user inputs. > Given Juergen's recent work on insets, I think it is possible to > define such a monstrosity. > > - In the c-menu of this inset, there would be an 'Open R session' item > that when activated would open a terminal in the dir of the LyX file, > and load the associated workspace (as indicated in the inset). If > possible, instead of a terminal we would open RStudio (or some other R > editor). > > - We would need a new LFUN (associated with some 'ctrl+alt+r' binding > or whatever) that would allow the execution of chunk: Take the chunk > contents and pass them to R (or RStudio). We might want to have an > LFUN allowing executing code line by line. Such an arrangement would > allow to evaluate the chunks while working in LyX. > > - Another possibility would be that upon activating the c-menu item, > LyX would export to Sweave, open the resulting .Rnw file in RStudio > and let the user use RStudio functionality to evaluate the chunks. > > Would it be difficult to implement something similar? > > Regards > Liviu