[HN Gopher] R Markdown: The Definitive Guide
___________________________________________________________________
R Markdown: The Definitive Guide
Author : Koshkin
Score : 82 points
Date : 2021-02-03 18:26 UTC (4 hours ago)
(HTM) web link (bookdown.org)
(TXT) w3m dump (bookdown.org)
| melling wrote:
| I recently discovered R Markdown. Started doing the ISLR examples
| with it.
|
| https://github.com/melling/ISLR/blob/main/chapter08/08_Lab02...
|
| https://github.com/melling/ISLR/blob/main/chapter08/08_Lab02...
|
| I need to figure out how to better fit images so I don't have
| pages with large gaps
|
| Also, you can now embed executable Python in the files.
| bnj wrote:
| Tangentially: Reading [0] from Stephen Wolfram yesterday got me
| digging into Wolfram notebooks. Does anyone have experience or
| reflections on using R Notebooks as the main way to keep track of
| notes?
|
| I don't see the Wolfram products talked about very much here
|
| [0]: https://writings.stephenwolfram.com/2019/02/seeking-the-
| prod...
| mespe wrote:
| I've been using Rmarkdown and knitr for a long while, and have
| watched its evolution over the years (roughly 8 years now). As
| someone who does not use RStudio, it's become a bit of a pain for
| me to use. The authors seem to expect it is being used from
| RStudio, and using it in a different environment has become a bit
| fragile.
|
| It's also a bit telling that this "definitive guide" does not
| include any troubleshooting/debugging sections - the expectation
| seems to be that it "just works" so long as you use it in
| RStudio, but otherwise you are on your own.
|
| Not sure that I am aware of many other R packages with this
| mentality, but I am personally not a fan.
| ska wrote:
| I haven't used it for a few years, but I have previously set up
| some purely command line tooling for this (autogenerated
| verification reports) which worked well. Is this getting harder
| to do?
| mespe wrote:
| Some functionality has been tied to RStudio's concept of a
| "project" (https://support.rstudio.com/hc/en-
| us/articles/200526207-Usin...). I have had several documents
| authored by others which would not build on my system without
| some intervention due to this.
| ska wrote:
| Interesting. Thanks.
| runningmike wrote:
| Jupyter Book is more flexible, simpler and tested to death since
| it is build upon Sphinx and docstrings. Since jupyter uses pandoc
| for converting notebooks, pandoc is the power tool for
| publication creations nowadays.
| spinningslate wrote:
| Jupyter has downsides too, e.g. version control. An R Markdown
| document "in the raw" is just a text file.
|
| For info, Rmd also uses pandoc under the covers. Agree it's the
| power tool, quite a wonderful thing.
| qbasic_forever wrote:
| Jupyter Book (and the larger jupyter ecosystem now) are
| starting to standardize on MyST notebooks as a version-
| control friendly all text notebook format. It's similar to r
| markdown and uses fenced code blocks to represent code cells.
| You can diff them, edit in any text editor, etc. See:
| https://myst-nb.readthedocs.io/en/latest/
| closed wrote:
| I'm familiar with both Rmarkdown and Jupyter Book. Rmarkdown
| also uses pandoc. Both are very flexible.
| minimaxir wrote:
| R Markdown/Notebooks, IMO, has evolved to be the key value
| proposition of RStudio over the years. From a productivity
| standpoint when both working with R and publishing pretty
| reports/PDFs it has been incredible. (that said, if VS Code gets
| more robust R Markdown support, I may consider switching from
| RStudio)
|
| I wrote a blog post a few years ago comparing R
| Markdown/Notebooks to Jupyter Notebooks:
| https://minimaxir.com/2017/06/r-notebooks/
| mespe wrote:
| Funny thing is this has actually motivated me to move away from
| using rmarkdown. To the point that I went "backwards" and wrote
| several reports and an academic paper in Sweave after using
| rmarkdown for years. My primary motivation was that I needed to
| know the documents could be built by any R session, not just
| from within RStudio. I didn't want to be in a situation where
| my "reproducible" document relied on a specific IDE to build
| correctly.
| phillc73 wrote:
| I'm all for finding alternatives to RStudio's dominance in
| the R space. No doubt they do some excellent things, but I
| also have a vague uneasiness at the cultishness surrounding
| some of their products. It sometimes feels like if you're not
| using the 'tidyverse', you're viewed as doing it wrong.
|
| Anyway, this feeling set me off on an exploration of
| alternative tools and packages. Instead of rmarkdown I'm now
| exploring the pander[1] package, which seems to do most of
| what I'm looking for, perhaps only a little limited in output
| formats.
|
| Edit: The Pandoc.brew examples might be most interesting from
| a direct alternative to rmarkdown for document creation
| context.[2]
|
| [1] http://rapporter.github.io/pander/
|
| [2] http://rapporter.github.io/pander/#examples
| vharuck wrote:
| Which parts don't work outside of R Studio for you? Is it
| something recent? I usually create my single-page and
| bookdown documents as one step in a separate R script, and
| haven't found any problems beyond the rmarkdown package's
| poor documentation (I really wish the R Studio developers
| would write in-package documentation with as much care as
| with their online documentation).
| mespe wrote:
| If I recall correctly, I had issues primarily with more
| complicated documents, and mostly due to some RStudio
| "project" and file path configuration issues - I would have
| to look to see what the specific issues were. Simple, one-
| file .Rmd docs are typically fine either way.
| [deleted]
| halfeatenpie wrote:
| I've always been a big fan of R Markdown. For me and my work,
| there's always been a fine line between R Markdown and R Shiny,
| with certain limitations (or something I felt was a limitation)
| in R Markdown could be overcome by building it in R Shiny.
| andylynch wrote:
| Very nice to see this here. R Markdown is a great tool on is own
| and working with it in RStudio is a superpower, plus the clean
| format is really nice in version control.
| kasperset wrote:
| This has been discussed before but I am watching the development
| of https://github.com/fonsp/Pluto.jl so that it can provide some
| solid alternative.
| phillc73 wrote:
| If you're interested in Pluto.jl, I recently saw an
| announcement about Neptune.jl[1], which appears to remove some
| of the reactive nature of Pluto. It's a fork of Pluto and
| executes code sequentially one cell at a time instead. An
| interesting read anyway and maybe worth trying.
|
| [1] https://github.com/compleathorseplayer/Neptune.jl
| tfehring wrote:
| Huh. I wonder what the impetus for that was and what the
| purported advantages over Jupyter are, since reactivity seems
| like the main value add of Pluto.jl - and a significant one
| at that.
| nojito wrote:
| Using RMarkdown effectively pretty much tripled my salary. It's
| an amazing tool that is wholly underappreciated in the "data"
| space.
| quantstats wrote:
| Could you expand on what you mean by using it effectively? I've
| just started using RStudio and any tips/ways to use it more
| efficiently are welcome! Thanks.
| ct0 wrote:
| I could imagine the time invested on making the same report
| in another language takes 3x.
| randomfool wrote:
| Plug that if you're a Jupyter user to chime in on the survey at
| https://www.surveymonkey.com/r/LCB7GBF.
|
| Background: https://blog.jupyter.org/survey-jupyterlab-and-
| beyond-88c7fb...
| RobinL wrote:
| As an occasional R user, I think R markdown one of the things
| that R does really well. For data scientists who want to output
| reports (mix of text and calculations), I haven't come across
| anything as mature or easy to use in the Python ecosystem. I'm a
| big user of Jupyter notebooks, but version control issues put me
| off, and I've never got to grips customising the formatting of
| jupyter nbconvert.
|
| It's worth highlighting that R Markdown actually supports a
| number of languages including Python - for instance see here:
| https://bookdown.org/yihui/rmarkdown/language-engines.html
|
| For example, I am currently considering using R markdown to
| author the documentation for one of my Python packages. Currently
| my documentation is written in markdown, but I keep having to
| copy and paste calculations and tables into the markdown. When
| things change, it would be nice to just be able to re-run the R
| markdown, converting Rmd -> md and thereby interpolating the
| latest version of all calculations into the final markdown doc.
| spinningslate wrote:
| I'd strongly agree with this. I use R Markdown with Python in
| the Rstudio IDE, and prefer it to Jupyter. The publishing
| pipeline is really flexible, e.g. with one-click deployment to
| RStudio Server [0] (which is a paid product).
|
| No affiliation to RStudio, just a happy customer.
|
| [0]: https://rstudio.com/products/rstudio/download-server/
| gpoore wrote:
| For the Python in markdown case, you might be interested in one
| of my projects that allows executable Python code (including
| optional Jupyter kernel support) in Pandoc markdown:
| https://github.com/gpoore/codebraid. Pandoc does all the
| document parsing (there is no regex preprocessor for extracting
| code), so converting markdown to markdown often works
| particularly well.
| [deleted]
___________________________________________________________________
(page generated 2021-02-03 23:00 UTC)