In this tutorial, we will learn how to compute correlation between two numerical variables in R using cor() function available in base R. Correlation between two numerical variables can range from -1 to +1, where -ve values suggest these two variables negatively correlated and positive value suggest that the variables are positively correlated. When there… Continue reading Computing Correlation with R
Category: R Function
seq() function to create sequences
seq() function in R is one of the base R functions that is useful in creating sequences. In this tutorial, we will see multiple examples of creating sequence of numbers using seq() function. FIrst let us start with the simplest example of using seq() function. If you give a number as argument to seq() function,… Continue reading seq() function to create sequences
How to Generate Random Numbers from Uniform Distribution
In this tutorial, we will learn how to simulate or generate random numbers from uniform distribution. In R, with the in-built function runif() we can generate uniform random numbers. The basic usage of runif() function looks like this where n refers to the number of random numbers we need and min/max is the interval of… Continue reading How to Generate Random Numbers from Uniform Distribution
How to create a directory if it does not exist in R
In this tutorial we will learn how to create a directory if it does not exist already using R. We will be using two base R functions, one of checking if a directory exists and the other for creating a directory. If a directory exists already we would not be creating it and if the… Continue reading How to create a directory if it does not exist in R
dplyr ends_with(): select columns that end with a suffix
In this tutorial, we will learn how to select columns that ends with a string with multiple examples using dplyr and base R. With dplyr, we can use ends_with(), one of the select helper functions, to select columns that ends with a prefix/string. Similarly, in base R we have endsWith() function to help select column… Continue reading dplyr ends_with(): select columns that end with a suffix