[TxMt] Working with in-line R code
Ross Ahmed
rossahmed at googlemail.com
Sat Mar 22 08:48:15 UTC 2014
Hi all
I have some .Rnw files with in-line R code, like this:
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua \Sexpr{mean(mtcars$hp)}.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat \Sexpr{mean(mtcars$mpg)}. Duis aute irure
dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui
officia deserunt mollit anim id est laborum \Sexpr{mean(mtcars$wt)}.
I¹m wondering if its possible to do two things:
1. Place cursor inside a Sweave expression then run the code contained
within that expression to R app. So if I place the cursor anywhere between \
and } in any of the three Sweave expressions above, the code within that
expression would be run in R app. For example, if I place the cursor between
³h² and ³p², then this would be ran in R app: mean(mtcars$hp)
2. Select any text and run any R code within the selected text to R app. So
if if select the entire text above, three lines of code would be run in R
app: \Sexpr{mean(mtcars$hp)}, \Sexpr{mean(mtcars$mpg)} and
\Sexpr{mean(mtcars$wt)}
Thanks
Ross
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20140322/14ea437d/attachment.html>
More information about the textmate
mailing list