Description Usage Arguments Value Examples
View source: R/zzz_talk_count.R
Talk to Count a Data set
1 2 3 4 5 6 7 | talk_count(.data, cmd, verbose = FALSE, ...)
talk_add_count(.data, cmd, verbose = FALSE, ...)
talk_counter(.data, cmd, verbose = FALSE, add = FALSE, ...)
talk_count_expr(data_colnames, cmd, allowed_words = "", ...)
|
.data |
The data set/ |
cmd |
Command to perform on the data set. |
verbose |
print diagnostic output |
... |
additional arguments to pass to |
add |
argument not for general use, but passed down to
allow for switching between |
data_colnames |
column names of the data |
allowed_words |
words allowed to be in the command other than the column names |
A data.frame
or list of them if length(cmds) > 1
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | library(tibble)
library(dplyr)
df = mtcars %>%
rownames_to_column(var = "car")
cmds = c(
"count by mpg",
"count up mpg, hp",
"count up mpg, hp, mpg")
data_colnames = df
.data = df
results = lapply(cmds, talk_count, .data = df)
df = df %>%
rename(GEAR = gear)
data_colnames = df
cmd = "count by gear "
gear = df %>%
talk_count("count by gear ")
testthat::expect_true(all(colnames(gear) == c("GEAR", "n")))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.