rowsums: Get Row Sums

Description Usage Arguments Value Examples

View source: R/rowmeans.R

Description

Does what rowSums() does but without having to cbind the variables. Makes it easier to use with the tidyverse

Usage

1
rowsums(..., na.rm = FALSE)

Arguments

...

the variables to be included in the row sums

na.rm

should the missing values be ignored? default is FALSE

Value

the row sums

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Not run: 

library(furniture)
library(tidyverse)

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

data2 <- data %>%
  mutate(y_z_sum = rowsums(y, z))
data2 <- data %>%
  mutate(y_z_sum = rowsums(y, z, na.rm=TRUE))


## End(Not run)

furniture documentation built on Feb. 22, 2021, 9:08 a.m.