top of page

Document Preparation... in R?

  • Writer: CANA
    CANA
  • Sep 2, 2016
  • 2 min read

Updated: Sep 13, 2022


R-Markdown

R Markdown

I've gone a little bit off the 'deep end' when it comes to programming in R recently. I was turned on to Markdown a few months ago by a friend, but haven't really had time to play with it. Until now. The builders of Markdown at RStudio have a technical explanation of Markdown; but to me, it is: A tool that brings word processing functions to a level playing field with the analysis and graphics already resident in R.

Ok, sounds cool - why would anyone want that?

When I start an analysis project, I'm a madman (sorry, colleagues). I write code like a fiend and have datasets with names like: TF, TFNZ, TFD, TFD2, TFDD, TotalMassRetain, SiberianKhatru, and so on. At some point, the mania of the beginning of the project settles down, and there are three things I have to do.

Tasks: 1. Write Stable, usable code. Note: 'Usable' means 'Usable by someone other than me' 2. Write a report 3. Produce professional graphics, export, save, reformat, import, resize, etc.

R-Markdown Old vs New

This is how using Markdown compares with my previous production method. Three disparate tasks are now combined into one, consolidated task.

Markdown puts the code in the document. It's hard to think of a better, more stable way to save code. Chunks of code are inside the document (and can be easily cross-ported using the <- To Console function of the History window in RStudio). This is especially useful when importing graphics, because they are automatically created and rendered in the destination format. Markdown can render (or knit) to Word, HTML, or LaTeX. And, if the data changes, the report changes as well.

A very quick drive The RStudio example uses the mtcars dataset that comes standard in R::Base. Here, I'm going to play with the 'Old Faithful' dataset, which can be accessed by the command data ("faithful"). We can compute a summary of the data in the following chunk of code:

{R tableEX, echo = FALSE} faithful %>% summary() %>% kable()

eruption waiting table

We can also make nice looking graphs using ggplot2:

eruptions wait time plotted

Eruptions and Waiting Time for Old Faithful

We can even do linear regression inside Markdown:

Two final thoughts 1. If wanted to repeat analysis with different data, I would only have to change one line of code. 2. This document was written in R Markdown.

Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

 
 
 

Recent Posts

See All
CANA, CRATE, and the chatbot

CANA has always encouraged its team members to think outside the box and test new ideas. A recent CANA CRATE project perfectly...

 
 
 

23 Comments


Getting started on Sky Exchange was simple, and I liked how fast my Sky Exchange ID got approved. With that ID, I could dive straight into live sports and casino games without delays. The whole setup feels professional and user-friendly.

To learn more visit : https://skyeexchange.org.in/


Like

I recently started using Cricbet99 and I’m genuinely impressed with how smooth the platform feels. The registration process was quick, and I was able to dive into matches without delay. The Cricbet99 App is really well-designed—it makes betting on the go simple and convenient. I especially enjoy the variety of options available in Cricbet99 Betting, from live cricket to other sports. The site feels secure, the odds are updated fast, and withdrawals are hassle-free. Overall, it’s one of the best experiences I’ve had in online betting.

To know more visit: https://cricbet99game.in/


Like

Fairplay is India’s top choice for online gaming and fantasy sports. With Fairplay Online and the Fairplay App, enjoy live sports betting, casino games, and fantasy leagues with instant withdrawals. Join the Fairplay Club in India for secure, real-time betting on cricket, football, tennis, and more. Play fair, win big with Fairplay!

Like

I’ve explored a handful of gaming platforms, but Sky Exchange really shines with its real-time updates and an impressive variety of games. The sky exchange login area is not only secure but also seamlessly integrated, giving you quick access to all the features and betting markets. And let’s not forget the enticing welcome bonuses and ongoing cashback offers that make the experience even more rewarding. If you’re on the hunt for a professional yet user-friendly betting site, look no further!

To learn more visit : https://skyexchangein.in/


Like

I've played a bunch of online games, but the aviator game really stands out to me. With its user-friendly navigation and thrilling rounds, it never gets dull.The aviator game login gives quick access to live rounds and exciting multipliers. Plus, the live crash stats and auto cash-out features add a whole new layer of strategy. You did a fantastic job explaining it here!

To learn more, visit: https://aviatorgame.solutions/


Like
bottom of page