In this tutorial we will learn how to compute product of all elements of a column in a dataframe using tidyverse. We will use prod() function in base to multiple all elements of a columns. Let us first load tidyverse. We will create a simple dataframe using tidyverse’ tibble() with a column containing numbers from… Continue reading How to get product of all elements in a column
Category: R Function
How to Compute row means
In this tutorial, we will learn how to compute means of rows with tidyverse using dplyr package. We will see multiple examples to compute row means with dplyr. Wee will start with 3. examples of computing row means using rowMeans() and dplyr’s row-wise operations on a dataframe with no missing values. And then we will… Continue reading How to Compute row means
How to compute row means in R
In this tutorial, we will learn about rowMeans() function in base R and use it to calculate mean of all rows in a matrix or a dataframe. We will see two examples to understand the use rowMeans() function. First, we will calculate mean of all rows in a matrix and dataframe with no missing values… Continue reading How to compute row means in R
How to compute inverse of a matrix in R
In this tutorial, we will show how to compute inverse of matrix in R. Computing inverse of a matrix is core to multiple applications. In linear algebra, inverse of a matrix is defined as a matrix that, when multiplied by the original matrix, results in the identity matrix. In other words, if A is a… Continue reading How to compute inverse of a matrix in R
How to Measure Running Time in R (with two examples)
In this tutorial, we will learn how to measure execution time in R. We will learn two ways, using Sys.time() and system.time, of measuring execution time in R. Both the methods to measure running time are readily available in base R and do need use any outside R packages. Measuring Execution Time with Sys.time() We… Continue reading How to Measure Running Time in R (with two examples)