mean_n: SPSS Style Means

Description Usage Arguments Value See Also Examples

View source: R/mean_n.R

Description

mean_n returns the row-wise average of a series of vectors. The n argument indicates the minimimum number of items a particpant should have responded to in order to be given an average.

Usage

1
mean_n(df, n)

Arguments

df

An R dataframe object

n

Minimum number of items with valid responses

Value

A vector of type numeric.

See Also

scoring

Examples

1
2
3
4
5
6
7
## Not run: 
set.seed(77)
x <- data.frame(matrix(rnorm(n = 50), ncol = 5))
x[1,1:4] <- NA
mean_n(x, n = 2)

## End(Not run)

mattsigal/mmisc documentation built on May 21, 2019, 1:26 p.m.