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 … [Read more...] about Computing Correlation with R
dplyr between(): find if numerical values are within a range.
In this tutorial we will learn how to use dplyr's between() function to find if one or more numerical values are in a range using multiple examples. We will first start with a single numeric value and find out if it is within a range. And then in the next example, we will use a … [Read more...] about dplyr between(): find if numerical values are within a range.
How to Randomly Replace Values of Numerical Columns in a dataframe to NAs
In this tutorial, we will learn how to randomly replace values of numerical columns in a dataframe to NAs or missing values. We will use dplyr's across() function to select only the numerical columns from a dataframe and probabilistically select certain percent of elements to … [Read more...] about How to Randomly Replace Values of Numerical Columns in a dataframe to NAs
How to Randomly Replace Values in a Matrix to NAs
In this tutorial, we will see how to randomly replace values in a matrix to NAs, missing values. We will first create some data matrix by simulation. Here we create a matrix with 20 rows and 5 columns. The data matrix is complete without any missing values. To … [Read more...] about How to Randomly Replace Values in a Matrix to NAs
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 … [Read more...] about seq() function to create sequences