rowmeans.n: Get Row Means With N Missing Values Per Row

View source: R/rowmeans.R

rowmeans.nR Documentation

Get Row Means With N Missing Values Per Row

Description

Does what furniture::rowmeans() does while allowing a certain number (n) to have missing values.

Usage

rowmeans.n(..., n)

Arguments

...

the variables (unquoted) to be included in the row means

n

the number of values without missingness required to get the row mean

Value

the row means

Examples


## Not run: 

library(furniture)
library(dplyr)

data <- data.frame(
  x = sample(c(1,2,3,4), 100, replace=TRUE),
  y = rnorm(100),
  z = rnorm(100)
)

data2 <- mutate(data, x_y_z_mean = rowmeans.n(x, y, z, n = 2))


## End(Not run)


TysonStanley/furniture documentation built on Feb. 15, 2024, 11:40 p.m.