<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">I’d add a scope to the outer document (markdown?) which grabs (<span style="font-family: Calibri, sans-serif; font-size: 14px;">\Sexpr{)(.*)(}) and injects R into the middle capture.</span><div><font face="Calibri, sans-serif"><span style="font-size: 14px;">then you inherit the ability to execute the R inside with Hans Jorg Bibiko’s applescript command for executing code</span></font></div><div><font face="Calibri, sans-serif"><span style="font-size: 14px;"><br></span></font><div><div><div>On 22 Mar 2014, at 08:48, Ross Ahmed <<a href="mailto:rossahmed@googlemail.com">rossahmed@googlemail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; font-size: 14px; font-family: Calibri, sans-serif;"><div>Hi all</div><div><br></div><div>I have some .Rnw files with in-line R code, like this:</div><div><br></div><div>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)}.</div><div><br></div><div>I’m wondering if its possible to do two things:</div><ol><li>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)</li><li>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)}</li></ol><div>Thanks</div><div>Ross</div><div><br></div></div>
<br>_______________________________________________<br>textmate mailing list<br><a href="mailto:textmate@lists.macromates.com">textmate@lists.macromates.com</a><br>http://lists.macromates.com/listinfo/textmate</blockquote></div><br></div></div></body></html>