 ## R: Add a Column to Dataframe Based on Other Columns with dplyr

In this R tutorial, you are going to learn how to add a column to a dataframe based on values in other columns. Specifically, you will learn to create a new column using the mutate() function from the package dplyr, along with some other useful functions. Finally, we... ## How to use %in% in R: 7 Example Uses of the Operator

In this tutorial, you will learn by examples how to use the %in% in R. Specifically, you will learn 7 different uses of this great operator. Outline Here’s the outline of this post, described a bit more detailed than the table of contents. First, we start out with a... ## How to Transpose a Dataframe or Matrix in R with the t() Function

In this brief tutorial, you will learn how to transpose a dataframe or a matrix in R statistical programming environment. Transposing rows and columns is a quite simple task if your data is 2-dimensional (e.g., a matrix or a dataframe). If you have a, for example,... ## How to Generate a Sequence of Numbers in R with :, seq() and rep()

In this R tutorial, you will learn how to generate sequences of numbers in R. There are many reasons why we would want to generate sequences of numbers. For example, we may want to generate sequences when plotting the axes of figures or simulating data.  Outline... ## How to Extract Year from Date in R with Examples

In this R tutorial, you will learn how to extract year from datetime in R. You will learn by a couple of examples containing R code along with a description of the code. To know how to extract year from datetime may be needed when working with data containing datetime... ## How to Add an Empty Column to a Dataframe in R (with tibble)

In this short R tutorial, you will learn how to add an empty column to a dataframe in R. Specifically, you will learn 1) to add an empty column using base R, 2) add an empty column using the add_column function from the package tibble and we are going to use a pipe...