In Part 14, let’s see how to create pie charts in R. Let’s create a simple pie chart using the pie() command. As always, we set up a vector of numbers and then we plot them. B <- c(2, 4, 5, 7, 12, 14, 16) Create a simple pie chart. pie(B) Now let’s create a …

# Month: June 2018

In Part 13, let’s see how to create boxplots in R. Let’s create a simple boxplot using the boxplot() command, which is easy to use. First, we set up a vector of numbers and then we plot them. Boxplots can be created for individual variables or for variables by group. The syntax is boxplot(x, data=), …

In Part 12, let’s see how to create histograms in R. Let’s create a simple histogram using the hist() command, which is easy to use, but actually quite sophisticated. First, we set up a vector of numbers and then we create a histogram. B <- c(2, 4, 5, 7, 12, 14, 16) hist(B) That was …

In Part 11, let’s see how to create bar charts in R. Let’s create a simple bar chart using the barplot() command, which is easy to use. First, we set up a vector of numbers. Then we count them using the table() command, and then we plot them. The table() command creates a simple table …

In Part 10, let’s look at the aggregate() command for creating summary tables using R. You may have a complex dataset that includes categorical variables of several levels, and you may wish to create summary tables for each level of the categorical variable. For example, your dataset may include the variable Gender, a two-level categorical …

In this post, we will show on a simple example the application of a recursive function. The problem that we want to solve is the following. We have a matrix of dimensions N x M. This can be, for example, a two-dimensional contingency table. Columns that have a mean value less than the set value …

In Part 9, let’s look at sub-setting in R. Let’s provide summary tables on the following data set of tourists from different countries, the numbers of their children, and the amount of money they spent while on vacation. Copy and paste the following array into R. A <- structure(list(NATION = structure(c(3L, 3L, 3L, 3L, 1L, …