Skip to content

R code chunks

7 messages · Ivan Calandra, John Magnotti, Mollie Brooks +1 more

#
Thank you for your answer.

I don't usually use the Terminal, so I'm not sure how to do it.
But do you mean to start it from the Terminal and then use the R GUI or 
do everything in the Terminal? In the latter case, I would prefer using 
RStudio... My question was about using the R GUI Editor rather than RStudio.

Ivan

--
Ivan Calandra, PhD
University of Reims Champagne-Ardenne
GEGENAA - EA 3795
CREA - 2 esplanade Roland Garros
51100 Reims, France
+33(0)3 26 77 36 89
ivan.calandra at univ-reims.fr
--
https://www.researchgate.net/profile/Ivan_Calandra
https://publons.com/author/705639/

Le 12/04/2016 11:41, Tom Hopper a ?crit :
#
Hi Ivan,

Using the R GUI and the built-in editor, you should be able to format your document in the standard Rmarkdown or knitr way and save it with the appropriate extension (Rmd or Rnw), but only run lines within chunks in the console (using command + enter in the normal way). You can make sure all the chunks are working in that way. Then to format the whole document you can use a command in the Terminal as described in the links Tom sent or reopen the document in Rstudio. 

Somehow my R GUI can?t find the right pieces to make the pdf, so I have to use the Terminal. render("EstObsErr.Rmd") produces the error
/usr/local/bin/pandoc EstObsErr.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures --output EstObsErr.pdf --template /Library/Frameworks/R.framework/Versions/3.2/Resources/library/rmarkdown/rmd/latex/default-1.14.tex --highlight-style tango --latex-engine pdflatex --variable 'geometry:margin=1in' 
pandoc: pdflatex not found. pdflatex is needed for pdf output.
Error: pandoc document conversion failed with error 41

cheers,
Mollie

------------------------
Mollie Brooks, PhD
Postdoctoral Researcher, Population Ecology Research Group
Department of Evolutionary Biology & Environmental Studies, University of Z?rich
http://www.popecol.org/team/mollie-brooks/

  
  
#
The failure to find pdflatex may have to do with how R GUI tries to
discover the system path (or pdflatex is actually not on your system). A
while back, Ian Gow suggested adding the location of the pdflatex binary to
the path to fix this issue.

The top of that thread is here:
https://stat.ethz.ch/pipermail/r-sig-mac/2015-March/011335.html

The solution suggested by Ian Gow is in the first reply.

hope that helps,

John

On Tue, Apr 12, 2016 at 8:05 AM, Mollie Brooks <mollieebrooks at gmail.com>
wrote:

  
  
#
Thank you Mollie and all,

So it looks like there's no way to properly use chunks within the Mac R 
GUI.
I will have to decide whether I completely switch to RStudio, or develop 
in the R GUI and then run in RStudio.

Still, until now I was a great fan of the R GUI on Mac so I'm a bit 
frustrated. It would be great if this feature were integrated to the R 
GUI some day! Alternatively, a better GUI for RStudio allowing for 
multiple screens would be fine too (but that's for another list!).

Bests,
Ivan

--
Ivan Calandra, PhD
University of Reims Champagne-Ardenne
GEGENAA - EA 3795
CREA - 2 esplanade Roland Garros
51100 Reims, France
+33(0)3 26 77 36 89
ivan.calandra at univ-reims.fr
--
https://www.researchgate.net/profile/Ivan_Calandra
https://publons.com/author/705639/

Le 12/04/2016 15:05, Mollie Brooks a ?crit :
#
Hi Ivan,

Can you be more explicit about what it means to you to "enable chunks" or "properly use chunks"? Then developers will understand what you?re looking for.

cheers,
Mollie

------------------------
Mollie Brooks, PhD
Postdoctoral Researcher, Population Ecology Research Group
Department of Evolutionary Biology & Environmental Studies, University of Z?rich
http://www.popecol.org/team/mollie-brooks/

  
  
#
Sorry, I thought it would be clear based on the previous emails...

I don't know much yet about chunks and other functionalities of knitr 
and rmarkdown, so I might be missing some points, but three interesting 
aspects about chunks that I have already notices is that it is possible 
to give them names, expand them or reduce them in the script (making the 
code more readable) and evaluating them but not displaying the results 
in the html/pdf report. This is possible in RStudio, but it seems that 
it is not in the R GUI Editor.

Ivan

--
Ivan Calandra, PhD
University of Reims Champagne-Ardenne
GEGENAA - EA 3795
CREA - 2 esplanade Roland Garros
51100 Reims, France
+33(0)3 26 77 36 89
ivan.calandra at univ-reims.fr
--
https://www.researchgate.net/profile/Ivan_Calandra
https://publons.com/author/705639/

Le 12/04/2016 16:04, Mollie Brooks a ?crit :
#
Ivan,

Some of the functionality of R Markdown documents can be found in the R GUI when you work in a script document rather than the console and make use of functions. For instance, the ability to expand or collapse parts of the document (functions can be expanded or collapsed), have code run without output to the console (invisible returns from functions, or assigning function returns to variables).

It doesn?t sound as though this is exactly what you?re looking for?the literate programming concept with rmd documents is very nice?but it might suit your particular needs.

- Tom
<snip>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-mac/attachments/20160412/17db747c/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 670 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <https://stat.ethz.ch/pipermail/r-sig-mac/attachments/20160412/17db747c/attachment.bin>