Variance or other calculation across columns in R

Here is how to calculate variance across columns in the R data frame. The same technique can be useful in other situations. Like in this other example. Get a count of NA values for each of the columns in the R data frame.

Running, moving, rolling average in R, dplyr

You can calculate the moving average (also called a running or rolling average) in different ways by using R packages.

Move column to a specific position in R

The easiest way to move the data frame column to a specific position in R is by using the function relocate from package dplyr.

Find min or max for each row in R

If you want to calculate min or max for a range of columns in each row of the data frame in R, then here is how to do that easily.

Exit mobile version