Travis build status AppVeyor Build Status Coverage status

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-"
)

talkr Package:

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.

Installation

You can install talkr from GitHub with:

# install.packages("remotes")
remotes::install_github("muschellij2/talkr")

Example

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]])

Shiny Example

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")


muschellij2/talkr documentation built on Jan. 20, 2020, 7:49 p.m.