![]() But the true power of R Markdown is when you transform that text and code into a stand-alone document. What you see now is the raw R Markdown content, which contains chunks of R code between chunks of regular text with Markdown formatting. There’s no real need to include this, so we’ll delete it for now. This sets a bunch of code chunk parameters for the rest of the document. The next section shows a code chunk that says “r setup”. We’ll come back to this header section later. At the top, in between the boundary lines ( -), you’ll see a list of document parameters that should reflect what you entered in the previous window (title, author, output). You’ll now have a new document that is filled in with a bunch of example content. We’re going to choose HTML for now, since that’s the simplest option and all you really need. You can choose between HTML, PDF, and Word. Then a new window will pop up where you can fill out the title of your new document, the author (um, your name? □), and the output format. The first thing you’ll do after opening RStudio is go to File » New File » R Markdown. Now that you have the basic software and packages installed, you can get started with using R Markdown! You’ll only need to do this once for your computer (at least until the next time you update R). To do that you can run install.packages("rmarkdown") and install.packages("knitr"). You’ll also have to install two packages: rmarkdown and knitr. These resources show you how to get started with R and RStudio. If you need help with that, you can check out my blog post and lessons one, two, and three of my online course. To use R Markdown, you’ll need to have R and RStudio already installed. I’ll cover the rest of the video in part two next week. This post covers material in the video up to 35:35. You can also follow along with this blog post in video format if you click on the image below. Here, you’ll learn how to create R Markdown documents with different types of content, and in part two I’ll go into how you can use it for learning R. This tutorial is the first post of a two-part series on R Markdown. It allows you to make tutorials like this oneįinally, you can use it for learning R by helping you keep track of your notes and thinking process all while creating a custom reference document (more on this in part two!) ![]() It helps with accountability, because all your code and the exact corresponding outputs are knit together into the final document It’s great for reproducibility, where you can explain your analyses alongside your code and output so someone can follow along and replicate your work R Markdown is useful for several reasons:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |