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...

 
 
 

20 Comments


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

I recently took a look at Play99exch, and I have to say, I was really impressed by how smooth and user-friendly the platform is. It’s a great fit for Indian users who love both sports betting and casino games. One of the things I appreciated the most was the straightforward payment process—Play99 Exch supports UPI and Paytm, making deposits super easy. The mobile version runs really well too, so you can play on the go without any hassle. Overall, Play 99 Exch seems like a reliable choice for anyone wanting to play with real money online.

To learn more visit : https://play99exch.net.in/


Like

ReddyBook is a great platform for online gaming and betting. I really enjoy the variety of games, smooth interface, and generous bonuses. The 400% welcome bonus and weekly cashback are awesome! It’s secure, easy to use, and the Reddy Book  makes it even more fun with tournaments and community features. Highly recommend!

To know more visit on:https://thereddybook.org/

Like

Step into the world of non-stop fun with Magic Win  your trusted online casino. Get fast access to your account using the secure Magic Win Login. With the user-friendly Magic Win App enjoy a live casino on your phone. Whether it’s Magic Win 247 or Magic Win Casino, the thrill never ends. Advanced interface, instant support, and Magic Win 360 bring the best gaming vibe.

Click here to explore: https://magicwinind.in/


Like
bottom of page