зеркало из https://github.com/microsoft/wpa.git
docs: add return value
This commit is contained in:
Родитель
1826276a33
Коммит
2ce9812ff0
|
@ -178,13 +178,17 @@ generate_chunks <- function(level = 3,
|
|||
return(obj)
|
||||
}
|
||||
|
||||
#' Read preamble
|
||||
#' @title Read preamble
|
||||
#'
|
||||
#' @description
|
||||
#' Read in a preamble to be used within each individual reporting function.
|
||||
#' Reads from the Markdown file installed with the package.
|
||||
#'
|
||||
#' @param path Text string containing the path for the appropriate Markdown file.
|
||||
#'
|
||||
#' @return
|
||||
#' String containing the text read in from the specified Markdown file.
|
||||
#'
|
||||
#' @family Support
|
||||
#' @family Reports
|
||||
#'
|
||||
|
|
|
@ -15,8 +15,9 @@
|
|||
#' - `Decision_making_meeting_hours`
|
||||
#' - `One_on_one_meeting_hours`
|
||||
#'
|
||||
#' @param hrvar HR Variable by which to split metrics, defaults to "Organization"
|
||||
#' but accepts any character vector, e.g. "LevelDesignation"
|
||||
#' @param hrvar HR Variable by which to split metrics, defaults to
|
||||
#' `"Organization"` but accepts any character vector, e.g.
|
||||
#' `"LevelDesignation"`
|
||||
#' @param mingroup Numeric value setting the privacy threshold / minimum group
|
||||
#' size. Defaults to 5.
|
||||
#' @param return String specifying what to return. This must be one of the
|
||||
|
@ -26,6 +27,12 @@
|
|||
#'
|
||||
#' See `Value` for more information.
|
||||
#'
|
||||
#' @return
|
||||
#' A different output is returned depending on the value passed to the `return`
|
||||
#' argument:
|
||||
#' - `"plot"`: ggplot object. A horizontal bar plot for the metric.
|
||||
#' - `"table"`: data frame. A summary table for the metric.
|
||||
#'
|
||||
#' @import ggplot2
|
||||
#' @import dplyr
|
||||
#'
|
||||
|
|
|
@ -20,6 +20,11 @@
|
|||
#' # Simulate a p2p dataset with 800 edges
|
||||
#' p2p_data_sim(size = 200, nei = 4)
|
||||
#'
|
||||
#' @return
|
||||
#' data frame with the same column structure as a person-to-person flexible
|
||||
#' query. This has an edgelist structure and can be used directly as an input
|
||||
#' to `network_p2p()`.
|
||||
#'
|
||||
#' @family Data
|
||||
#' @family Network
|
||||
#'
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License. See LICENSE.txt in the project root for license information.
|
||||
# --------------------------------------------------------------------------------------------
|
||||
|
||||
#' @title
|
||||
#' Calculate the p-value of the null hypothesis that two outcomes are from the
|
||||
#' same dataset
|
||||
|
@ -19,12 +18,15 @@
|
|||
#' @param paired Specify whether the dataset is paired or not. Defaults to
|
||||
#' `TRUE`.
|
||||
#'
|
||||
#' @return
|
||||
#' Returns a numeric value representing the p-value outcome of the test.
|
||||
#'
|
||||
#' @family Support
|
||||
#'
|
||||
#' @import dplyr
|
||||
#'
|
||||
#' @details
|
||||
#' This function is a wrapper around `wilcox.test()` from {stats}.
|
||||
#' This function is a wrapper around `wilcox.test()` from 'stats'.
|
||||
#'
|
||||
#' @examples
|
||||
#' # Simulate a binary variable X
|
||||
|
|
|
@ -1,13 +1,19 @@
|
|||
#' @title Perform a pairwise count of words by id
|
||||
#'
|
||||
#' @description This is a 'data.table' implementation that mimics the output
|
||||
#' of `widyr::pairwise_count()` to reduce package dependency. This is used
|
||||
#' @description This is a 'data.table' implementation that mimics the output of
|
||||
#' `pairwise_count()` from 'widyr' to reduce package dependency. This is used
|
||||
#' internally within `tm_cooc()`.
|
||||
#'
|
||||
#' @param data Data frame output from `tm_clean()`.
|
||||
#' @param id String to represent the id variable. Defaults to `"line"`.
|
||||
#' @param word String to represent the word variable. Defaults to `"word"`.
|
||||
#'
|
||||
#' @return
|
||||
#' data frame with the following columns representing a pairwise count:
|
||||
#' - `"item1"`
|
||||
#' - `"item2"`
|
||||
#' - `"n"`
|
||||
#'
|
||||
#' @importFrom data.table ":=" "%like%" "%between%" rbindlist as.data.table
|
||||
#'
|
||||
#' @family Support
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
#' @param data A Ways of Working Assessment query to pass through as a data
|
||||
#' frame.
|
||||
#'
|
||||
#' @return
|
||||
#' data frame containing the formatted query passed to the function.
|
||||
#'
|
||||
#' @family Data Validation
|
||||
#' @family Import and Export
|
||||
#'
|
||||
|
|
|
@ -23,6 +23,9 @@
|
|||
#'
|
||||
#' @family Themes
|
||||
#'
|
||||
#' @return
|
||||
#' Returns a ggplot object with the applied theme.
|
||||
#'
|
||||
#' @export
|
||||
theme_wpa <- function(font_size = 12, font_family = "Segoe UI"){
|
||||
|
||||
|
@ -76,6 +79,9 @@ theme_wpa <- function(font_size = 12, font_family = "Segoe UI"){
|
|||
#'
|
||||
#' @family Themes
|
||||
#'
|
||||
#' @return
|
||||
#' Returns a ggplot object with the applied theme.
|
||||
#'
|
||||
#' @export
|
||||
theme_wpa_basic <- function(font_size = 12){
|
||||
|
||||
|
|
17
R/tm_clean.R
17
R/tm_clean.R
|
@ -15,7 +15,7 @@
|
|||
#'
|
||||
#'
|
||||
#' @param data A Meeting Query dataset in the form of a data frame.
|
||||
#' @param token A character vector accepting either `"words"` or `"ngram"`,
|
||||
#' @param token A character vector accepting either `"words"` or `"ngrams"`,
|
||||
#' determining type of tokenisation to return.
|
||||
#' @param stopwords A single-column data frame labelled `'word'` containing
|
||||
#' custom stopwords to remove.
|
||||
|
@ -26,6 +26,18 @@
|
|||
#'
|
||||
#' @family Text-mining
|
||||
#'
|
||||
#' @examples
|
||||
#' # words
|
||||
#' tm_clean(mt_data)
|
||||
#'
|
||||
#' # ngrams
|
||||
#' tm_clean(mt_data, token = "ngrams")
|
||||
#'
|
||||
#' @return
|
||||
#' data frame with two columns:
|
||||
#' - `line`
|
||||
#' - `word`
|
||||
#'
|
||||
#' @export
|
||||
tm_clean <- function(data,
|
||||
token = "words",
|
||||
|
@ -54,7 +66,6 @@ tm_clean <- function(data,
|
|||
|
||||
}
|
||||
|
||||
text_df <- text_df %>% anti_join(stopwords)
|
||||
text_df %>% anti_join(stopwords)
|
||||
|
||||
return(text_df)
|
||||
}
|
||||
|
|
17
R/tm_cooc.R
17
R/tm_cooc.R
|
@ -8,7 +8,7 @@
|
|||
#'
|
||||
#' @description
|
||||
#' This function generates a word co-occurence network plot, with options to
|
||||
#' return a table. This is a sub-function that feeds into `meeting_tm_report()`.
|
||||
#' return a table. This function is used within `meeting_tm_report()`.
|
||||
#'
|
||||
#' @details
|
||||
#' This function uses `tm_clean()` as the underlying data wrangling function.
|
||||
|
@ -19,11 +19,22 @@
|
|||
#' @param stopwords A single-column data frame labelled 'word' containing custom
|
||||
#' stopwords to remove.
|
||||
#' @param seed A numeric vector to set seed for random generation.
|
||||
#' @param return Character vector specifying what to return, defaults to
|
||||
#' `"plot"`. Valid inputs are `"plot"` and `"table"`.
|
||||
#' @param return String specifying what to return. This must be one of the
|
||||
#' following strings:
|
||||
#' - `"plot"`
|
||||
#' - `"table"`
|
||||
#'
|
||||
#' See `Value` for more information.
|
||||
#'
|
||||
#' @param lmult A multiplier to adjust the line width in the output plot.
|
||||
#' Defaults to 0.05.
|
||||
#'
|
||||
#' @return
|
||||
#' A different output is returned depending on the value passed to the `return`
|
||||
#' argument:
|
||||
#' - `"plot"`: 'ggplot' and 'ggraph' object. A network plot.
|
||||
#' - `"table"`: data frame. A summary table.
|
||||
#'
|
||||
#' @import dplyr
|
||||
#' @import ggplot2
|
||||
#' @import ggraph
|
||||
|
|
19
R/tm_freq.R
19
R/tm_freq.R
|
@ -3,11 +3,12 @@
|
|||
# Licensed under the MIT License. See LICENSE.txt in the project root for license information.
|
||||
# --------------------------------------------------------------------------------------------
|
||||
|
||||
#' @title Perform a Word or Ngram Frequency Analysis and return a Circular Bar Plot
|
||||
#' @title Perform a Word or Ngram Frequency Analysis and return a Circular Bar
|
||||
#' Plot
|
||||
#'
|
||||
#' @description
|
||||
#' Generate a circular bar plot with frequency of words / ngrams.
|
||||
#' This is a sub-function that feeds into `meeting_tm_report()`.
|
||||
#' This function is used within `meeting_tm_report()`.
|
||||
#'
|
||||
#' @details
|
||||
#' This function uses `tm_clean()` as the underlying data wrangling function.
|
||||
|
@ -20,8 +21,18 @@
|
|||
#' @param stopwords A single-column data frame labelled `'word'` containing
|
||||
#' custom stopwords to remove.
|
||||
#' @param keep A numeric vector specifying maximum number of words to keep.
|
||||
#' @param return Character vector specifying what to return, defaults to
|
||||
#' `"plot"`. Valid inputs are `"plot"` and `"table"`.
|
||||
#' @param return String specifying what to return. This must be one of the
|
||||
#' following strings:
|
||||
#' - `"plot"`
|
||||
#' - `"table"`
|
||||
#'
|
||||
#' See `Value` for more information.
|
||||
#'
|
||||
#' @return
|
||||
#' A different output is returned depending on the value passed to the `return`
|
||||
#' argument:
|
||||
#' - `"plot"`: 'ggplot' object. A circular bar plot.
|
||||
#' - `"table"`: data frame. A summary table.
|
||||
#'
|
||||
#' @import dplyr
|
||||
#' @import ggplot2
|
||||
|
|
|
@ -3,16 +3,16 @@
|
|||
# Licensed under the MIT License. See LICENSE.txt in the project root for license information.
|
||||
# --------------------------------------------------------------------------------------------
|
||||
|
||||
#' @title Generate a wordcloud
|
||||
#' @title Generate a wordcloud with meeting subject lines
|
||||
#'
|
||||
#' @description
|
||||
#' Generate a wordcloud with the meeting query.
|
||||
#' This is a sub-function that feeds into `meeting_tm_report()`.
|
||||
#'
|
||||
#' @details
|
||||
#' Uses the {ggwordcloud} package for the underlying implementation, thus
|
||||
#' returning a ggplot. Additional layers can be added onto the plot using
|
||||
#' a ggplot `+` syntax.
|
||||
#' Uses the 'ggwordcloud' package for the underlying implementation, thus
|
||||
#' returning a 'ggplot' object. Additional layers can be added onto the plot
|
||||
#' using a ggplot `+` syntax.
|
||||
#' The recommendation is not to return over 100 words in a word cloud.
|
||||
#'
|
||||
#' @details
|
||||
|
@ -25,12 +25,21 @@
|
|||
#' custom stopwords to remove.
|
||||
#' @param seed A numeric vector to set seed for random generation.
|
||||
#' @param keep A numeric vector specifying maximum number of words to keep.
|
||||
#' @param return Character vector specifying what to return, defaults to "plot".
|
||||
#' Valid inputs are "plot" and "table". A "table" returns the data used to
|
||||
#' generate the wordcloud.
|
||||
#' @param return String specifying what to return. This must be one of the
|
||||
#' following strings:
|
||||
#' - `"plot"`
|
||||
#' - `"table"`
|
||||
#'
|
||||
#' See `Value` for more information.
|
||||
#' @param ... Additional parameters to be passed to
|
||||
#' `ggwordcloud::geom_text_wordcloud()`
|
||||
#'
|
||||
#' @return
|
||||
#' A different output is returned depending on the value passed to the `return`
|
||||
#' argument:
|
||||
#' - `"plot"`: 'ggplot' object containing a word cloud.
|
||||
#' - `"table"`: data frame returning the data used to generate the word cloud.
|
||||
#'
|
||||
#' @import dplyr
|
||||
#' @examples
|
||||
#' tm_wordcloud(mt_data, keep = 30)
|
||||
|
|
|
@ -21,6 +21,11 @@
|
|||
#' @param target_value Character value to impute in the new data frame to
|
||||
#' row-bind. Defaults to `"Total"`.
|
||||
#'
|
||||
#' @return
|
||||
#' data frame with twice the number of rows of the input data frame, where half
|
||||
#' of those rows will have the `target_col` column imputed with the value from
|
||||
#' `target_value`.
|
||||
#'
|
||||
#' @family Support
|
||||
#'
|
||||
#' @export
|
||||
|
|
|
@ -21,6 +21,10 @@
|
|||
#' `"Total"` column. Defaults to `"Total"`. An error is returned if an
|
||||
#' existing variable has the same name as the supplied value.
|
||||
#'
|
||||
#' @return
|
||||
#' data frame containing an additional 'Total' column on top of the input data
|
||||
#' frame.
|
||||
#'
|
||||
#' @family Support
|
||||
#'
|
||||
#' @export
|
||||
|
|
|
@ -23,6 +23,9 @@
|
|||
#' @param target_col Character value of the column in which to reorder
|
||||
#' @param target_value Character value of the value in `target_col` to match
|
||||
#'
|
||||
#' @return
|
||||
#' data frame with the 'Total' row reordered to the bottom.
|
||||
#'
|
||||
#' @family Support
|
||||
#'
|
||||
#' @export
|
||||
|
|
|
@ -6,11 +6,14 @@
|
|||
#' @title Generate a time stamp
|
||||
#'
|
||||
#' @description
|
||||
#' This function generates a time stamp of the format `yymmdd_hhmmss`.
|
||||
#' This function generates a time stamp of the format `'yymmdd_hhmmss'`.
|
||||
#' This is a support function and is not intended for direct use.
|
||||
#'
|
||||
#' @family Support
|
||||
#'
|
||||
#' @return
|
||||
#' String containing the timestamp in the format `'yymmdd_hhmmss'`.
|
||||
#'
|
||||
#' @export
|
||||
tstamp <- function(){
|
||||
stamp <- Sys.time()
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
#'
|
||||
#' @param x String to replace all occurrences of `_` with a single space
|
||||
#'
|
||||
#' @return
|
||||
#' Character vector containing the modified string.
|
||||
#'
|
||||
#' @family Support
|
||||
#'
|
||||
#' @examples
|
||||
|
|
|
@ -26,9 +26,12 @@
|
|||
#' - `"unscheduled_calls"` for Unscheduled Calls only
|
||||
#' - `"meetings"` for Meetings only
|
||||
#'
|
||||
#' @param return Character vector to specify what to return. Valid options include:
|
||||
#' - `"plot"`: returns an overlapping area plot (default)
|
||||
#' - `"table"`: returns a summary table
|
||||
#' @param return String specifying what to return. This must be one of the
|
||||
#' following strings:
|
||||
#' - `"plot"`
|
||||
#' - `"table"`
|
||||
#'
|
||||
#' See `Value` for more information.
|
||||
#'
|
||||
#' @param values Character vector to specify whether to return percentages
|
||||
#' or absolute values in "data" and "plot". Valid values are:
|
||||
|
@ -41,6 +44,11 @@
|
|||
#' @param end_hour A character vector specifying starting hours,
|
||||
#' e.g. "1700"
|
||||
#'
|
||||
#' @return
|
||||
#' A different output is returned depending on the value passed to the `return`
|
||||
#' argument:
|
||||
#' - `"plot"`: ggplot object. An overlapping area plot (default).
|
||||
#' - `"table"`: data frame. A summary table.
|
||||
#'
|
||||
#' @import dplyr
|
||||
#' @import tidyselect
|
||||
|
|
|
@ -18,8 +18,19 @@
|
|||
#' e.g. "`0900"`
|
||||
#' @param end_hour A character vector specifying starting hours,
|
||||
#' e.g. `"1700"`
|
||||
#' @param return String specifying what to return. Defaults to "plot",
|
||||
#' with options to return a summary table ("table").
|
||||
#' @param return String specifying what to return. This must be one of the
|
||||
#' following strings:
|
||||
#' - `"plot"`
|
||||
#' - `"table"`
|
||||
#'
|
||||
#' See `Value` for more information.
|
||||
|
||||
#' @return
|
||||
#' A different output is returned depending on the value passed to the `return`
|
||||
#' argument:
|
||||
#' - `"plot"`: ggplot object. A plot with the y-axis showing the top ten
|
||||
#' working patterns and the x-axis representing each hour of the day.
|
||||
#' - `"table"`: data frame. A summary table for the top working patterns.
|
||||
#'
|
||||
#' @importFrom data.table ":=" "%like%" "%between%"
|
||||
#'
|
||||
|
|
3
R/wrap.R
3
R/wrap.R
|
@ -13,6 +13,9 @@
|
|||
#'
|
||||
#' @family Support
|
||||
#'
|
||||
#' @return
|
||||
#' Character vector containing the modified string.
|
||||
#'
|
||||
#' @export
|
||||
wrap <- function(string, wrapper = '"'){
|
||||
paste0(wrapper, string, wrapper)
|
||||
|
|
|
@ -28,8 +28,9 @@ Requires the following variables:
|
|||
\item \code{One_on_one_meeting_hours}
|
||||
}}
|
||||
|
||||
\item{hrvar}{HR Variable by which to split metrics, defaults to "Organization"
|
||||
but accepts any character vector, e.g. "LevelDesignation"}
|
||||
\item{hrvar}{HR Variable by which to split metrics, defaults to
|
||||
\code{"Organization"} but accepts any character vector, e.g.
|
||||
\code{"LevelDesignation"}}
|
||||
|
||||
\item{mingroup}{Numeric value setting the privacy threshold / minimum group
|
||||
size. Defaults to 5.}
|
||||
|
@ -43,6 +44,14 @@ following strings:
|
|||
|
||||
See \code{Value} for more information.}
|
||||
}
|
||||
\value{
|
||||
A different output is returned depending on the value passed to the \code{return}
|
||||
argument:
|
||||
\itemize{
|
||||
\item \code{"plot"}: ggplot object. A horizontal bar plot for the metric.
|
||||
\item \code{"table"}: data frame. A summary table for the metric.
|
||||
}
|
||||
}
|
||||
\description{
|
||||
This function creates a bar chart showing the percentage of meeting hours
|
||||
which are spent in long or large meetings.
|
||||
|
|
|
@ -16,6 +16,11 @@ the lattice will be connected.}
|
|||
|
||||
\item{p}{Real constant between zero and one, the rewiring probability.}
|
||||
}
|
||||
\value{
|
||||
data frame with the same column structure as a person-to-person flexible
|
||||
query. This has an edgelist structure and can be used directly as an input
|
||||
to \code{network_p2p()}.
|
||||
}
|
||||
\description{
|
||||
Generate an person-to-person query / edgelist based on the graph
|
||||
according to the Watts-Strogatz small-world network model. Organizational
|
||||
|
|
|
@ -19,12 +19,15 @@ behavior to test.}
|
|||
\item{paired}{Specify whether the dataset is paired or not. Defaults to
|
||||
\code{TRUE}.}
|
||||
}
|
||||
\value{
|
||||
Returns a numeric value representing the p-value outcome of the test.
|
||||
}
|
||||
\description{
|
||||
Specify an outcome variable and return p-test outputs.
|
||||
All numeric variables in the dataset are used as predictor variables.
|
||||
}
|
||||
\details{
|
||||
This function is a wrapper around \code{wilcox.test()} from {stats}.
|
||||
This function is a wrapper around \code{wilcox.test()} from 'stats'.
|
||||
}
|
||||
\examples{
|
||||
# Simulate a binary variable X
|
||||
|
|
|
@ -13,9 +13,17 @@ pairwise_count(data, id = "line", word = "word")
|
|||
|
||||
\item{word}{String to represent the word variable. Defaults to \code{"word"}.}
|
||||
}
|
||||
\value{
|
||||
data frame with the following columns representing a pairwise count:
|
||||
\itemize{
|
||||
\item \code{"item1"}
|
||||
\item \code{"item2"}
|
||||
\item \code{"n"}
|
||||
}
|
||||
}
|
||||
\description{
|
||||
This is a 'data.table' implementation that mimics the output
|
||||
of \code{widyr::pairwise_count()} to reduce package dependency. This is used
|
||||
This is a 'data.table' implementation that mimics the output of
|
||||
\code{pairwise_count()} from 'widyr' to reduce package dependency. This is used
|
||||
internally within \code{tm_cooc()}.
|
||||
}
|
||||
\examples{
|
||||
|
|
|
@ -9,6 +9,9 @@ read_preamble(path)
|
|||
\arguments{
|
||||
\item{path}{Text string containing the path for the appropriate Markdown file.}
|
||||
}
|
||||
\value{
|
||||
String containing the text read in from the specified Markdown file.
|
||||
}
|
||||
\description{
|
||||
Read in a preamble to be used within each individual reporting function.
|
||||
Reads from the Markdown file installed with the package.
|
||||
|
|
|
@ -13,6 +13,9 @@ standardize_pq(data)
|
|||
\item{data}{A Ways of Working Assessment query to pass through as a data
|
||||
frame.}
|
||||
}
|
||||
\value{
|
||||
data frame containing the formatted query passed to the function.
|
||||
}
|
||||
\description{
|
||||
This function standardises the variable names to a Standard Person
|
||||
Query, where the standard use case is to pass a Ways of Working Assessment
|
||||
|
|
|
@ -17,6 +17,9 @@ you can use this font, install and load {extrafont} prior to
|
|||
plotting. There is an initialisation process that is described by:
|
||||
\url{https://stackoverflow.com/questions/34522732/changing-fonts-in-ggplot2}}
|
||||
}
|
||||
\value{
|
||||
Returns a ggplot object with the applied theme.
|
||||
}
|
||||
\description{
|
||||
A theme function applied to ggplot visualisations in {wpa}.
|
||||
Install and load {extrafont} to use custom fonts for plotting.
|
||||
|
|
|
@ -11,6 +11,9 @@ theme_wpa_basic(font_size = 12)
|
|||
for the plot. The text elements are defined relatively to this
|
||||
base font size. Defaults to 12.}
|
||||
}
|
||||
\value{
|
||||
Returns a ggplot object with the applied theme.
|
||||
}
|
||||
\description{
|
||||
A theme function applied to ggplot visualisations in {wpa}.
|
||||
Based on \code{theme_wpa()} but has no font requirements.
|
||||
|
|
|
@ -9,12 +9,19 @@ tm_clean(data, token = "words", stopwords = NULL)
|
|||
\arguments{
|
||||
\item{data}{A Meeting Query dataset in the form of a data frame.}
|
||||
|
||||
\item{token}{A character vector accepting either \code{"words"} or \code{"ngram"},
|
||||
\item{token}{A character vector accepting either \code{"words"} or \code{"ngrams"},
|
||||
determining type of tokenisation to return.}
|
||||
|
||||
\item{stopwords}{A single-column data frame labelled \code{'word'} containing
|
||||
custom stopwords to remove.}
|
||||
}
|
||||
\value{
|
||||
data frame with two columns:
|
||||
\itemize{
|
||||
\item \code{line}
|
||||
\item \code{word}
|
||||
}
|
||||
}
|
||||
\description{
|
||||
This function processes the \code{Subject} column in a Meeting Query by applying
|
||||
tokenisation using\code{tidytext::unnest_tokens()}, and removing any stopwords
|
||||
|
@ -22,6 +29,14 @@ supplied in a data frame (using the argument \code{stopwords}). This is a
|
|||
sub-function that feeds into \code{tm_freq()}, \code{tm_cooc()}, and \code{tm_wordcloud()}.
|
||||
The default is to return a data frame with tokenised counts of words or
|
||||
ngrams.
|
||||
}
|
||||
\examples{
|
||||
# words
|
||||
tm_clean(mt_data)
|
||||
|
||||
# ngrams
|
||||
tm_clean(mt_data, token = "ngrams")
|
||||
|
||||
}
|
||||
\seealso{
|
||||
Other Text-mining:
|
||||
|
|
|
@ -14,15 +14,29 @@ stopwords to remove.}
|
|||
|
||||
\item{seed}{A numeric vector to set seed for random generation.}
|
||||
|
||||
\item{return}{Character vector specifying what to return, defaults to
|
||||
\code{"plot"}. Valid inputs are \code{"plot"} and \code{"table"}.}
|
||||
\item{return}{String specifying what to return. This must be one of the
|
||||
following strings:
|
||||
\itemize{
|
||||
\item \code{"plot"}
|
||||
\item \code{"table"}
|
||||
}
|
||||
|
||||
See \code{Value} for more information.}
|
||||
|
||||
\item{lmult}{A multiplier to adjust the line width in the output plot.
|
||||
Defaults to 0.05.}
|
||||
}
|
||||
\value{
|
||||
A different output is returned depending on the value passed to the \code{return}
|
||||
argument:
|
||||
\itemize{
|
||||
\item \code{"plot"}: 'ggplot' and 'ggraph' object. A network plot.
|
||||
\item \code{"table"}: data frame. A summary table.
|
||||
}
|
||||
}
|
||||
\description{
|
||||
This function generates a word co-occurence network plot, with options to
|
||||
return a table. This is a sub-function that feeds into \code{meeting_tm_report()}.
|
||||
return a table. This function is used within \code{meeting_tm_report()}.
|
||||
}
|
||||
\details{
|
||||
This function uses \code{tm_clean()} as the underlying data wrangling function.
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
% Please edit documentation in R/tm_freq.R
|
||||
\name{tm_freq}
|
||||
\alias{tm_freq}
|
||||
\title{Perform a Word or Ngram Frequency Analysis and return a Circular Bar Plot}
|
||||
\title{Perform a Word or Ngram Frequency Analysis and return a Circular Bar
|
||||
Plot}
|
||||
\usage{
|
||||
tm_freq(data, token = "words", stopwords = NULL, keep = 100, return = "plot")
|
||||
}
|
||||
|
@ -17,12 +18,26 @@ custom stopwords to remove.}
|
|||
|
||||
\item{keep}{A numeric vector specifying maximum number of words to keep.}
|
||||
|
||||
\item{return}{Character vector specifying what to return, defaults to
|
||||
\code{"plot"}. Valid inputs are \code{"plot"} and \code{"table"}.}
|
||||
\item{return}{String specifying what to return. This must be one of the
|
||||
following strings:
|
||||
\itemize{
|
||||
\item \code{"plot"}
|
||||
\item \code{"table"}
|
||||
}
|
||||
|
||||
See \code{Value} for more information.}
|
||||
}
|
||||
\value{
|
||||
A different output is returned depending on the value passed to the \code{return}
|
||||
argument:
|
||||
\itemize{
|
||||
\item \code{"plot"}: 'ggplot' object. A circular bar plot.
|
||||
\item \code{"table"}: data frame. A summary table.
|
||||
}
|
||||
}
|
||||
\description{
|
||||
Generate a circular bar plot with frequency of words / ngrams.
|
||||
This is a sub-function that feeds into \code{meeting_tm_report()}.
|
||||
This function is used within \code{meeting_tm_report()}.
|
||||
}
|
||||
\details{
|
||||
This function uses \code{tm_clean()} as the underlying data wrangling function.
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
% Please edit documentation in R/tm_wordcloud.R
|
||||
\name{tm_wordcloud}
|
||||
\alias{tm_wordcloud}
|
||||
\title{Generate a wordcloud}
|
||||
\title{Generate a wordcloud with meeting subject lines}
|
||||
\usage{
|
||||
tm_wordcloud(
|
||||
data,
|
||||
|
@ -23,21 +23,34 @@ custom stopwords to remove.}
|
|||
|
||||
\item{keep}{A numeric vector specifying maximum number of words to keep.}
|
||||
|
||||
\item{return}{Character vector specifying what to return, defaults to "plot".
|
||||
Valid inputs are "plot" and "table". A "table" returns the data used to
|
||||
generate the wordcloud.}
|
||||
\item{return}{String specifying what to return. This must be one of the
|
||||
following strings:
|
||||
\itemize{
|
||||
\item \code{"plot"}
|
||||
\item \code{"table"}
|
||||
}
|
||||
|
||||
See \code{Value} for more information.}
|
||||
|
||||
\item{...}{Additional parameters to be passed to
|
||||
\code{ggwordcloud::geom_text_wordcloud()}}
|
||||
}
|
||||
\value{
|
||||
A different output is returned depending on the value passed to the \code{return}
|
||||
argument:
|
||||
\itemize{
|
||||
\item \code{"plot"}: 'ggplot' object containing a word cloud.
|
||||
\item \code{"table"}: data frame returning the data used to generate the word cloud.
|
||||
}
|
||||
}
|
||||
\description{
|
||||
Generate a wordcloud with the meeting query.
|
||||
This is a sub-function that feeds into \code{meeting_tm_report()}.
|
||||
}
|
||||
\details{
|
||||
Uses the {ggwordcloud} package for the underlying implementation, thus
|
||||
returning a ggplot. Additional layers can be added onto the plot using
|
||||
a ggplot \code{+} syntax.
|
||||
Uses the 'ggwordcloud' package for the underlying implementation, thus
|
||||
returning a 'ggplot' object. Additional layers can be added onto the plot
|
||||
using a ggplot \code{+} syntax.
|
||||
The recommendation is not to return over 100 words in a word cloud.
|
||||
|
||||
This function uses \code{tm_clean()} as the underlying data wrangling function.
|
||||
|
|
|
@ -15,6 +15,11 @@ This is usually the intended grouping column.}
|
|||
\item{target_value}{Character value to impute in the new data frame to
|
||||
row-bind. Defaults to \code{"Total"}.}
|
||||
}
|
||||
\value{
|
||||
data frame with twice the number of rows of the input data frame, where half
|
||||
of those rows will have the \code{target_col} column imputed with the value from
|
||||
\code{target_value}.
|
||||
}
|
||||
\description{
|
||||
Row-bind an identical data frame and impute a specific
|
||||
column with the \code{target_value}, which defaults as "Total". The purpose of
|
||||
|
|
|
@ -13,6 +13,10 @@ totals_col(data, total_value = "Total")
|
|||
\code{"Total"} column. Defaults to \code{"Total"}. An error is returned if an
|
||||
existing variable has the same name as the supplied value.}
|
||||
}
|
||||
\value{
|
||||
data frame containing an additional 'Total' column on top of the input data
|
||||
frame.
|
||||
}
|
||||
\description{
|
||||
Create a 'Total' column of character type comprising exactly of
|
||||
one unique value. This is a convenience function for returning a no-HR
|
||||
|
|
|
@ -13,6 +13,9 @@ totals_reorder(data, target_col, target_value = "Total")
|
|||
|
||||
\item{target_value}{Character value of the value in \code{target_col} to match}
|
||||
}
|
||||
\value{
|
||||
data frame with the 'Total' row reordered to the bottom.
|
||||
}
|
||||
\description{
|
||||
For a given data frame, reorder a row to the first row of that
|
||||
data frame through matching a \emph{value} of a \emph{variable}. The intended usage
|
||||
|
|
|
@ -6,8 +6,11 @@
|
|||
\usage{
|
||||
tstamp()
|
||||
}
|
||||
\value{
|
||||
String containing the timestamp in the format \code{'yymmdd_hhmmss'}.
|
||||
}
|
||||
\description{
|
||||
This function generates a time stamp of the format \code{yymmdd_hhmmss}.
|
||||
This function generates a time stamp of the format \code{'yymmdd_hhmmss'}.
|
||||
This is a support function and is not intended for direct use.
|
||||
}
|
||||
\seealso{
|
||||
|
|
|
@ -9,6 +9,9 @@ us_to_space(x)
|
|||
\arguments{
|
||||
\item{x}{String to replace all occurrences of \verb{_} with a single space}
|
||||
}
|
||||
\value{
|
||||
Character vector containing the modified string.
|
||||
}
|
||||
\description{
|
||||
Convenience function to convert underscores to space
|
||||
}
|
||||
|
|
|
@ -35,11 +35,14 @@ use:
|
|||
\item \code{"meetings"} for Meetings only
|
||||
}}
|
||||
|
||||
\item{return}{Character vector to specify what to return. Valid options include:
|
||||
\item{return}{String specifying what to return. This must be one of the
|
||||
following strings:
|
||||
\itemize{
|
||||
\item \code{"plot"}: returns an overlapping area plot (default)
|
||||
\item \code{"table"}: returns a summary table
|
||||
}}
|
||||
\item \code{"plot"}
|
||||
\item \code{"table"}
|
||||
}
|
||||
|
||||
See \code{Value} for more information.}
|
||||
|
||||
\item{values}{Character vector to specify whether to return percentages
|
||||
or absolute values in "data" and "plot". Valid values are:
|
||||
|
@ -54,6 +57,14 @@ e.g. "0900"}
|
|||
\item{end_hour}{A character vector specifying starting hours,
|
||||
e.g. "1700"}
|
||||
}
|
||||
\value{
|
||||
A different output is returned depending on the value passed to the \code{return}
|
||||
argument:
|
||||
\itemize{
|
||||
\item \code{"plot"}: ggplot object. An overlapping area plot (default).
|
||||
\item \code{"table"}: data frame. A summary table.
|
||||
}
|
||||
}
|
||||
\description{
|
||||
Uses the Hourly Collaboration query to produce an area plot of
|
||||
Emails sent and IMs sent attended by hour of the day.
|
||||
|
|
|
@ -25,8 +25,23 @@ e.g. "\verb{0900"}}
|
|||
\item{end_hour}{A character vector specifying starting hours,
|
||||
e.g. \code{"1700"}}
|
||||
|
||||
\item{return}{String specifying what to return. Defaults to "plot",
|
||||
with options to return a summary table ("table").}
|
||||
\item{return}{String specifying what to return. This must be one of the
|
||||
following strings:
|
||||
\itemize{
|
||||
\item \code{"plot"}
|
||||
\item \code{"table"}
|
||||
}
|
||||
|
||||
See \code{Value} for more information.}
|
||||
}
|
||||
\value{
|
||||
A different output is returned depending on the value passed to the \code{return}
|
||||
argument:
|
||||
\itemize{
|
||||
\item \code{"plot"}: ggplot object. A plot with the y-axis showing the top ten
|
||||
working patterns and the x-axis representing each hour of the day.
|
||||
\item \code{"table"}: data frame. A summary table for the top working patterns.
|
||||
}
|
||||
}
|
||||
\description{
|
||||
Takes in an Hourly Collaboration query and returns a count
|
||||
|
|
|
@ -11,6 +11,9 @@ wrap(string, wrapper = "\\"")
|
|||
|
||||
\item{wrapper}{Character to wrap around \code{string}}
|
||||
}
|
||||
\value{
|
||||
Character vector containing the modified string.
|
||||
}
|
||||
\description{
|
||||
This function adds a character at the start and end of a character
|
||||
string, where the default behaviour is to add a double quote.
|
||||
|
|
Загрузка…
Ссылка в новой задаче