Code
install.packages("rmarkdown", dep = TRUE)
R
also has a vibrant ecosystem of tools and packages that extend its capabilities. In this part, we will provide an introduction to some of the most popular tools and packages in the R
ecosystem, including RMarkdown
, Quarto
, Shiny
, and the creation of your own R
package.
rmarkdown
is a popular tool for creating dynamic reports and presentations using R
code. With rmarkdown
, you can embed R code and its output into a document, along with text, tables, and figures. rmarkdown
allows you to create reports and presentations in a variety of formats, including HTML, PDF, and Microsoft Word.
rmarkdown
documents are written in a markup language that is similar to HTML, called Markdown. rmarkdown
documents can include R code chunks, which are enclosed in backticks (```) and contain R code that is evaluated when the document is rendered. RMarkdown also supports a variety of formatting options, such as headings, lists, and tables.
install.packages("rmarkdown", dep = TRUE)
Note if you want to generate PDFs you will also need to install tinytex
install.packages("tinytex")
tinytex::install_tinytex() # install TinyTeX
Additional details on tinytex
can be found on https://yihui.org/tinytex/
quarto
is a new document format that builds on the features of RMarkdown, while also offering enhanced capabilities. Quarto documents can include R code chunks, as well as code from other programming languages, such as Python and Julia. Quarto also offers a variety of document output formats, including HTML, PDF, and Microsoft Word.
One of the key features of Quarto is its support for literate programming, which allows you to write code that is both executable and human-readable. Quarto documents can also include inline code snippets, which allow you to embed short snippets of code directly into the text of your document.
Note that quarto
must be downloaded independently first with https://quarto.org/docs/download/, and, additionally, if you want it to interface with R
efficiently then you will need to install quarto
within the R
enviroment:
install.packages('quarto')
Traditional RMarkdown (.Rmd) files will work just as well with Quarto (.qmd) as they do with RMarkdown, perhaps only requiring minor adjustments including perhaps only requiring a file rename from x.Rmd
to x.qmd
. I can attest to this personally in the development of this text.
shiny
is a web application framework for R
that allows you to create interactive web applications using R
code. With Shiny, you can create custom dashboards, data visualizations, and other web-based tools that allow users to interact with data in real-time. Shiny applications can be used for a wide range of purposes, from data analysis and visualization to predictive modeling and machine learning.
Shiny is built on top of R
, and allows you to use your existing R
code to create web applications. One of the key features of Shiny is its reactive programming model, which allows you to create web applications that update in real-time based on user input.
You can install shiny with this command:
install.packages('shiny')
R
Packages are collections of functions, data, and other resources that extend the capabilities of R. R Packages are an essential part of the R
ecosystem, and they allow you to easily share your own code and resources with others. R Packages can be installed and loaded using the install.packages()
and library()
functions, respectively.
R
Packages can be used to perform a wide range of tasks, including data analysis, data visualization, and data manipulation. Many R
Packages are available on CRAN, the Comprehensive R
Archive Network, while others are available on GitHub and other sources.
In summary, RMarkdown, Quarto, Shiny, and R Packages are some of the most popular tools and packages in the R ecosystem. They offer a wide range of capabilities for communicating and sharing your results in a reproducible fashion.
Git is a powerful version control system that allows you to manage changes to your code over time. It was first created in 2005 by Linus Torvalds, the creator of Linux, and has since become one of the most popular version control systems in use today.
Git provides a number of key benefits for developers, including the ability to track changes to their code, collaborate with other developers, and easily revert to previous versions if something goes wrong. With Git, you can also work on different features or parts of your code in parallel without interfering with each other’s work.
Git works by creating a snapshot of your code at each point in time, and then storing those snapshots in a version history. This allows you to see the changes that have been made to your code over time, and revert to a previous version if necessary. Git also allows you to branch your code, which creates a copy of your code that you can make changes to without affecting the original version. This makes it easy to work on new features or bug fixes without disrupting the main code.
There are a number of different tools available for working with Git, including graphical user interfaces like GitHub Desktop, and command-line tools like Git Bash. Git can be used with a wide range of programming languages, including R, Python, and JavaScript, and is widely used in software development, data science, and other fields where version control is important.
Overall, Git is a powerful tool that can help you manage changes to your code more effectively, collaborate with other developers, and ensure that your code is always up to date and running smoothly. Whether you’re working on a small personal project or a large-scale software development effort, Git is an essential tool to have in your toolkit.