**View:**

**Sorted by:**

### 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…]

### How to Calculate the Margin of Error for a Sample Mean

When a research question asks you to find a statistical *sample mean* (or average), you need to report a margin of error, or MOE, for the sample mean. The general formula for the margin of error for the [more…]

### How to Find Percentiles for a *t*-Distribution

When you want to find percentiles for a *t*-distribution, you can use the *t*-table. A *percentile* is a number on a statistical distribution whose less-than probability is the given percentage; for example, [more…]

### How to Find *t**-Values for Confidence Intervals

*Confidence intervals* estimate population parameters, such as the population mean, by using a statistic (for example, the sample mean) plus or minus a margin of error. To compute the margin of error for [more…]

### How to Identify a Sampling Distribution

In statistics, a sampling distribution is based on sample averages rather than individual outcomes. This makes it different from a distribution. Here’s why: A [more…]

### How Sample Size Affects Standard Error

Standard error is inversely affected by the size, *n**,* of a statistical sample. Because *n* is in the denominator of the standard error formula, the standard error decreases as [more…]

### How Population Standard Deviation Affects Standard Error

In statistics, an important component of standard error involves the amount of variability in the population (measured by standard deviation). In the standard error formula [more…]

### How Sample Size Affects Standard Error

The size (*n*) of a statistical sample affects the standard error for that sample. Because *n* is in the denominator of the standard error formula, the standard error decreases as [more…]

### How Population Standard Deviation Affects Standard Error

In statistics, the standard deviation in a population affects the standard error for that population. Standard deviation measures the amount of variation in a population. In the standard error formula [more…]

### How a Normal Distribution Affects the Shape of a Sampling Distribution

In statistics, when the original distribution for a population *X* is normal, then you can also assume that the shape of the sampling distribution, or [more…]

### How a Sampling Distribution Is Affected When the Distribution Is Not Normal

In statistics, if a population *X* has any distribution that is *not* normal, or if its distribution is unknown, you can’t automatically say the distribution of the sample means [more…]

### How to Find the Sampling Distribution of a Sample Proportion

If you use a large enough statistical sample size, you can apply the Central Limit Theorem (CLT) to a sample proportion for categorical data to find its sampling distribution. The [more…]

### How to Find Probabilities for a Sample Proportion

You can find probabilities for a sample proportion by using the normal approximation as long as certain conditions are met. For example, say that a statistical study claims that 0.38 or 38% of all the [more…]

### What the Margin of Error Tells You About a Statistical Sample

If you read statistical survey results without knowing the margin of error, or MOE, you are only getting part of the story. Survey results themselves (with no MOE) are only a measure of how the [more…]

### How to Calculate the Margin of Error for a Sample Proportion

When you report the results of a statistical survey, you need to include the margin of error. The general formula for the margin of error for a sample proportion [more…]