Description Usage Arguments Value Examples
Talk to ggplot a Data set
1 2 3 4 5 | talk_ggplot(.data, cmd, verbose = FALSE, ...)
talk_ggplot_expr(data_colnames, cmd, allowed_words = talk_ggplot_words(), ...)
talk_process_ggplot_cmd(cmd)
|
.data |
The data set/ |
cmd |
Command to perform on the data set. |
verbose |
print diagnostic output |
... |
additional arguments to pass to |
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 19 20 21 22 23 24 25 26 27 28 29 30 31 | library(tibble)
library(dplyr)
df = mtcars %>%
rownames_to_column(var = "car")
cmds = c(
"ggplot by mpg",
"ggplot by column mpg ",
"plot mpg filled with gear",
"ggplot by column 5 and column 4",
"ggplot a histogram of mpg, coloured by gear",
"ggplot columns 4 and 5",
# duplciate
"ggplot by mpg coloured by gear")
data_colnames = df
.data = df
allowed_words = talkr:::talk_ggplot_words()
cmd = c(
"ggplot by mpg coloured by gear",
"ggplot a histogram of mpg, coloured by gear",
"ggplot a histogram of mpg, facetted by gear")
results = lapply(cmds, talk_ggplot_expr, data_colnames = df)
results = lapply(cmds, talk_ggplot, .data = df)
cmd = "ggplot by columns 2 and 5"
cmd = "ggplot MPG faceted by gear"
testthat::expect_silent(talk_ggplot(.data, cmd))
df = df %>%
rename(GEAR = gear)
gear = df %>%
talk_ggplot("ggplot by gear and column 3")
print(gear)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.