diff --git a/.Rbuildignore b/.Rbuildignore index 74111ec..24a5c7d 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -3,6 +3,4 @@ ^LICENSE\.md$ ^\.github$ sonar.project.properties -^working_example.R - -notepad.R +CITATION.cff diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index e834665..f4748d2 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -31,7 +31,7 @@ jobs: R_KEEP_PKG_SOURCE: yes steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: r-lib/actions/setup-pandoc@v2 diff --git a/.gitignore b/.gitignore index 1081ce1..ae9dafe 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,7 @@ inst/doc *.wav .DS_Store -notepad.R + +## Build and check files +*.tar.gz +*Rcheck diff --git a/DESCRIPTION b/DESCRIPTION index 0bca9c7..76cc671 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,11 +1,12 @@ Package: talkr Type: Package -Title: Plotting conversation data +Title: Plotting Conversation Data Version: 0.1.0 Authors@R: c( person("Mark", "Dingemanse", email = "mark.dingemanse@ru.nl", role = c("aut", "cre")), - person("Barbara", "Vreede", email = "b.vreede@esciencecenter.nl", role = "aut"), + person("Barbara", "Vreede", email = "b.vreede@gmail.com", role = "aut"), person("Eva", "Viviani", email = "e.viviani@esciencecenter.nl", role = "aut"), + person("Pablo", "Rodríguez-Sánchez", email = "p.rodriguez-sanchez@esciencecenter.nl", role = "aut"), person("Andreas", "Liesenfeld", email = "andreas.liesenfeld@ru.nl", role = "ctb"), person("Netherlands eScience Center", role = c("cph", "fnd")) ) @@ -13,12 +14,8 @@ Description: Functions to plot elements of conversations. License: Apache License (>= 2) Encoding: UTF-8 LazyData: true -Suggests: - devtools, - rmarkdown, - testthat (>= 3.0.0) VignetteBuilder: knitr -RoxygenNote: 7.2.3 +RoxygenNote: 7.3.2 Depends: R (>= 3.5.0) Imports: @@ -35,4 +32,9 @@ Imports: tidyselect, tibble, viridis +Suggests: + rmarkdown, + testthat (>= 3.0.0), + ifadv +Remotes: git::https://github.com/elpaco-escience/ifadv.git Config/testthat/edition: 3 diff --git a/man/geom_token.Rd b/man/geom_token.Rd index faca110..dccb59e 100644 --- a/man/geom_token.Rd +++ b/man/geom_token.Rd @@ -23,20 +23,59 @@ geom_token( at the top level of the plot. You must supply \code{mapping} if there is no plot mapping.} -\item{stat}{The statistical transformation to use on the data for this -layer, either as a \code{ggproto} \code{Geom} subclass or as a string naming the -stat stripped of the \code{stat_} prefix (e.g. \code{"count"} rather than -\code{"stat_count"})} +\item{stat}{The statistical transformation to use on the data for this layer. +When using a \verb{geom_*()} function to construct a layer, the \code{stat} +argument can be used the override the default coupling between geoms and +stats. The \code{stat} argument accepts the following: +\itemize{ +\item A \code{Stat} ggproto subclass, for example \code{StatCount}. +\item A string naming the stat. To give the stat as a string, strip the +function name of the \code{stat_} prefix. For example, to use \code{stat_count()}, +give the stat as \code{"count"}. +\item For more information and other ways to specify the stat, see the +\link[ggplot2:layer_stats]{layer stat} documentation. +}} -\item{position}{Position adjustment, either as a string naming the adjustment -(e.g. \code{"jitter"} to use \code{position_jitter}), or the result of a call to a -position adjustment function. Use the latter if you need to change the -settings of the adjustment.} +\item{position}{A position adjustment to use on the data for this layer. This +can be used in various ways, including to prevent overplotting and +improving the display. The \code{position} argument accepts the following: +\itemize{ +\item The result of calling a position function, such as \code{position_jitter()}. +This method allows for passing extra arguments to the position. +\item A string naming the position adjustment. To give the position as a +string, strip the function name of the \code{position_} prefix. For example, +to use \code{position_jitter()}, give the position as \code{"jitter"}. +\item For more information and other ways to specify the position, see the +\link[ggplot2:layer_positions]{layer position} documentation. +}} -\item{...}{Other arguments passed on to \code{\link[ggplot2:layer]{layer()}}. These are -often aesthetics, used to set an aesthetic to a fixed value, like -\code{colour = "red"} or \code{size = 3}. They may also be parameters -to the paired geom/stat.} +\item{...}{Other arguments passed on to \code{\link[ggplot2:layer]{layer()}}'s \code{params} argument. These +arguments broadly fall into one of 4 categories below. Notably, further +arguments to the \code{position} argument, or aesthetics that are required +can \emph{not} be passed through \code{...}. Unknown arguments that are not part +of the 4 categories below are ignored. +\itemize{ +\item Static aesthetics that are not mapped to a scale, but are at a fixed +value and apply to the layer as a whole. For example, \code{colour = "red"} +or \code{linewidth = 3}. The geom's documentation has an \strong{Aesthetics} +section that lists the available options. The 'required' aesthetics +cannot be passed on to the \code{params}. Please note that while passing +unmapped aesthetics as vectors is technically possible, the order and +required length is not guaranteed to be parallel to the input data. +\item When constructing a layer using +a \verb{stat_*()} function, the \code{...} argument can be used to pass on +parameters to the \code{geom} part of the layer. An example of this is +\code{stat_density(geom = "area", outline.type = "both")}. The geom's +documentation lists which parameters it can accept. +\item Inversely, when constructing a layer using a +\verb{geom_*()} function, the \code{...} argument can be used to pass on parameters +to the \code{stat} part of the layer. An example of this is +\code{geom_area(stat = "density", adjust = 0.5)}. The stat's documentation +lists which parameters it can accept. +\item The \code{key_glyph} argument of \code{\link[ggplot2:layer]{layer()}} may also be passed on through +\code{...}. This can be one of the functions described as +\link[ggplot2:draw_key]{key glyphs}, to change the display of the layer in the legend. +}} \item{na.rm}{If \code{FALSE}, the default, missing values are removed with a warning. If \code{TRUE}, missing values are silently removed.} diff --git a/man/geom_turn.Rd b/man/geom_turn.Rd index f4e8734..581ef45 100644 --- a/man/geom_turn.Rd +++ b/man/geom_turn.Rd @@ -36,20 +36,59 @@ the plot data. The return value must be a \code{data.frame}, and will be used as the layer data. A \code{function} can be created from a \code{formula} (e.g. \code{~ head(.x, 10)}).} -\item{stat}{The statistical transformation to use on the data for this -layer, either as a \code{ggproto} \code{Geom} subclass or as a string naming the -stat stripped of the \code{stat_} prefix (e.g. \code{"count"} rather than -\code{"stat_count"})} +\item{stat}{The statistical transformation to use on the data for this layer. +When using a \verb{geom_*()} function to construct a layer, the \code{stat} +argument can be used the override the default coupling between geoms and +stats. The \code{stat} argument accepts the following: +\itemize{ +\item A \code{Stat} ggproto subclass, for example \code{StatCount}. +\item A string naming the stat. To give the stat as a string, strip the +function name of the \code{stat_} prefix. For example, to use \code{stat_count()}, +give the stat as \code{"count"}. +\item For more information and other ways to specify the stat, see the +\link[ggplot2:layer_stats]{layer stat} documentation. +}} -\item{position}{Position adjustment, either as a string naming the adjustment -(e.g. \code{"jitter"} to use \code{position_jitter}), or the result of a call to a -position adjustment function. Use the latter if you need to change the -settings of the adjustment.} +\item{position}{A position adjustment to use on the data for this layer. This +can be used in various ways, including to prevent overplotting and +improving the display. The \code{position} argument accepts the following: +\itemize{ +\item The result of calling a position function, such as \code{position_jitter()}. +This method allows for passing extra arguments to the position. +\item A string naming the position adjustment. To give the position as a +string, strip the function name of the \code{position_} prefix. For example, +to use \code{position_jitter()}, give the position as \code{"jitter"}. +\item For more information and other ways to specify the position, see the +\link[ggplot2:layer_positions]{layer position} documentation. +}} -\item{...}{Other arguments passed on to \code{\link[ggplot2:layer]{layer()}}. These are -often aesthetics, used to set an aesthetic to a fixed value, like -\code{colour = "red"} or \code{size = 3}. They may also be parameters -to the paired geom/stat.} +\item{...}{Other arguments passed on to \code{\link[ggplot2:layer]{layer()}}'s \code{params} argument. These +arguments broadly fall into one of 4 categories below. Notably, further +arguments to the \code{position} argument, or aesthetics that are required +can \emph{not} be passed through \code{...}. Unknown arguments that are not part +of the 4 categories below are ignored. +\itemize{ +\item Static aesthetics that are not mapped to a scale, but are at a fixed +value and apply to the layer as a whole. For example, \code{colour = "red"} +or \code{linewidth = 3}. The geom's documentation has an \strong{Aesthetics} +section that lists the available options. The 'required' aesthetics +cannot be passed on to the \code{params}. Please note that while passing +unmapped aesthetics as vectors is technically possible, the order and +required length is not guaranteed to be parallel to the input data. +\item When constructing a layer using +a \verb{stat_*()} function, the \code{...} argument can be used to pass on +parameters to the \code{geom} part of the layer. An example of this is +\code{stat_density(geom = "area", outline.type = "both")}. The geom's +documentation lists which parameters it can accept. +\item Inversely, when constructing a layer using a +\verb{geom_*()} function, the \code{...} argument can be used to pass on parameters +to the \code{stat} part of the layer. An example of this is +\code{geom_area(stat = "density", adjust = 0.5)}. The stat's documentation +lists which parameters it can accept. +\item The \code{key_glyph} argument of \code{\link[ggplot2:layer]{layer()}} may also be passed on through +\code{...}. This can be one of the functions described as +\link[ggplot2:draw_key]{key glyphs}, to change the display of the layer in the legend. +}} \item{na.rm}{If \code{FALSE}, the default, missing values are removed with a warning. If \code{TRUE}, missing values are silently removed.} diff --git a/tests/testthat/test-inspect_language.R b/tests/testthat/test-inspect_language.R index 051d2d7..e3f9066 100644 --- a/tests/testthat/test-inspect_language.R +++ b/tests/testthat/test-inspect_language.R @@ -1,12 +1,4 @@ ## set up the test environment -# Install ifadv and devtools only if required -if (!requireNamespace("ifadv")){ - if (!requireNamespace("devtools")){ - install.packages("devtools") - } - devtools::install_github("elpaco-escience/ifadv") -} - data <- ifadv::ifadv test_that("language inspection yields stats", { diff --git a/tests/testthat/test-report.R b/tests/testthat/test-report.R index 822c05f..b5ca7a7 100644 --- a/tests/testthat/test-report.R +++ b/tests/testthat/test-report.R @@ -1,12 +1,4 @@ ## set up the test environment -# Install ifadv and devtools only if required -if (!requireNamespace("ifadv")){ - if (!requireNamespace("devtools")){ - install.packages("devtools") - } - devtools::install_github("elpaco-escience/ifadv") -} - data <- ifadv::ifadv test_that("summary reports are accurate", { diff --git a/vignettes/workflow.Rmd b/vignettes/workflow.Rmd index 4d66c96..4ac3d20 100644 --- a/vignettes/workflow.Rmd +++ b/vignettes/workflow.Rmd @@ -21,14 +21,9 @@ library(talkr) ## Data We will be using the IFADV corpus as example data for the workflow of `talkr`. -A prepared dataset can be downloaded by installing the `ifadv` package: +The snippet below initializes the talkr dataset using the ifadv data. -```{r install data package} -# install.packages("devtools") -devtools::install_github("elpaco-escience/ifadv") -``` - -We will initialize the talkr dataset using the ifadv data, as follows: +For more information about the IFADV dataset, see the [repository link](https://github.com/elpaco-escience/ifadv). ```{r} data <- init(ifadv::ifadv)