knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-" )
The goal of talkr
is to provide use natural language commands to talk through data analysis using dplyr
. Currently, natural language processing is not used but a simple grammar.
You can install talkr
from GitHub with:
# install.packages("remotes") remotes::install_github("muschellij2/talkr")
We will pass in a command to sort the data set.
library(talkr) library(tibble) library(dplyr) df = tibble::rownames_to_column(mtcars, var = "car") is.unsorted(df$mpg) res = df %>% talk("Sort df by mpg") is.unsorted(res$mpg)
If you do not specify the order, it assumes ascending, as dplyr::arrange
does:
cmds = c( "Sort by mpg ascending and hp decreasing", "Sort by mpg and hp decreasing") res = lapply(cmds, talk_arrange, .data = df) all.equal(res[[1]], res[[2]])
Here is a Shiny app based on https://github.com/yihui/shiny-apps/tree/master/voice, which has an app here: https://yihui.shinyapps.io/voice/. This uses the annyang
API: https://github.com/TalAter/annyang. See a live demo at https://jhubiostatistics.shinyapps.io/Speak_dplyr/
talk_shiny_example("sort_better")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.