background preloader

RStudio-Packages

Facebook Twitter

Customizing RStudio. Overview RStudio options are accessible from the Options dialog Tools > Options menu (RStudio > Preferences on a Mac) and include the following categories: Details on the various settings are provided in the sections below.

Customizing RStudio

General R Options Default working directory — Startup directory for RStudio (when not in a project). The initial .RData and .Rprofile files (if any) will be read from this directory. Source Code: Editing Source Code: Display Source Code: Completion Source Code: Diagnostics Appearance and Themes Editor font — Customize the font for panes which display code (Console, Source, History, and Workspace).Font size — Set the font size (in points) for panes which display code (Console, Source, History, and Workspace).Editor theme — Specify the visual theme for the Console and Source panes.

Pane Layout Specify the location and tab sets of panes within RStudio.Each of the 4 panes is always displayed (it isn't currently possible to hide a pane). Quick list of useful R packages. Many useful R function come in packages, free libraries of code written by R's active user community.

Quick list of useful R packages

To install an R package, open an R session and type at the command line install.packages("<the package's name>") R will download the package from CRAN, so you'll need to be connected to the internet. R Markdown — Dynamic Documents for R. Package shiny. Knitr: Elegant, flexible and fast dynamic report generation with R. Overview The knitr package was designed to be a transparent engine for dynamic report generation with R, solve some long-standing problems in Sweave, and combine features in other add-on packages into one package (knitr ≈ Sweave + cacheSweave + pgfSweave + weaver + animation::saveLatex + R2HTML::RweaveHTML + highlight::HighlightWeaveLatex + 0.2 * brew + 0.1 * SweaveListingUtils + more).

knitr: Elegant, flexible and fast dynamic report generation with R

This package is developed on GitHub; for installation instructions and FAQ's, see README. This website serves as the full documentation of knitr, and you can find the main manual, the graphics manual and other demos / examples here. For a more organized reference, see the knitr book. Motivation One of the difficulties with extending Sweave is we have to copy a large amount of code from the utils package (the file SweaveDrivers.R has more than 700 lines of R code), and this is what the two packages mentioned above have done. Features Acknowledgements. Ggplot2. Mikeaddison93/devtools. Mikeaddison93/devtools. Package magrittr. Packrat: Reproducible package management for R. Packrat: Reproducible package management for R. Introduction to stringr. Strings are not glamorous, high-profile components of R, but they do play a big role in many data cleaning and preparations tasks.

Introduction to stringr

R provides a solid set of string operations, but because they have grown organically over time, they can be inconsistent and a little hard to learn. Additionally, they lag behind the string operations in other programming languages, so that some things that are easy to do in languages like Ruby or Python are rather hard to do in R. The stringr package aims to remedy these problems by providing a clean, modern interface to common string operations. More concretely, stringr: Simplifies string operations by eliminating options that you don’t need 95% of the time (the other 5% of the time you can functions from base R or stringi).Uses consistent function names and arguments.Produces outputs than can easily be used as inputs.

To meet these goals, stringr provides two basic families of functions: These are described in more detail in the following sections. Mikeaddison93/dplyr. Mikeaddison93/haven. Leaflet for R - Introduction. Leaflet is one of the most popular open-source JavaScript libraries for interactive maps.

Leaflet for R - Introduction

It’s used by websites ranging from The New York Times and The Washington Post to GitHub and Flickr, as well as GIS specialists like OpenStreetMap, Mapbox, and CartoDB. This R package makes it easy to integrate and control Leaflet maps in R. Features Interactive panning/zoomingCompose maps using arbitrary combinations of: Map tilesMarkersPolygonsLinesPopupsGeoJSONCreate maps right from the R console or RStudioEmbed maps in knitr/R Markdown documents and Shiny appsEasily render Spatial objects from the sp package, or data frames with latitude/longitude columnsUse map bounds and mouse events to drive Shiny logic Installation To install this R package, run this command at your R prompt: install.packages("leaflet") Once installed, you can use this package at the R console, within R Markdown documents, and within Shiny applications. Basic Usage. DT: An R interface to the DataTables library. DT: An R interface to the DataTables library. Ggvis 0.4 overview. Mikeaddison93/testthat.

Shiny Dashboard. Introduction to roxygen2. Documentation is one of the most important aspects of good code.

Introduction to roxygen2

Without it, users won’t know how to use your package, and are unlikely to do so. Documentation is also useful for you in the future (so you remember what the heck you were thinking!) , and for other developers working on your package. The goal of roxygen2 is to make documenting your code as easy as possible. R provides a standard way of documenting packages: you write .Rd files in the man/ directory. Code and documentation are adjacent so when you modify your code, it’s easy to remember that you need to update the documentation.Roxygen2 dynamically inspects the objects that it’s documenting, so it can automatically add data that you’d otherwise have to write by hand.It abstracts over the differences in documenting S3 and S4 methods, generics and classes so you need to learn fewer details.

As well as generating .Rd files, roxygen will also create a NAMESPACE for you, and will manage the Collate field in DESCRIPTION.