**View:**

**Sorted by:**

### How to Use Apply to Create Tabular Summaries in R

You use tapply() to create tabular summaries of data in R. With tapply(), you can easily create summaries of subgroups in data. This function takes three arguments: [more…]

### How to Create a Bar Chart Using ggplot2 in R

To make a bar chart with ggplot2 in R, you use the geom_bar() function. However, note that the default stat is stat_bin(), which is used to cut your data into bins. Thus, the default behavior of [more…]

### How to Find Minimum or Maximum Values for Functions in R

A very large body of mathematics aims to solve optimization problems of all kinds. In R, the optimize() function provides one fairly simple mechanism for optimizing functions. [more…]

### How to Install and Load CRAN Packages in R

To install a CRAN package in R, use the install.packages() function. This simple command downloads the package from a specified repository (by default, CRAN) and installs it on your machine: [more…]

### How to Unload CRAN Packages in R

By loading a package, R first loads the package and then attaches the package and to your search path, which you can see as an internal database that tells R where to find functions and objects. Whenever [more…]

### How to Make Scatterplot and Line Charts in R with ggplot2

If you have downloaded and imported ggplot2 for use in your R installation, you can use it to plot your data. To create a scatterplot, you use the geom_point [more…]

### How to Plot Summarized Data in a ggplot2 in R

One very convenient feature of ggplot2is its range of functions to summarize your R data in the plot. This means that you often don’t have to pre-summarize your data. For example, the height of bars in [more…]

### How to Work with Scales in a ggplot2 in R

In ggplot2 in R, scales control the way your data gets mapped to your geom. In this way, your data is mapped to something you can see (for example, lines, points, colors, position, or shapes). [more…]

### How to Add Row and Column Totals in R

One task that you may frequently do in a spreadsheet that you can also do in R is calculating row or column totals. The easiest way to do this is to use the functions [more…]

### How to Format Numbers in R

When you produce reports in R, you will want your numbers to appear all nicely formatted to enhance the impact of your data on the viewer. You can use [more…]

### How to Use CRAN to Find R Code and Packages

The Comprehensive R Archive Network CRANis a network of web servers around the world where you can find the R source code, R manuals and documentation, and contributed packages. [more…]

### How to Install R

You can find the installation files and all necessary information regarding installation on one of the mirror sites of the Comprehensive R Archive Network [more…]