count_ifs: Counts the occurences of the rows

Description Usage Arguments Value Author(s) See Also Examples

Description

This function counts the rows that match the given conditions

Usage

1
count_ifs(df, ..., .group = NULL, .wt = NULL, .sort = FALSE)

Arguments

df

The tibble or dataframe to count

...

The conditions to test the tibble (df)

.group

How to group the data when counting, if NULL it will use tally instead

Currently not working

.wt

The weight to pass to count or tally

.sort

The sort to pass to count or tally

Value

A vector of values in the order of .order or just a single value if order is NULL

Author(s)

zekrom_vale

See Also

count_when for using str_detect to test a vector

count_if for using conditions to test a vector

count_if for counting using a dataframe or tibble, this has access to all columns

regex

str_detect

Examples

1
2
3
4
5
6
count_ifs(band_instruments, name=="John")
# 1
count_ifs(band_instruments, name=="Keith"|str_detect(name,"(?i)Pa"))
# 2
count_ifs(band_instruments, name=="Keith"|name=="Paul")
# 2

zekrom-vale/zUtil.R documentation built on June 2, 2019, 10:57 p.m.