зеркало из https://github.com/microsoft/wpa.git
docs: adjust function family (#58)
This commit is contained in:
Родитель
53139a61ac
Коммит
59475b85b5
|
@ -6,9 +6,12 @@
|
|||
#' @title Plot External Network Breadth and Size as a scatter plot
|
||||
#'
|
||||
#' @description
|
||||
#' Plot the external network metrics for a HR variable as a scatter plot, showing
|
||||
#' External Network Breadth as the vertical axis and External Network Size as the
|
||||
#' horizontal axis.
|
||||
#' Plot the external network metrics for a HR variable as a scatter plot,
|
||||
#' showing 'External Network Breadth' as the vertical axis and 'External Network
|
||||
#' Size' as the horizontal axis.
|
||||
#'
|
||||
#' @details
|
||||
#' Uses the metrics `External_network_size` and `Networking_outside_company`.
|
||||
#'
|
||||
#' @inheritParams create_bubble
|
||||
#'
|
||||
|
@ -16,7 +19,8 @@
|
|||
#' # Return plot
|
||||
#' sq_data %>% external_network_plot(return = "plot")
|
||||
#'
|
||||
#' @family Connectivity
|
||||
#' @family Visualization
|
||||
#' @family Network
|
||||
#'
|
||||
#' @export
|
||||
|
||||
|
|
|
@ -31,7 +31,8 @@
|
|||
#' - `"vars"`: data frame containing all the columns of HR variables present
|
||||
#' in the data.
|
||||
#'
|
||||
#' @family General
|
||||
#' @family Support
|
||||
#' @family Data Validation
|
||||
#'
|
||||
#' @examples
|
||||
#' sq_data %>% extract_hr(return = "names")
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
# Licensed under the MIT License. See LICENSE.txt in the project root for license information.
|
||||
# --------------------------------------------------------------------------------------------
|
||||
|
||||
#' @title Flag unusual high collaboration hours to after-hours collaboration hours ratio
|
||||
#' @title Flag unusual high collaboration hours to after-hours collaboration
|
||||
#' hours ratio
|
||||
#'
|
||||
#' @description This function flags persons who have an unusual ratio
|
||||
#' of collaboration hours to after-hours collaboration hours.
|
||||
|
@ -20,10 +21,12 @@
|
|||
#' - `"data"`
|
||||
#'
|
||||
#' @return
|
||||
#' A different output is returned depending on the value passed to the `return` argument:
|
||||
#' A different output is returned depending on the value passed to the `return`
|
||||
#' argument:
|
||||
#' - `"message"`: message in the console containing diagnotic summary
|
||||
#' - `"text"`: string containing diagnotic summary
|
||||
#' - `"data"`: data frame. Person-level data with flags on unusually high or low ratios
|
||||
#' - `"data"`: data frame. Person-level data with flags on unusually high or
|
||||
#' low ratios
|
||||
#'
|
||||
#' @family Data Validation
|
||||
#'
|
||||
|
|
|
@ -15,9 +15,22 @@
|
|||
#' @family Data Validation
|
||||
#'
|
||||
#' @param data A data frame containing a Person Query.
|
||||
#' @param threshold Numeric value specifying the threshold for flagging. Defaults to 1.
|
||||
#' @param return Character vector specifying what to return. Defaults to "text", with
|
||||
#' valid options to return a data frame ("data").
|
||||
#' @param threshold Numeric value specifying the threshold for flagging.
|
||||
#' Defaults to 1.
|
||||
#'
|
||||
#' @param return String specifying what to return. This must be one of the
|
||||
#' following strings:
|
||||
#' - `"text"`
|
||||
#' - `"data"`
|
||||
#'
|
||||
#' See `Value` for more information.
|
||||
#'
|
||||
#' @return
|
||||
#' A different output is returned depending on the value passed to the `return`
|
||||
#' argument:
|
||||
#' - `"text"`: string. A diagnostic message.
|
||||
#' - `"data"`: data frame. Person-level data with those flagged with unusual
|
||||
#' ratios.
|
||||
#'
|
||||
#' @examples
|
||||
#' flag_em_ratio(sq_data)
|
||||
|
|
|
@ -11,10 +11,24 @@
|
|||
#'
|
||||
#' @param data A Standard Person Query dataset in the form of a data frame.
|
||||
#' @param metric A character string specifying the metric to test.
|
||||
#' @param person A logical value to specify whether to calculate person-averages.
|
||||
#' Defaults to TRUE (person-averages calculated).
|
||||
#' @param person A logical value to specify whether to calculate
|
||||
#' person-averages. Defaults to `TRUE` (person-averages calculated).
|
||||
#' @param threshold Numeric value specifying the threshold for flagging.
|
||||
#' @param return A character string specifying what to return.
|
||||
#' @param return String specifying what to return. This must be one of the
|
||||
#' following strings:
|
||||
#' - `"text"`
|
||||
#' - `"message"`
|
||||
#' - `"table"`
|
||||
#'
|
||||
#' See `Value` for more information.
|
||||
#'
|
||||
#' @return
|
||||
#' A different output is returned depending on the value passed to the `return`
|
||||
#' argument:
|
||||
#' - `"text"`: string. A diagnostic message.
|
||||
#' - `"message"`: message on console. A diagnostic message.
|
||||
#' - `"table"`: data frame. A person-level table with `PersonId` and the
|
||||
#' extreme values of the selected metric.
|
||||
#'
|
||||
#' @family Data Validation
|
||||
#'
|
||||
|
@ -86,10 +100,16 @@ flag_extreme <- function(data,
|
|||
}
|
||||
|
||||
if(return == "text"){
|
||||
|
||||
FlagMessage
|
||||
|
||||
} else if(return == "message"){
|
||||
|
||||
message(FlagMessage)
|
||||
|
||||
} else if(return == "table"){
|
||||
|
||||
extreme_df
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,10 +11,22 @@
|
|||
#' @import dplyr
|
||||
#'
|
||||
#' @param data A data frame containing a Person Query.
|
||||
#' @param threshold A numeric vector of length two, specifying the hour threshold for flagging.
|
||||
#' Defaults to c(4, 15).
|
||||
#' @param return String to specify what to return.
|
||||
#' Valid options include "text" (default), "message", and "data".
|
||||
#' @param threshold A numeric vector of length two, specifying the hour
|
||||
#' threshold for flagging. Defaults to c(4, 15).
|
||||
#' @param return String specifying what to return. This must be one of the
|
||||
#' following strings:
|
||||
#' - `"text"` (default)
|
||||
#' - `"message"`
|
||||
#' - `"data"`
|
||||
#'
|
||||
#' @return
|
||||
#' A different output is returned depending on the value passed to the `return`
|
||||
#' argument:
|
||||
#' - `"text"`: string. A diagnostic message.
|
||||
#' - `"message"`: message on console. A diagnostic message.
|
||||
#' - `"data"`: data frame. Data where flag is present.
|
||||
#'
|
||||
#' See `Value` for more information.
|
||||
#'
|
||||
#' @family Data Validation
|
||||
#'
|
||||
|
@ -24,10 +36,17 @@
|
|||
#'
|
||||
#' # Example where Outlook Start and End times are imputed
|
||||
#' spq_df <- sq_data
|
||||
#'
|
||||
#' spq_df$WorkingStartTimeSetInOutlook <- "6:30"
|
||||
#'
|
||||
#' spq_df$WorkingEndTimeSetInOutlook <- "23:30"
|
||||
#'
|
||||
#' # Return a message
|
||||
#' flag_outlooktime(spq_df, threshold = c(5, 13))
|
||||
#'
|
||||
#' # Return data
|
||||
#' flag_outlooktime(spq_df, threshold = c(5, 13), return = "data")
|
||||
#'
|
||||
#' @export
|
||||
flag_outlooktime <- function(data, threshold = c(4, 15), return = "message"){
|
||||
|
||||
|
@ -133,13 +152,21 @@ flag_outlooktime <- function(data, threshold = c(4, 15), return = "message"){
|
|||
## Print diagnosis
|
||||
## Should implement options to return the PersonIds or a full data frame
|
||||
if(return == "text"){
|
||||
|
||||
FlagMessage
|
||||
|
||||
} else if(return == "message"){
|
||||
|
||||
message(FlagMessage)
|
||||
|
||||
} else if(return == "data"){
|
||||
|
||||
flagged_data[flagged_data$WorkdayFlag == TRUE,]
|
||||
|
||||
} else {
|
||||
|
||||
stop("Error: please check inputs for `return`")
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -80,7 +80,8 @@
|
|||
#' - `"plot"`: ggplot object. A random of ten working patterns are displayed,
|
||||
#' with diagnostic data and the Flexibility Index shown on the plot.
|
||||
#' - `"data"`: data frame. The original input data appended with the
|
||||
#' Flexibility Index and the component scores.
|
||||
#' Flexibility Index and the component scores. Can be used with
|
||||
#' `plot_flex_index()` to recreate visuals found in `flex_index()`.
|
||||
#' - `"table"`: data frame. A summary table for the metric.
|
||||
#'
|
||||
#' @import dplyr
|
||||
|
@ -108,10 +109,9 @@
|
|||
#' # Return the raw data with the computed Flexibility Index
|
||||
#' em_data %>%
|
||||
#' flex_index(return = "data")
|
||||
#'
|
||||
#'
|
||||
#' }
|
||||
#' @family Work Patterns
|
||||
#'
|
||||
#' @family Working Patterns
|
||||
#'
|
||||
#' @export
|
||||
flex_index <- function(data,
|
||||
|
|
|
@ -8,6 +8,9 @@
|
|||
#' @description
|
||||
#' A demo dataset generated from a Group-to-Group Query from Workplace Analytics.
|
||||
#'
|
||||
#' @family Data
|
||||
#' @family Network
|
||||
#'
|
||||
#' @format A data frame with 3517 rows and 7 variables:
|
||||
#' \describe{
|
||||
#' \item{TimeInvestors_Organization}{ }
|
||||
|
|
|
@ -12,14 +12,20 @@
|
|||
#' @param title Character string to specify the title of the chunk.
|
||||
#' @param filename File name to be used in the exported HTML.
|
||||
#' @param outputs A list of outputs to be added to the HTML report.
|
||||
#' Note that `outputs`, `titles`, `echos`, and `levels` must have the same length
|
||||
#' @param titles A list/vector of character strings to specify the title of the chunks.
|
||||
#' @param subheaders A list/vector of character strings to specify the subheaders for each chunk.
|
||||
#' @param echos A list/vector of logical values to specify whether to display code.
|
||||
#' @param levels A list/vector of numeric value to specify the header level of the chunk.
|
||||
#' Note that `outputs`, `titles`, `echos`, and `levels` must have the same
|
||||
#' length
|
||||
#' @param titles A list/vector of character strings to specify the title of the
|
||||
#' chunks.
|
||||
#' @param subheaders A list/vector of character strings to specify the
|
||||
#' subheaders for each chunk.
|
||||
#' @param echos A list/vector of logical values to specify whether to display
|
||||
#' code.
|
||||
#' @param levels A list/vector of numeric value to specify the header level of
|
||||
#' the chunk.
|
||||
#' @param theme Character vector to specify theme to be used for the report.
|
||||
#' E.g. "united", "default".
|
||||
#' @param preamble A preamble to appear at the beginning of the report, passed as a text string.
|
||||
#' E.g. `"united"`, `"default"`.
|
||||
#' @param preamble A preamble to appear at the beginning of the report, passed
|
||||
#' as a text string.
|
||||
#'
|
||||
#' @importFrom purrr pmap
|
||||
#' @importFrom purrr reduce
|
||||
|
@ -32,6 +38,7 @@
|
|||
#'
|
||||
#' The first step is to define the content that will go into a report and assign
|
||||
#' the outputs to a list.
|
||||
#'
|
||||
#' ```
|
||||
#' # Step 1: Define Content
|
||||
#' output_list <-
|
||||
|
@ -39,7 +46,9 @@
|
|||
#' sq_data %>% workloads_summary(return = "table")) %>%
|
||||
#' purrr::map_if(is.data.frame, create_dt)
|
||||
#' ```
|
||||
#'
|
||||
#' The next step is to add a list of titles for each of the objects on the list:
|
||||
#'
|
||||
#' ```
|
||||
#' # Step 2: Add Corresponding Titles
|
||||
#' title_list <- c("Workloads Summary - Plot", "Workloads Summary - Table")
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#'
|
||||
#' @importFrom data.table ":=" "%like%" "%between%"
|
||||
#'
|
||||
#' @family Work Patterns
|
||||
#' @family Working Patterns
|
||||
#'
|
||||
#' @examples
|
||||
#' # Return plot
|
||||
|
|
|
@ -39,6 +39,8 @@
|
|||
#' @import ggplot2
|
||||
#' @import dplyr
|
||||
#'
|
||||
#' @family Network
|
||||
#'
|
||||
#' @examples
|
||||
#' # Return a network plot
|
||||
#' g2g_data %>% network_g2g()
|
||||
|
|
|
@ -3,26 +3,39 @@
|
|||
# Licensed under the MIT License. See LICENSE.txt in the project root for license information.
|
||||
# --------------------------------------------------------------------------------------------
|
||||
|
||||
#' @title Implement the Leiden community detection on a Person to Person network query
|
||||
#' @title Implement the Leiden community detection on a Person to Person network
|
||||
#' query
|
||||
#'
|
||||
#' @description
|
||||
#' `r lifecycle::badge('experimental')`
|
||||
#' Take a P2P network query and implement the Leiden community detection method. To run
|
||||
#' this function, you will require all the pre-requisites of the **leiden** package installed,
|
||||
#' which includes Python and **reticulate**.
|
||||
#'
|
||||
#' Take a P2P network query and implement the Leiden community detection method.
|
||||
#' To run this function, you will require all the pre-requisites of the
|
||||
#' 'leiden' package installed, which includes Python and 'reticulate'.
|
||||
#'
|
||||
#' @inheritParams network_p2p
|
||||
#'
|
||||
#' @param return
|
||||
#' String specifying what output to return. Defaults to "plot-leiden". Valid return options include:
|
||||
#' - 'plot-leiden': return a network plot coloured by leiden communities, saving a PDF to path.
|
||||
#' - 'plot-hrvar': return a network plot coloured by HR attribute, saving a PDF to path.
|
||||
#' - 'plot-sankey': return a sankey plot combining communities and HR attribute.
|
||||
#' - 'table': return a vertex summary table with counts in communities and HR attribute.
|
||||
#' - 'data': return a vertex data file that matches vertices with communities and HR attributes.
|
||||
#' - 'describe': return a list of data frames which describe each of the identified communities.
|
||||
#' The first data frame is a summary table of all the communities.
|
||||
#' - 'network': return igraph object.
|
||||
#' String specifying what output to return. Defaults to "plot-leiden". Valid
|
||||
#' return options include:
|
||||
#' - `'plot-leiden'`: return a network plot coloured by leiden communities,
|
||||
#' saving a PDF to path.
|
||||
#' - `'plot-hrvar'`: return a network plot coloured by HR attribute, saving a
|
||||
#' PDF to path.
|
||||
#' - `'plot-sankey'`: return a sankey plot combining communities and HR
|
||||
#' attribute.
|
||||
#' - `'table'`: return a vertex summary table with counts in communities and
|
||||
#' HR attribute.
|
||||
#' - `'data'`: return a vertex data file that matches vertices with
|
||||
#' communities and HR attributes.
|
||||
#' - `'describe'`: return a list of data frames which describe each of the
|
||||
#' identified communities. The first data frame is a summary table of all the
|
||||
#' communities.
|
||||
#' - `'network'`: return igraph object.
|
||||
#'
|
||||
#' @return See `return`.
|
||||
#'
|
||||
#' @family Network
|
||||
#'
|
||||
#' @examples
|
||||
#' \donttest{
|
||||
|
|
|
@ -3,25 +3,38 @@
|
|||
# Licensed under the MIT License. See LICENSE.txt in the project root for license information.
|
||||
# --------------------------------------------------------------------------------------------
|
||||
|
||||
#' @title Implement the Louvain community detection on a Person to Person network query
|
||||
#' @title Implement the Louvain community detection on a Person to Person
|
||||
#' network query
|
||||
#'
|
||||
#' @description
|
||||
#' `r lifecycle::badge('experimental')`
|
||||
#' Take a P2P network query and implement the Louvain community detection method. The
|
||||
#' **igraph** implementation of the Louvain method is used.
|
||||
#'
|
||||
#' Take a P2P network query and implement the Louvain community detection
|
||||
#' method. The 'igraph' implementation of the Louvain method is used.
|
||||
#'
|
||||
#' @inheritParams network_p2p
|
||||
#'
|
||||
#' @param return
|
||||
#' String specifying what output to return. Defaults to "plot-louvain". Valid return options include:
|
||||
#' - 'plot-louvain': return a network plot coloured by Louvain communities, saving a PDF to path.
|
||||
#' - 'plot-hrvar': return a network plot coloured by HR attribute, saving a PDF to path.
|
||||
#' - 'plot-sankey': return a sankey plot combining communities and HR attribute.
|
||||
#' - 'table': return a vertex summary table with counts in communities and HR attribute.
|
||||
#' - 'data': return a vertex data file that matches vertices with communities and HR attributes.
|
||||
#' - 'describe': return a list of data frames which describe each of the identified communities.
|
||||
#' The first data frame is a summary table of all the communities.
|
||||
#' - 'network': return igraph object.
|
||||
#' String specifying what output to return. Defaults to "plot-louvain". Valid
|
||||
#' return options include:
|
||||
#' - `'plot-louvain'`: return a network plot coloured by Louvain communities,
|
||||
#' saving a PDF to path.
|
||||
#' - `'plot-hrvar'`: return a network plot coloured by HR attribute, saving a
|
||||
#' PDF to path.
|
||||
#' - `'plot-sankey'`: return a sankey plot combining communities and HR
|
||||
#' attribute.
|
||||
#' - `'table'`: return a vertex summary table with counts in communities and
|
||||
#' HR attribute.
|
||||
#' - `'data'`: return a vertex data file that matches vertices with
|
||||
#' communities and HR attributes.
|
||||
#' - `'describe'`: return a list of data frames which describe each of the
|
||||
#' identified communities. The first data frame is a summary table of all the
|
||||
#' communities.
|
||||
#' - `'network'`: return igraph object.
|
||||
#'
|
||||
#' @return See `return`.
|
||||
#'
|
||||
#' @family Network
|
||||
#'
|
||||
#' @examples
|
||||
#' # Simulate a small person-to-person dataset
|
||||
|
@ -40,7 +53,9 @@ network_louvain <- function(data,
|
|||
node_alpha = 0.8,
|
||||
algorithm = "mds",
|
||||
path = "network_p2p_louvain",
|
||||
desc_hrvar = c("Organization", "LevelDesignation", "FunctionType"),
|
||||
desc_hrvar = c("Organization",
|
||||
"LevelDesignation",
|
||||
"FunctionType"),
|
||||
return = "plot-louvain",
|
||||
size_threshold = 5000){
|
||||
|
||||
|
|
|
@ -8,50 +8,67 @@
|
|||
#' @description
|
||||
#' `r lifecycle::badge('experimental')`
|
||||
#'
|
||||
#' Pass a data frame containing a person-to-person query and return a network visualization.
|
||||
#' Options are available for community detection using either the Louvain or the Leiden algorithms.
|
||||
#' Pass a data frame containing a person-to-person query and return a network
|
||||
#' visualization. Options are available for community detection using either the
|
||||
#' Louvain or the Leiden algorithms.
|
||||
#'
|
||||
#'
|
||||
#' @param data Data frame containing a person-to-person query.
|
||||
#' @param hrvar String containing the label for the HR attribute.
|
||||
#' @param display String determining what output to return. Valid values include:
|
||||
#' - `"hrvar"` (default): compute analysis or visuals without computing communities.
|
||||
#' - `"louvain"`: compute analysis or visuals with community detection, using the Louvain
|
||||
#' algorithm.
|
||||
#' - `"leiden"`: compute analysis or visuals with community detection, using the Leiden algorithm.
|
||||
#' This requires all the pre-requisites of the **leiden** package installed,
|
||||
#' which includes Python and **reticulate**.
|
||||
#' @param display String determining what output to return. Valid values
|
||||
#' include:
|
||||
#' - `"hrvar"` (default): compute analysis or visuals without computing
|
||||
#' communities.
|
||||
#' - `"louvain"`: compute analysis or visuals with community detection, using
|
||||
#' the Louvain algorithm.
|
||||
#' - `"leiden"`: compute analysis or visuals with community detection, using
|
||||
#' the Leiden algorithm. This requires all the pre-requisites of the
|
||||
#' **leiden** package installed, which includes Python and **reticulate**.
|
||||
#'
|
||||
#' @param return String specifying what output to return. Defaults to "plot".
|
||||
#' Valid return options include:
|
||||
#' - `'plot'`: return a network plot.
|
||||
#' - `'sankey'`: return a sankey plot combining communities and HR attribute. This is only valid if
|
||||
#' a community detection method is selected at `display`.
|
||||
#' - `'table'`: return a vertex summary table with counts in communities and HR attribute.
|
||||
#' - `'data'`: return a vertex data file that matches vertices with communities and HR attributes.
|
||||
#' - `'describe'`: return a list of data frames which describe each of the identified communities.
|
||||
#' The first data frame is a summary table of all the communities. This is only valid if a community
|
||||
#' detection method is selected at `display`.
|
||||
#' - `'sankey'`: return a sankey plot combining communities and HR attribute.
|
||||
#' This is only valid if a community detection method is selected at
|
||||
#' `display`.
|
||||
#' - `'table'`: return a vertex summary table with counts in communities and
|
||||
#' HR attribute.
|
||||
#' - `'data'`: return a vertex data file that matches vertices with
|
||||
#' communities and HR attributes.
|
||||
#' - `'describe'`: return a list of data frames which describe each of the
|
||||
#' identified communities. The first data frame is a summary table of all the
|
||||
#' communities. This is only valid if a community detection method is selected
|
||||
#' at `display`.
|
||||
#' - `'network'`: return igraph object.
|
||||
#'
|
||||
#' @param path File path for saving the PDF output. Defaults to a timestamped path based on current parameters.
|
||||
#' @param desc_hrvar Character vector of length 3 containing the HR attributes to use when returning the
|
||||
#' "describe" output. See `network_describe()`.
|
||||
#' @param path File path for saving the PDF output. Defaults to a timestamped
|
||||
#' path based on current parameters.
|
||||
#' @param desc_hrvar Character vector of length 3 containing the HR attributes
|
||||
#' to use when returning the `"describe"` output. See `network_describe()`.
|
||||
#' @param bg_fill String to specify background fill colour.
|
||||
#' @param font_col String to specify font and link colour.
|
||||
#' @param legend_pos String to specify position of legend. Defaults to "bottom". See `ggplot2::theme()`.
|
||||
#' @param palette Function for generating a colour palette with a single argument `n`. Uses "rainbow" by default.
|
||||
#' @param node_alpha A numeric value between 0 and 1 to specify the transparency of the nodes.
|
||||
#' @param res Resolution parameter to be passed to `leiden::leiden()`. Defaults to 0.5.
|
||||
#' @param seed Seed for the random number generator passed to `leiden::leiden()` to ensure consistency. Only applicable
|
||||
#' when `display` is set to "leiden".
|
||||
#' @param algorithm String to specify the node placement algorithm to be used. Defaults to "fr" for the force-directed
|
||||
#' algorithm of Fruchterman and Reingold. See <https://rdrr.io/cran/ggraph/man/layout_tbl_graph_igraph.html> for a
|
||||
#' full list of options.
|
||||
#' @param size_threshold Numeric value representing the maximum number of edges before `network_leiden()`
|
||||
#' switches to use a more efficient, but less elegant plotting method (native igraph). Defaults to 5000.
|
||||
#' Set as `0` to co-erce to a fast plotting method every time, and `Inf` to always use the default plotting
|
||||
#' method.
|
||||
#' @param legend_pos String to specify position of legend. Defaults to
|
||||
#' `"bottom"`. See `ggplot2::theme()`.
|
||||
#' @param palette Function for generating a colour palette with a single
|
||||
#' argument `n`. Uses "rainbow" by default.
|
||||
#' @param node_alpha A numeric value between 0 and 1 to specify the transparency
|
||||
#' of the nodes.
|
||||
#' @param res Resolution parameter to be passed to `leiden::leiden()`. Defaults
|
||||
#' to 0.5.
|
||||
#' @param seed Seed for the random number generator passed to `leiden::leiden()`
|
||||
#' to ensure consistency. Only applicable when `display` is set to `"leiden"`.
|
||||
#' @param algorithm String to specify the node placement algorithm to be used.
|
||||
#' Defaults to `"fr"` for the force-directed algorithm of Fruchterman and
|
||||
#' Reingold. See
|
||||
#' <https://rdrr.io/cran/ggraph/man/layout_tbl_graph_igraph.html> for a full
|
||||
#' list of options.
|
||||
#' @param size_threshold Numeric value representing the maximum number of edges
|
||||
#' before `network_leiden()` switches to use a more efficient, but less
|
||||
#' elegant plotting method (native igraph). Defaults to 5000. Set as `0` to
|
||||
#' coerce to a fast plotting method every time, and `Inf` to always use the
|
||||
#' default plotting method.
|
||||
#'
|
||||
#' @family Network
|
||||
#'
|
||||
#' @examples
|
||||
#' # Simulate a small person-to-person dataset
|
||||
|
@ -302,7 +319,7 @@ network_p2p <- function(data,
|
|||
|
||||
plot_output <-
|
||||
g_layout +
|
||||
ggraph::geom_edge_link(colour = "lightgrey", edge_width = 0.01, alpha = 0.15) +
|
||||
ggraph::geom_edge_link(colour = "lightgrey", edge_width = 0.05, alpha = 0.15) +
|
||||
ggraph::geom_node_point(aes(colour = !!sym(v_attr)),
|
||||
alpha = node_alpha,
|
||||
pch = 16) +
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
#' @title Simulate a person-to-person query using a Watts-Strogatz model
|
||||
#'
|
||||
#' @description Generate an person-to-person query / edgelist based on the graph
|
||||
#' according to the Watts-Strogatz small-world network model. Organizational data
|
||||
#' fields are also simulated for `Organization`, `LevelDesignation`, and `City`.
|
||||
#' according to the Watts-Strogatz small-world network model. Organizational
|
||||
#' data fields are also simulated for `Organization`, `LevelDesignation`, and
|
||||
#' `City`.
|
||||
#'
|
||||
#' @param dim Integer constant, the dimension of the starting lattice.
|
||||
#' @param size Integer constant, the size of the lattice along each dimension.
|
||||
|
@ -11,14 +12,17 @@
|
|||
#' @param p Real constant between zero and one, the rewiring probability.
|
||||
#'
|
||||
#' @details
|
||||
#' This is a wrapper around `igraph::watts.strogatz.game()`. See igraph documentation
|
||||
#' for details on methodology. Loop edges and multiple edges are disabled. Size of the
|
||||
#' network can be changing the arguments `size` and `nei`.
|
||||
#' This is a wrapper around `igraph::watts.strogatz.game()`. See igraph
|
||||
#' documentation for details on methodology. Loop edges and multiple edges are
|
||||
#' disabled. Size of the network can be changing the arguments `size` and `nei`.
|
||||
#'
|
||||
#' @examples
|
||||
#' # Simulate a p2p dataset with 800 edges
|
||||
#' p2p_data_sim(size = 200, nei = 4)
|
||||
#'
|
||||
#' @family Data
|
||||
#' @family Network
|
||||
#'
|
||||
#' @export
|
||||
p2p_data_sim <- function(dim = 1,
|
||||
size = 300,
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#' @title Plot a Sample of Working Patterns using Flexibility Index output
|
||||
#'
|
||||
#' @description This is a helper function for plotting visualizations for the Flexibility Index
|
||||
#' using the `data` output from `flex_index()`. This is used within `flex_index()` itself
|
||||
#' as an internal function.
|
||||
#' @description This is a helper function for plotting visualizations for the
|
||||
#' Flexibility Index using the `data` output from `flex_index()`. This is used
|
||||
#' within `flex_index()` itself as an internal function.
|
||||
#'
|
||||
#' @param data Data frame. Direct data output from `flex_index()`.
|
||||
#' @param sig_label Character string for identifying signal labels.
|
||||
|
@ -17,27 +17,24 @@
|
|||
#' @import ggplot2
|
||||
#' @importFrom data.table ":=" "%like%" "%between%"
|
||||
#'
|
||||
#' @family Work Patterns
|
||||
#' @family Working Patterns
|
||||
#'
|
||||
#' @examples
|
||||
#' \donttest{
|
||||
#' # Pre-calculate Flexibility Index
|
||||
#' fi_output <- flex_index(em_data, return = "data")
|
||||
#'
|
||||
#'
|
||||
#' # Examples of how to test the plotting options individually
|
||||
#' # Sample of 10 work patterns
|
||||
#' em_data %>%
|
||||
#' flex_index(return = "data") %>%
|
||||
#' plot_flex_index(method = "sample")
|
||||
#' plot_flex_index(fi_output, method = "sample")
|
||||
#'
|
||||
#' # 10 most common work patterns
|
||||
#' em_data %>%
|
||||
#' flex_index(return = "data") %>%
|
||||
#' plot_flex_index(method = "common")
|
||||
#' plot_flex_index(fi_output, method = "common")
|
||||
#'
|
||||
#' # Plot Flexibility Index over time
|
||||
#' em_data %>%
|
||||
#' flex_index(return = "data") %>%
|
||||
#' plot_flex_index(method = "time")
|
||||
#' plot_flex_index(fi_output, method = "time")
|
||||
#'
|
||||
#' }
|
||||
#' @return ggplot object. See `method`.
|
||||
#'
|
||||
#' @export
|
||||
plot_flex_index <- function(data,
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
#' # Return summary table
|
||||
#' workpatterns_area(em_data, return = "table")
|
||||
#'
|
||||
#' @family Work Patterns
|
||||
#' @family Working Patterns
|
||||
#'
|
||||
#' @export
|
||||
workpatterns_area <- function(data,
|
||||
|
|
|
@ -127,7 +127,7 @@
|
|||
#'
|
||||
#' }
|
||||
#'
|
||||
#' @family Work Patterns
|
||||
#' @family Working Patterns
|
||||
#'
|
||||
#' @export
|
||||
workpatterns_classify <- function(data,
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
#' }
|
||||
#'
|
||||
#'
|
||||
#' @family Work Patterns
|
||||
#' @family Working Patterns
|
||||
#'
|
||||
workpatterns_classify_bw <- function(data,
|
||||
hrvar = NULL,
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
#' workpatterns_classify_pav(em_data, return = "plot-area")
|
||||
#' }
|
||||
#'
|
||||
#' @family Work Patterns
|
||||
#' @family Working Patterns
|
||||
#'
|
||||
workpatterns_classify_pav <- function(data,
|
||||
values = "percent",
|
||||
|
|
|
@ -87,7 +87,7 @@
|
|||
#'
|
||||
#' }
|
||||
#'
|
||||
#' @family Work Patterns
|
||||
#' @family Working Patterns
|
||||
#'
|
||||
#' @export
|
||||
workpatterns_hclust <- function(data,
|
||||
|
|
|
@ -94,6 +94,7 @@ Other Visualization:
|
|||
\code{\link{email_rank}()},
|
||||
\code{\link{email_summary}()},
|
||||
\code{\link{email_trend}()},
|
||||
\code{\link{external_network_plot}()},
|
||||
\code{\link{hrvar_count}()}
|
||||
|
||||
Other After-hours Collaboration:
|
||||
|
|
|
@ -78,6 +78,7 @@ Other Visualization:
|
|||
\code{\link{email_rank}()},
|
||||
\code{\link{email_summary}()},
|
||||
\code{\link{email_trend}()},
|
||||
\code{\link{external_network_plot}()},
|
||||
\code{\link{hrvar_count}()}
|
||||
|
||||
Other After-hours Collaboration:
|
||||
|
|
|
@ -82,6 +82,7 @@ Other Visualization:
|
|||
\code{\link{email_rank}()},
|
||||
\code{\link{email_summary}()},
|
||||
\code{\link{email_trend}()},
|
||||
\code{\link{external_network_plot}()},
|
||||
\code{\link{hrvar_count}()}
|
||||
|
||||
Other After-hours Collaboration:
|
||||
|
|
|
@ -69,6 +69,7 @@ Other Visualization:
|
|||
\code{\link{email_rank}()},
|
||||
\code{\link{email_summary}()},
|
||||
\code{\link{email_trend}()},
|
||||
\code{\link{external_network_plot}()},
|
||||
\code{\link{hrvar_count}()}
|
||||
|
||||
Other After-hours Collaboration:
|
||||
|
|
|
@ -82,6 +82,7 @@ Other Visualization:
|
|||
\code{\link{email_rank}()},
|
||||
\code{\link{email_summary}()},
|
||||
\code{\link{email_trend}()},
|
||||
\code{\link{external_network_plot}()},
|
||||
\code{\link{hrvar_count}()}
|
||||
|
||||
Other After-hours Collaboration:
|
||||
|
|
|
@ -71,6 +71,7 @@ Other Visualization:
|
|||
\code{\link{email_rank}()},
|
||||
\code{\link{email_summary}()},
|
||||
\code{\link{email_trend}()},
|
||||
\code{\link{external_network_plot}()},
|
||||
\code{\link{hrvar_count}()}
|
||||
|
||||
Other After-hours Collaboration:
|
||||
|
|
|
@ -25,6 +25,7 @@ Other Support:
|
|||
\code{\link{combine_signals}()},
|
||||
\code{\link{cut_hour}()},
|
||||
\code{\link{extract_date_range}()},
|
||||
\code{\link{extract_hr}()},
|
||||
\code{\link{rgb2hex}()}
|
||||
}
|
||||
\concept{Support}
|
||||
|
|
|
@ -44,6 +44,7 @@ Other Support:
|
|||
\code{\link{combine_signals}()},
|
||||
\code{\link{cut_hour}()},
|
||||
\code{\link{extract_date_range}()},
|
||||
\code{\link{extract_hr}()},
|
||||
\code{\link{rgb2hex}()}
|
||||
}
|
||||
\concept{Support}
|
||||
|
|
|
@ -53,6 +53,7 @@ check_query(sq_data)
|
|||
}
|
||||
\seealso{
|
||||
Other Data Validation:
|
||||
\code{\link{extract_hr}()},
|
||||
\code{\link{flag_ch_ratio}()},
|
||||
\code{\link{flag_em_ratio}()},
|
||||
\code{\link{flag_extreme}()},
|
||||
|
|
|
@ -91,6 +91,7 @@ Other Visualization:
|
|||
\code{\link{email_rank}()},
|
||||
\code{\link{email_summary}()},
|
||||
\code{\link{email_trend}()},
|
||||
\code{\link{external_network_plot}()},
|
||||
\code{\link{hrvar_count}()}
|
||||
|
||||
Other Collaboration:
|
||||
|
|
|
@ -99,6 +99,7 @@ Other Visualization:
|
|||
\code{\link{email_rank}()},
|
||||
\code{\link{email_summary}()},
|
||||
\code{\link{email_trend}()},
|
||||
\code{\link{external_network_plot}()},
|
||||
\code{\link{hrvar_count}()}
|
||||
|
||||
Other Collaboration:
|
||||
|
|
|
@ -81,6 +81,7 @@ Other Visualization:
|
|||
\code{\link{email_rank}()},
|
||||
\code{\link{email_summary}()},
|
||||
\code{\link{email_trend}()},
|
||||
\code{\link{external_network_plot}()},
|
||||
\code{\link{hrvar_count}()}
|
||||
|
||||
Other Collaboration:
|
||||
|
|
|
@ -83,6 +83,7 @@ Other Visualization:
|
|||
\code{\link{email_rank}()},
|
||||
\code{\link{email_summary}()},
|
||||
\code{\link{email_trend}()},
|
||||
\code{\link{external_network_plot}()},
|
||||
\code{\link{hrvar_count}()}
|
||||
|
||||
Other Collaboration:
|
||||
|
|
|
@ -77,6 +77,7 @@ Other Visualization:
|
|||
\code{\link{email_rank}()},
|
||||
\code{\link{email_summary}()},
|
||||
\code{\link{email_trend}()},
|
||||
\code{\link{external_network_plot}()},
|
||||
\code{\link{hrvar_count}()}
|
||||
|
||||
Other Collaboration:
|
||||
|
|
|
@ -77,6 +77,7 @@ Other Visualization:
|
|||
\code{\link{email_rank}()},
|
||||
\code{\link{email_summary}()},
|
||||
\code{\link{email_trend}()},
|
||||
\code{\link{external_network_plot}()},
|
||||
\code{\link{hrvar_count}()}
|
||||
|
||||
Other Collaboration:
|
||||
|
|
|
@ -68,6 +68,7 @@ Other Visualization:
|
|||
\code{\link{email_rank}()},
|
||||
\code{\link{email_summary}()},
|
||||
\code{\link{email_trend}()},
|
||||
\code{\link{external_network_plot}()},
|
||||
\code{\link{hrvar_count}()}
|
||||
|
||||
Other Collaboration:
|
||||
|
|
|
@ -39,6 +39,7 @@ Other Support:
|
|||
\code{\link{check_inputs}()},
|
||||
\code{\link{cut_hour}()},
|
||||
\code{\link{extract_date_range}()},
|
||||
\code{\link{extract_hr}()},
|
||||
\code{\link{rgb2hex}()}
|
||||
}
|
||||
\concept{Support}
|
||||
|
|
|
@ -102,6 +102,7 @@ Other Visualization:
|
|||
\code{\link{email_rank}()},
|
||||
\code{\link{email_summary}()},
|
||||
\code{\link{email_trend}()},
|
||||
\code{\link{external_network_plot}()},
|
||||
\code{\link{hrvar_count}()}
|
||||
|
||||
Other Flexible:
|
||||
|
|
|
@ -126,6 +126,7 @@ Other Visualization:
|
|||
\code{\link{email_rank}()},
|
||||
\code{\link{email_summary}()},
|
||||
\code{\link{email_trend}()},
|
||||
\code{\link{external_network_plot}()},
|
||||
\code{\link{hrvar_count}()}
|
||||
|
||||
Other Flexible:
|
||||
|
|
|
@ -102,6 +102,7 @@ Other Visualization:
|
|||
\code{\link{email_rank}()},
|
||||
\code{\link{email_summary}()},
|
||||
\code{\link{email_trend}()},
|
||||
\code{\link{external_network_plot}()},
|
||||
\code{\link{hrvar_count}()}
|
||||
|
||||
Other Flexible:
|
||||
|
|
|
@ -99,6 +99,7 @@ Other Visualization:
|
|||
\code{\link{email_rank}()},
|
||||
\code{\link{email_summary}()},
|
||||
\code{\link{email_trend}()},
|
||||
\code{\link{external_network_plot}()},
|
||||
\code{\link{hrvar_count}()}
|
||||
|
||||
Other Flexible:
|
||||
|
|
|
@ -99,6 +99,7 @@ Other Visualization:
|
|||
\code{\link{email_rank}()},
|
||||
\code{\link{email_summary}()},
|
||||
\code{\link{email_trend}()},
|
||||
\code{\link{external_network_plot}()},
|
||||
\code{\link{hrvar_count}()}
|
||||
|
||||
Other Flexible:
|
||||
|
|
|
@ -89,6 +89,7 @@ Other Visualization:
|
|||
\code{\link{email_rank}()},
|
||||
\code{\link{email_summary}()},
|
||||
\code{\link{email_trend}()},
|
||||
\code{\link{external_network_plot}()},
|
||||
\code{\link{hrvar_count}()}
|
||||
|
||||
Other Flexible:
|
||||
|
|
|
@ -93,6 +93,7 @@ Other Visualization:
|
|||
\code{\link{email_rank}()},
|
||||
\code{\link{email_summary}()},
|
||||
\code{\link{email_trend}()},
|
||||
\code{\link{external_network_plot}()},
|
||||
\code{\link{hrvar_count}()}
|
||||
|
||||
Other Flexible:
|
||||
|
|
|
@ -97,6 +97,7 @@ Other Visualization:
|
|||
\code{\link{email_rank}()},
|
||||
\code{\link{email_summary}()},
|
||||
\code{\link{email_trend}()},
|
||||
\code{\link{external_network_plot}()},
|
||||
\code{\link{hrvar_count}()}
|
||||
|
||||
Other Flexible:
|
||||
|
|
|
@ -107,6 +107,7 @@ Other Visualization:
|
|||
\code{\link{email_rank}()},
|
||||
\code{\link{email_summary}()},
|
||||
\code{\link{email_trend}()},
|
||||
\code{\link{external_network_plot}()},
|
||||
\code{\link{hrvar_count}()}
|
||||
|
||||
Other Flexible:
|
||||
|
|
|
@ -117,6 +117,7 @@ Other Visualization:
|
|||
\code{\link{email_rank}()},
|
||||
\code{\link{email_summary}()},
|
||||
\code{\link{email_trend}()},
|
||||
\code{\link{external_network_plot}()},
|
||||
\code{\link{hrvar_count}()}
|
||||
|
||||
Other Flexible:
|
||||
|
|
|
@ -74,6 +74,7 @@ Other Visualization:
|
|||
\code{\link{email_rank}()},
|
||||
\code{\link{email_summary}()},
|
||||
\code{\link{email_trend}()},
|
||||
\code{\link{external_network_plot}()},
|
||||
\code{\link{hrvar_count}()}
|
||||
|
||||
Other Flexible:
|
||||
|
|
|
@ -90,6 +90,7 @@ Other Visualization:
|
|||
\code{\link{email_rank}()},
|
||||
\code{\link{email_summary}()},
|
||||
\code{\link{email_trend}()},
|
||||
\code{\link{external_network_plot}()},
|
||||
\code{\link{hrvar_count}()}
|
||||
|
||||
Other Flexible:
|
||||
|
|
|
@ -103,6 +103,7 @@ Other Visualization:
|
|||
\code{\link{email_rank}()},
|
||||
\code{\link{email_summary}()},
|
||||
\code{\link{email_trend}()},
|
||||
\code{\link{external_network_plot}()},
|
||||
\code{\link{hrvar_count}()}
|
||||
|
||||
Other Flexible:
|
||||
|
|
|
@ -74,6 +74,7 @@ Other Visualization:
|
|||
\code{\link{email_rank}()},
|
||||
\code{\link{email_summary}()},
|
||||
\code{\link{email_trend}()},
|
||||
\code{\link{external_network_plot}()},
|
||||
\code{\link{hrvar_count}()}
|
||||
|
||||
Other Flexible:
|
||||
|
|
|
@ -35,6 +35,7 @@ Other Support:
|
|||
\code{\link{check_inputs}()},
|
||||
\code{\link{combine_signals}()},
|
||||
\code{\link{extract_date_range}()},
|
||||
\code{\link{extract_hr}()},
|
||||
\code{\link{rgb2hex}()}
|
||||
}
|
||||
\concept{Support}
|
||||
|
|
|
@ -91,7 +91,9 @@ A dataset generated from a Standard Person Query from Workplace Analytics.
|
|||
}
|
||||
\seealso{
|
||||
Other Data:
|
||||
\code{\link{em_data}}
|
||||
\code{\link{em_data}},
|
||||
\code{\link{g2g_data}},
|
||||
\code{\link{p2p_data_sim}()}
|
||||
}
|
||||
\concept{Data}
|
||||
\keyword{datasets}
|
||||
|
|
|
@ -80,7 +80,9 @@ columns for both IMs sent and Emails sent.
|
|||
}
|
||||
\seealso{
|
||||
Other Data:
|
||||
\code{\link{dv_data}}
|
||||
\code{\link{dv_data}},
|
||||
\code{\link{g2g_data}},
|
||||
\code{\link{p2p_data_sim}()}
|
||||
}
|
||||
\concept{Data}
|
||||
\keyword{datasets}
|
||||
|
|
|
@ -91,6 +91,7 @@ Other Visualization:
|
|||
\code{\link{email_rank}()},
|
||||
\code{\link{email_summary}()},
|
||||
\code{\link{email_trend}()},
|
||||
\code{\link{external_network_plot}()},
|
||||
\code{\link{hrvar_count}()}
|
||||
|
||||
Other Emails:
|
||||
|
|
|
@ -76,6 +76,7 @@ Other Visualization:
|
|||
\code{\link{email_rank}()},
|
||||
\code{\link{email_summary}()},
|
||||
\code{\link{email_trend}()},
|
||||
\code{\link{external_network_plot}()},
|
||||
\code{\link{hrvar_count}()}
|
||||
|
||||
Other Emails:
|
||||
|
|
|
@ -77,6 +77,7 @@ Other Visualization:
|
|||
\code{\link{email_rank}()},
|
||||
\code{\link{email_summary}()},
|
||||
\code{\link{email_trend}()},
|
||||
\code{\link{external_network_plot}()},
|
||||
\code{\link{hrvar_count}()}
|
||||
|
||||
Other Emails:
|
||||
|
|
|
@ -77,6 +77,7 @@ Other Visualization:
|
|||
\code{\link{email_line}()},
|
||||
\code{\link{email_summary}()},
|
||||
\code{\link{email_trend}()},
|
||||
\code{\link{external_network_plot}()},
|
||||
\code{\link{hrvar_count}()}
|
||||
|
||||
Other Emails:
|
||||
|
|
|
@ -79,6 +79,7 @@ Other Visualization:
|
|||
\code{\link{email_line}()},
|
||||
\code{\link{email_rank}()},
|
||||
\code{\link{email_trend}()},
|
||||
\code{\link{external_network_plot}()},
|
||||
\code{\link{hrvar_count}()}
|
||||
|
||||
Other Emails:
|
||||
|
|
|
@ -63,6 +63,7 @@ Other Visualization:
|
|||
\code{\link{email_line}()},
|
||||
\code{\link{email_rank}()},
|
||||
\code{\link{email_summary}()},
|
||||
\code{\link{external_network_plot}()},
|
||||
\code{\link{hrvar_count}()}
|
||||
|
||||
Other Emails:
|
||||
|
|
|
@ -28,9 +28,12 @@ following strings: - \code{"plot"} - \code{"table"}}
|
|||
of the bubbles}
|
||||
}
|
||||
\description{
|
||||
Plot the external network metrics for a HR variable as a scatter plot, showing
|
||||
External Network Breadth as the vertical axis and External Network Size as the
|
||||
horizontal axis.
|
||||
Plot the external network metrics for a HR variable as a scatter plot,
|
||||
showing 'External Network Breadth' as the vertical axis and 'External Network
|
||||
Size' as the horizontal axis.
|
||||
}
|
||||
\details{
|
||||
Uses the metrics \code{External_network_size} and \code{Networking_outside_company}.
|
||||
}
|
||||
\examples{
|
||||
# Return plot
|
||||
|
@ -38,7 +41,49 @@ sq_data \%>\% external_network_plot(return = "plot")
|
|||
|
||||
}
|
||||
\seealso{
|
||||
Other Connectivity:
|
||||
\code{\link{internal_network_plot}()}
|
||||
Other Visualization:
|
||||
\code{\link{afterhours_dist}()},
|
||||
\code{\link{afterhours_fizz}()},
|
||||
\code{\link{afterhours_line}()},
|
||||
\code{\link{afterhours_rank}()},
|
||||
\code{\link{afterhours_summary}()},
|
||||
\code{\link{afterhours_trend}()},
|
||||
\code{\link{collaboration_area}()},
|
||||
\code{\link{collaboration_dist}()},
|
||||
\code{\link{collaboration_fizz}()},
|
||||
\code{\link{collaboration_line}()},
|
||||
\code{\link{collaboration_rank}()},
|
||||
\code{\link{collaboration_sum}()},
|
||||
\code{\link{collaboration_trend}()},
|
||||
\code{\link{create_bar_asis}()},
|
||||
\code{\link{create_bar}()},
|
||||
\code{\link{create_boxplot}()},
|
||||
\code{\link{create_bubble}()},
|
||||
\code{\link{create_dist}()},
|
||||
\code{\link{create_fizz}()},
|
||||
\code{\link{create_line_asis}()},
|
||||
\code{\link{create_line}()},
|
||||
\code{\link{create_period_scatter}()},
|
||||
\code{\link{create_rank}()},
|
||||
\code{\link{create_sankey}()},
|
||||
\code{\link{create_scatter}()},
|
||||
\code{\link{create_stacked}()},
|
||||
\code{\link{create_trend}()},
|
||||
\code{\link{email_dist}()},
|
||||
\code{\link{email_fizz}()},
|
||||
\code{\link{email_line}()},
|
||||
\code{\link{email_rank}()},
|
||||
\code{\link{email_summary}()},
|
||||
\code{\link{email_trend}()},
|
||||
\code{\link{hrvar_count}()}
|
||||
|
||||
Other Network:
|
||||
\code{\link{g2g_data}},
|
||||
\code{\link{network_g2g}()},
|
||||
\code{\link{network_leiden}()},
|
||||
\code{\link{network_louvain}()},
|
||||
\code{\link{network_p2p}()},
|
||||
\code{\link{p2p_data_sim}()}
|
||||
}
|
||||
\concept{Connectivity}
|
||||
\concept{Network}
|
||||
\concept{Visualization}
|
||||
|
|
|
@ -26,6 +26,7 @@ Other Support:
|
|||
\code{\link{check_inputs}()},
|
||||
\code{\link{combine_signals}()},
|
||||
\code{\link{cut_hour}()},
|
||||
\code{\link{extract_hr}()},
|
||||
\code{\link{rgb2hex}()}
|
||||
}
|
||||
\concept{Support}
|
||||
|
|
|
@ -46,7 +46,34 @@ sq_data \%>\% extract_hr(return = "vars")
|
|||
|
||||
}
|
||||
\seealso{
|
||||
Other General:
|
||||
\code{\link{identify_outlier}()}
|
||||
Other Support:
|
||||
\code{\link{camel_clean}()},
|
||||
\code{\link{check_inputs}()},
|
||||
\code{\link{combine_signals}()},
|
||||
\code{\link{cut_hour}()},
|
||||
\code{\link{extract_date_range}()},
|
||||
\code{\link{rgb2hex}()}
|
||||
|
||||
Other Data Validation:
|
||||
\code{\link{check_query}()},
|
||||
\code{\link{flag_ch_ratio}()},
|
||||
\code{\link{flag_em_ratio}()},
|
||||
\code{\link{flag_extreme}()},
|
||||
\code{\link{flag_outlooktime}()},
|
||||
\code{\link{hr_trend}()},
|
||||
\code{\link{hrvar_count_all}()},
|
||||
\code{\link{hrvar_count}()},
|
||||
\code{\link{identify_holidayweeks}()},
|
||||
\code{\link{identify_inactiveweeks}()},
|
||||
\code{\link{identify_nkw}()},
|
||||
\code{\link{identify_outlier}()},
|
||||
\code{\link{identify_privacythreshold}()},
|
||||
\code{\link{identify_query}()},
|
||||
\code{\link{identify_tenure}()},
|
||||
\code{\link{remove_outliers}()},
|
||||
\code{\link{subject_validate_report}()},
|
||||
\code{\link{subject_validate}()},
|
||||
\code{\link{track_HR_change}()}
|
||||
}
|
||||
\concept{General}
|
||||
\concept{Data Validation}
|
||||
\concept{Support}
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
% Please edit documentation in R/flag_ch_ratio.R
|
||||
\name{flag_ch_ratio}
|
||||
\alias{flag_ch_ratio}
|
||||
\title{Flag unusual high collaboration hours to after-hours collaboration hours ratio}
|
||||
\title{Flag unusual high collaboration hours to after-hours collaboration
|
||||
hours ratio}
|
||||
\usage{
|
||||
flag_ch_ratio(data, threshold = c(1, 30), return = "message")
|
||||
}
|
||||
|
@ -20,11 +21,13 @@ Defaults to 30.}
|
|||
}}
|
||||
}
|
||||
\value{
|
||||
A different output is returned depending on the value passed to the \code{return} argument:
|
||||
A different output is returned depending on the value passed to the \code{return}
|
||||
argument:
|
||||
\itemize{
|
||||
\item \code{"message"}: message in the console containing diagnotic summary
|
||||
\item \code{"text"}: string containing diagnotic summary
|
||||
\item \code{"data"}: data frame. Person-level data with flags on unusually high or low ratios
|
||||
\item \code{"data"}: data frame. Person-level data with flags on unusually high or
|
||||
low ratios
|
||||
}
|
||||
}
|
||||
\description{
|
||||
|
@ -45,6 +48,7 @@ data.frame(PersonId = c("Alice", "Bob"),
|
|||
\seealso{
|
||||
Other Data Validation:
|
||||
\code{\link{check_query}()},
|
||||
\code{\link{extract_hr}()},
|
||||
\code{\link{flag_em_ratio}()},
|
||||
\code{\link{flag_extreme}()},
|
||||
\code{\link{flag_outlooktime}()},
|
||||
|
|
|
@ -9,10 +9,26 @@ flag_em_ratio(data, threshold = 1, return = "text")
|
|||
\arguments{
|
||||
\item{data}{A data frame containing a Person Query.}
|
||||
|
||||
\item{threshold}{Numeric value specifying the threshold for flagging. Defaults to 1.}
|
||||
\item{threshold}{Numeric value specifying the threshold for flagging.
|
||||
Defaults to 1.}
|
||||
|
||||
\item{return}{Character vector specifying what to return. Defaults to "text", with
|
||||
valid options to return a data frame ("data").}
|
||||
\item{return}{String specifying what to return. This must be one of the
|
||||
following strings:
|
||||
\itemize{
|
||||
\item \code{"text"}
|
||||
\item \code{"data"}
|
||||
}
|
||||
|
||||
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{"text"}: string. A diagnostic message.
|
||||
\item \code{"data"}: data frame. Person-level data with those flagged with unusual
|
||||
ratios.
|
||||
}
|
||||
}
|
||||
\description{
|
||||
This function flags persons who have an unusual ratio
|
||||
|
@ -27,6 +43,7 @@ flag_em_ratio(sq_data)
|
|||
\seealso{
|
||||
Other Data Validation:
|
||||
\code{\link{check_query}()},
|
||||
\code{\link{extract_hr}()},
|
||||
\code{\link{flag_ch_ratio}()},
|
||||
\code{\link{flag_extreme}()},
|
||||
\code{\link{flag_outlooktime}()},
|
||||
|
|
|
@ -11,12 +11,30 @@ flag_extreme(data, metric, person = TRUE, threshold, return = "message")
|
|||
|
||||
\item{metric}{A character string specifying the metric to test.}
|
||||
|
||||
\item{person}{A logical value to specify whether to calculate person-averages.
|
||||
Defaults to TRUE (person-averages calculated).}
|
||||
\item{person}{A logical value to specify whether to calculate
|
||||
person-averages. Defaults to \code{TRUE} (person-averages calculated).}
|
||||
|
||||
\item{threshold}{Numeric value specifying the threshold for flagging.}
|
||||
|
||||
\item{return}{A character string specifying what to return.}
|
||||
\item{return}{String specifying what to return. This must be one of the
|
||||
following strings:
|
||||
\itemize{
|
||||
\item \code{"text"}
|
||||
\item \code{"message"}
|
||||
\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{"text"}: string. A diagnostic message.
|
||||
\item \code{"message"}: message on console. A diagnostic message.
|
||||
\item \code{"table"}: data frame. A person-level table with \code{PersonId} and the
|
||||
extreme values of the selected metric.
|
||||
}
|
||||
}
|
||||
\description{
|
||||
This is used as part of data validation to check if there are extreme values
|
||||
|
@ -37,6 +55,7 @@ flag_extreme(sq_data, "Email_hours", person = FALSE, threshold = 15)
|
|||
\seealso{
|
||||
Other Data Validation:
|
||||
\code{\link{check_query}()},
|
||||
\code{\link{extract_hr}()},
|
||||
\code{\link{flag_ch_ratio}()},
|
||||
\code{\link{flag_em_ratio}()},
|
||||
\code{\link{flag_outlooktime}()},
|
||||
|
|
|
@ -9,11 +9,27 @@ flag_outlooktime(data, threshold = c(4, 15), return = "message")
|
|||
\arguments{
|
||||
\item{data}{A data frame containing a Person Query.}
|
||||
|
||||
\item{threshold}{A numeric vector of length two, specifying the hour threshold for flagging.
|
||||
Defaults to c(4, 15).}
|
||||
\item{threshold}{A numeric vector of length two, specifying the hour
|
||||
threshold for flagging. Defaults to c(4, 15).}
|
||||
|
||||
\item{return}{String to specify what to return.
|
||||
Valid options include "text" (default), "message", and "data".}
|
||||
\item{return}{String specifying what to return. This must be one of the
|
||||
following strings:
|
||||
\itemize{
|
||||
\item \code{"text"} (default)
|
||||
\item \code{"message"}
|
||||
\item \code{"data"}
|
||||
}}
|
||||
}
|
||||
\value{
|
||||
A different output is returned depending on the value passed to the \code{return}
|
||||
argument:
|
||||
\itemize{
|
||||
\item \code{"text"}: string. A diagnostic message.
|
||||
\item \code{"message"}: message on console. A diagnostic message.
|
||||
\item \code{"data"}: data frame. Data where flag is present.
|
||||
}
|
||||
|
||||
See \code{Value} for more information.
|
||||
}
|
||||
\description{
|
||||
This function flags unusual outlook calendar settings for
|
||||
|
@ -25,14 +41,22 @@ flag_outlooktime(dv_data)
|
|||
|
||||
# Example where Outlook Start and End times are imputed
|
||||
spq_df <- sq_data
|
||||
|
||||
spq_df$WorkingStartTimeSetInOutlook <- "6:30"
|
||||
|
||||
spq_df$WorkingEndTimeSetInOutlook <- "23:30"
|
||||
|
||||
# Return a message
|
||||
flag_outlooktime(spq_df, threshold = c(5, 13))
|
||||
|
||||
# Return data
|
||||
flag_outlooktime(spq_df, threshold = c(5, 13), return = "data")
|
||||
|
||||
}
|
||||
\seealso{
|
||||
Other Data Validation:
|
||||
\code{\link{check_query}()},
|
||||
\code{\link{extract_hr}()},
|
||||
\code{\link{flag_ch_ratio}()},
|
||||
\code{\link{flag_em_ratio}()},
|
||||
\code{\link{flag_extreme}()},
|
||||
|
|
|
@ -56,7 +56,8 @@ argument:
|
|||
\item \code{"plot"}: ggplot object. A random of ten working patterns are displayed,
|
||||
with diagnostic data and the Flexibility Index shown on the plot.
|
||||
\item \code{"data"}: data frame. The original input data appended with the
|
||||
Flexibility Index and the component scores.
|
||||
Flexibility Index and the component scores. Can be used with
|
||||
\code{plot_flex_index()} to recreate visuals found in \code{flex_index()}.
|
||||
\item \code{"table"}: data frame. A summary table for the metric.
|
||||
}
|
||||
}
|
||||
|
@ -123,12 +124,11 @@ em_data \%>\%
|
|||
# Return the raw data with the computed Flexibility Index
|
||||
em_data \%>\%
|
||||
flex_index(return = "data")
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
\seealso{
|
||||
Other Work Patterns:
|
||||
Other Working Patterns:
|
||||
\code{\link{identify_shifts_wp}()},
|
||||
\code{\link{plot_flex_index}()},
|
||||
\code{\link{workpatterns_area}()},
|
||||
|
@ -137,4 +137,4 @@ Other Work Patterns:
|
|||
\code{\link{workpatterns_classify}()},
|
||||
\code{\link{workpatterns_hclust}()}
|
||||
}
|
||||
\concept{Work Patterns}
|
||||
\concept{Working Patterns}
|
||||
|
|
|
@ -27,4 +27,20 @@ g2g_data
|
|||
\description{
|
||||
A demo dataset generated from a Group-to-Group Query from Workplace Analytics.
|
||||
}
|
||||
\seealso{
|
||||
Other Data:
|
||||
\code{\link{dv_data}},
|
||||
\code{\link{em_data}},
|
||||
\code{\link{p2p_data_sim}()}
|
||||
|
||||
Other Network:
|
||||
\code{\link{external_network_plot}()},
|
||||
\code{\link{network_g2g}()},
|
||||
\code{\link{network_leiden}()},
|
||||
\code{\link{network_louvain}()},
|
||||
\code{\link{network_p2p}()},
|
||||
\code{\link{p2p_data_sim}()}
|
||||
}
|
||||
\concept{Data}
|
||||
\concept{Network}
|
||||
\keyword{datasets}
|
||||
|
|
|
@ -22,20 +22,26 @@ generate_report(
|
|||
\item{filename}{File name to be used in the exported HTML.}
|
||||
|
||||
\item{outputs}{A list of outputs to be added to the HTML report.
|
||||
Note that \code{outputs}, \code{titles}, \code{echos}, and \code{levels} must have the same length}
|
||||
Note that \code{outputs}, \code{titles}, \code{echos}, and \code{levels} must have the same
|
||||
length}
|
||||
|
||||
\item{titles}{A list/vector of character strings to specify the title of the chunks.}
|
||||
\item{titles}{A list/vector of character strings to specify the title of the
|
||||
chunks.}
|
||||
|
||||
\item{subheaders}{A list/vector of character strings to specify the subheaders for each chunk.}
|
||||
\item{subheaders}{A list/vector of character strings to specify the
|
||||
subheaders for each chunk.}
|
||||
|
||||
\item{echos}{A list/vector of logical values to specify whether to display code.}
|
||||
\item{echos}{A list/vector of logical values to specify whether to display
|
||||
code.}
|
||||
|
||||
\item{levels}{A list/vector of numeric value to specify the header level of the chunk.}
|
||||
\item{levels}{A list/vector of numeric value to specify the header level of
|
||||
the chunk.}
|
||||
|
||||
\item{theme}{Character vector to specify theme to be used for the report.
|
||||
E.g. "united", "default".}
|
||||
E.g. \code{"united"}, \code{"default"}.}
|
||||
|
||||
\item{preamble}{A preamble to appear at the beginning of the report, passed as a text string.}
|
||||
\item{preamble}{A preamble to appear at the beginning of the report, passed
|
||||
as a text string.}
|
||||
}
|
||||
\value{
|
||||
An HTML report with the same file name as specified in the arguments is
|
||||
|
|
|
@ -42,6 +42,7 @@ hr_trend(dv_data, return = "table")
|
|||
\seealso{
|
||||
Other Data Validation:
|
||||
\code{\link{check_query}()},
|
||||
\code{\link{extract_hr}()},
|
||||
\code{\link{flag_ch_ratio}()},
|
||||
\code{\link{flag_em_ratio}()},
|
||||
\code{\link{flag_extreme}()},
|
||||
|
|
|
@ -81,10 +81,12 @@ Other Visualization:
|
|||
\code{\link{email_line}()},
|
||||
\code{\link{email_rank}()},
|
||||
\code{\link{email_summary}()},
|
||||
\code{\link{email_trend}()}
|
||||
\code{\link{email_trend}()},
|
||||
\code{\link{external_network_plot}()}
|
||||
|
||||
Other Data Validation:
|
||||
\code{\link{check_query}()},
|
||||
\code{\link{extract_hr}()},
|
||||
\code{\link{flag_ch_ratio}()},
|
||||
\code{\link{flag_em_ratio}()},
|
||||
\code{\link{flag_extreme}()},
|
||||
|
|
|
@ -43,6 +43,7 @@ hrvar_count_all(sq_data, return = "table")
|
|||
\seealso{
|
||||
Other Data Validation:
|
||||
\code{\link{check_query}()},
|
||||
\code{\link{extract_hr}()},
|
||||
\code{\link{flag_ch_ratio}()},
|
||||
\code{\link{flag_em_ratio}()},
|
||||
\code{\link{flag_extreme}()},
|
||||
|
|
|
@ -40,6 +40,7 @@ identify_holidayweeks(sq_data, return = "plot")
|
|||
\seealso{
|
||||
Other Data Validation:
|
||||
\code{\link{check_query}()},
|
||||
\code{\link{extract_hr}()},
|
||||
\code{\link{flag_ch_ratio}()},
|
||||
\code{\link{flag_em_ratio}()},
|
||||
\code{\link{flag_extreme}()},
|
||||
|
|
|
@ -27,6 +27,7 @@ As best practice, run this function prior to any analysis to remove atypical col
|
|||
\seealso{
|
||||
Other Data Validation:
|
||||
\code{\link{check_query}()},
|
||||
\code{\link{extract_hr}()},
|
||||
\code{\link{flag_ch_ratio}()},
|
||||
\code{\link{flag_em_ratio}()},
|
||||
\code{\link{flag_extreme}()},
|
||||
|
|
|
@ -27,6 +27,7 @@ Returns the \% of non-knowledge workers identified by Organization, and optional
|
|||
\seealso{
|
||||
Other Data Validation:
|
||||
\code{\link{check_query}()},
|
||||
\code{\link{extract_hr}()},
|
||||
\code{\link{flag_ch_ratio}()},
|
||||
\code{\link{flag_em_ratio}()},
|
||||
\code{\link{flag_extreme}()},
|
||||
|
|
|
@ -32,11 +32,9 @@ identify_outlier(sq_data, metric = "Collaboration_hours")
|
|||
|
||||
}
|
||||
\seealso{
|
||||
Other General:
|
||||
\code{\link{extract_hr}()}
|
||||
|
||||
Other Data Validation:
|
||||
\code{\link{check_query}()},
|
||||
\code{\link{extract_hr}()},
|
||||
\code{\link{flag_ch_ratio}()},
|
||||
\code{\link{flag_em_ratio}()},
|
||||
\code{\link{flag_extreme}()},
|
||||
|
|
|
@ -34,6 +34,7 @@ The method consists in reviewing each individual HR attribute, and count the dis
|
|||
\seealso{
|
||||
Other Data Validation:
|
||||
\code{\link{check_query}()},
|
||||
\code{\link{extract_hr}()},
|
||||
\code{\link{flag_ch_ratio}()},
|
||||
\code{\link{flag_em_ratio}()},
|
||||
\code{\link{flag_extreme}()},
|
||||
|
|
|
@ -31,6 +31,7 @@ identify_query(mtcars) # Will return an error
|
|||
\seealso{
|
||||
Other Data Validation:
|
||||
\code{\link{check_query}()},
|
||||
\code{\link{extract_hr}()},
|
||||
\code{\link{flag_ch_ratio}()},
|
||||
\code{\link{flag_em_ratio}()},
|
||||
\code{\link{flag_extreme}()},
|
||||
|
|
|
@ -76,7 +76,7 @@ em_data \%>\% identify_shifts_wp(return = "table")
|
|||
|
||||
}
|
||||
\seealso{
|
||||
Other Work Patterns:
|
||||
Other Working Patterns:
|
||||
\code{\link{flex_index}()},
|
||||
\code{\link{plot_flex_index}()},
|
||||
\code{\link{workpatterns_area}()},
|
||||
|
@ -85,4 +85,4 @@ Other Work Patterns:
|
|||
\code{\link{workpatterns_classify}()},
|
||||
\code{\link{workpatterns_hclust}()}
|
||||
}
|
||||
\concept{Work Patterns}
|
||||
\concept{Working Patterns}
|
||||
|
|
|
@ -45,6 +45,7 @@ identify_tenure(sq_data2)
|
|||
\seealso{
|
||||
Other Data Validation:
|
||||
\code{\link{check_query}()},
|
||||
\code{\link{extract_hr}()},
|
||||
\code{\link{flag_ch_ratio}()},
|
||||
\code{\link{flag_em_ratio}()},
|
||||
\code{\link{flag_extreme}()},
|
||||
|
|
|
@ -36,9 +36,5 @@ horizontal axis.
|
|||
# Return plot
|
||||
sq_data \%>\% internal_network_plot(return = "plot")
|
||||
|
||||
}
|
||||
\seealso{
|
||||
Other Connectivity:
|
||||
\code{\link{external_network_plot}()}
|
||||
}
|
||||
\concept{Connectivity}
|
||||
|
|
|
@ -85,3 +85,13 @@ g2g_data \%>\%
|
|||
|
||||
|
||||
}
|
||||
\seealso{
|
||||
Other Network:
|
||||
\code{\link{external_network_plot}()},
|
||||
\code{\link{g2g_data}},
|
||||
\code{\link{network_leiden}()},
|
||||
\code{\link{network_louvain}()},
|
||||
\code{\link{network_p2p}()},
|
||||
\code{\link{p2p_data_sim}()}
|
||||
}
|
||||
\concept{Network}
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
% Please edit documentation in R/network_leiden.R
|
||||
\name{network_leiden}
|
||||
\alias{network_leiden}
|
||||
\title{Implement the Leiden community detection on a Person to Person network query}
|
||||
\title{Implement the Leiden community detection on a Person to Person network
|
||||
query}
|
||||
\usage{
|
||||
network_leiden(
|
||||
data,
|
||||
|
@ -28,44 +29,61 @@ network_leiden(
|
|||
|
||||
\item{font_col}{String to specify font and link colour.}
|
||||
|
||||
\item{algorithm}{String to specify the node placement algorithm to be used. Defaults to "fr" for the force-directed
|
||||
algorithm of Fruchterman and Reingold. See \url{https://rdrr.io/cran/ggraph/man/layout_tbl_graph_igraph.html} for a
|
||||
full list of options.}
|
||||
\item{algorithm}{String to specify the node placement algorithm to be used.
|
||||
Defaults to \code{"fr"} for the force-directed algorithm of Fruchterman and
|
||||
Reingold. See
|
||||
\url{https://rdrr.io/cran/ggraph/man/layout_tbl_graph_igraph.html} for a full
|
||||
list of options.}
|
||||
|
||||
\item{path}{File path for saving the PDF output. Defaults to a timestamped path based on current parameters.}
|
||||
\item{path}{File path for saving the PDF output. Defaults to a timestamped
|
||||
path based on current parameters.}
|
||||
|
||||
\item{node_alpha}{A numeric value between 0 and 1 to specify the transparency of the nodes.}
|
||||
\item{node_alpha}{A numeric value between 0 and 1 to specify the transparency
|
||||
of the nodes.}
|
||||
|
||||
\item{res}{Resolution parameter to be passed to \code{leiden::leiden()}. Defaults to 0.5.}
|
||||
\item{res}{Resolution parameter to be passed to \code{leiden::leiden()}. Defaults
|
||||
to 0.5.}
|
||||
|
||||
\item{seed}{Seed for the random number generator passed to \code{leiden::leiden()} to ensure consistency. Only applicable
|
||||
when \code{display} is set to "leiden".}
|
||||
\item{seed}{Seed for the random number generator passed to \code{leiden::leiden()}
|
||||
to ensure consistency. Only applicable when \code{display} is set to \code{"leiden"}.}
|
||||
|
||||
\item{desc_hrvar}{Character vector of length 3 containing the HR attributes to use when returning the
|
||||
"describe" output. See \code{network_describe()}.}
|
||||
\item{desc_hrvar}{Character vector of length 3 containing the HR attributes
|
||||
to use when returning the \code{"describe"} output. See \code{network_describe()}.}
|
||||
|
||||
\item{return}{String specifying what output to return. Defaults to "plot-leiden". Valid return options include:
|
||||
\item{return}{String specifying what output to return. Defaults to "plot-leiden". Valid
|
||||
return options include:
|
||||
\itemize{
|
||||
\item 'plot-leiden': return a network plot coloured by leiden communities, saving a PDF to path.
|
||||
\item 'plot-hrvar': return a network plot coloured by HR attribute, saving a PDF to path.
|
||||
\item 'plot-sankey': return a sankey plot combining communities and HR attribute.
|
||||
\item 'table': return a vertex summary table with counts in communities and HR attribute.
|
||||
\item 'data': return a vertex data file that matches vertices with communities and HR attributes.
|
||||
\item 'describe': return a list of data frames which describe each of the identified communities.
|
||||
The first data frame is a summary table of all the communities.
|
||||
\item 'network': return igraph object.
|
||||
\item \code{'plot-leiden'}: return a network plot coloured by leiden communities,
|
||||
saving a PDF to path.
|
||||
\item \code{'plot-hrvar'}: return a network plot coloured by HR attribute, saving a
|
||||
PDF to path.
|
||||
\item \code{'plot-sankey'}: return a sankey plot combining communities and HR
|
||||
attribute.
|
||||
\item \code{'table'}: return a vertex summary table with counts in communities and
|
||||
HR attribute.
|
||||
\item \code{'data'}: return a vertex data file that matches vertices with
|
||||
communities and HR attributes.
|
||||
\item \code{'describe'}: return a list of data frames which describe each of the
|
||||
identified communities. The first data frame is a summary table of all the
|
||||
communities.
|
||||
\item \code{'network'}: return igraph object.
|
||||
}}
|
||||
|
||||
\item{size_threshold}{Numeric value representing the maximum number of edges before \code{network_leiden()}
|
||||
switches to use a more efficient, but less elegant plotting method (native igraph). Defaults to 5000.
|
||||
Set as \code{0} to co-erce to a fast plotting method every time, and \code{Inf} to always use the default plotting
|
||||
method.}
|
||||
\item{size_threshold}{Numeric value representing the maximum number of edges
|
||||
before \code{network_leiden()} switches to use a more efficient, but less
|
||||
elegant plotting method (native igraph). Defaults to 5000. Set as \code{0} to
|
||||
coerce to a fast plotting method every time, and \code{Inf} to always use the
|
||||
default plotting method.}
|
||||
}
|
||||
\value{
|
||||
See \code{return}.
|
||||
}
|
||||
\description{
|
||||
\ifelse{html}{\out{<a href='https://www.tidyverse.org/lifecycle/#experimental'><img src='figures/lifecycle-experimental.svg' alt='Experimental lifecycle'></a>}}{\strong{Experimental}}
|
||||
Take a P2P network query and implement the Leiden community detection method. To run
|
||||
this function, you will require all the pre-requisites of the \strong{leiden} package installed,
|
||||
which includes Python and \strong{reticulate}.
|
||||
|
||||
Take a P2P network query and implement the Leiden community detection method.
|
||||
To run this function, you will require all the pre-requisites of the
|
||||
'leiden' package installed, which includes Python and 'reticulate'.
|
||||
}
|
||||
\examples{
|
||||
\donttest{
|
||||
|
@ -80,3 +98,13 @@ p2p_data \%>\%
|
|||
|
||||
|
||||
}
|
||||
\seealso{
|
||||
Other Network:
|
||||
\code{\link{external_network_plot}()},
|
||||
\code{\link{g2g_data}},
|
||||
\code{\link{network_g2g}()},
|
||||
\code{\link{network_louvain}()},
|
||||
\code{\link{network_p2p}()},
|
||||
\code{\link{p2p_data_sim}()}
|
||||
}
|
||||
\concept{Network}
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
% Please edit documentation in R/network_louvain.R
|
||||
\name{network_louvain}
|
||||
\alias{network_louvain}
|
||||
\title{Implement the Louvain community detection on a Person to Person network query}
|
||||
\title{Implement the Louvain community detection on a Person to Person
|
||||
network query}
|
||||
\usage{
|
||||
network_louvain(
|
||||
data,
|
||||
|
@ -26,38 +27,54 @@ network_louvain(
|
|||
|
||||
\item{font_col}{String to specify font and link colour.}
|
||||
|
||||
\item{node_alpha}{A numeric value between 0 and 1 to specify the transparency of the nodes.}
|
||||
\item{node_alpha}{A numeric value between 0 and 1 to specify the transparency
|
||||
of the nodes.}
|
||||
|
||||
\item{algorithm}{String to specify the node placement algorithm to be used. Defaults to "fr" for the force-directed
|
||||
algorithm of Fruchterman and Reingold. See \url{https://rdrr.io/cran/ggraph/man/layout_tbl_graph_igraph.html} for a
|
||||
full list of options.}
|
||||
\item{algorithm}{String to specify the node placement algorithm to be used.
|
||||
Defaults to \code{"fr"} for the force-directed algorithm of Fruchterman and
|
||||
Reingold. See
|
||||
\url{https://rdrr.io/cran/ggraph/man/layout_tbl_graph_igraph.html} for a full
|
||||
list of options.}
|
||||
|
||||
\item{path}{File path for saving the PDF output. Defaults to a timestamped path based on current parameters.}
|
||||
\item{path}{File path for saving the PDF output. Defaults to a timestamped
|
||||
path based on current parameters.}
|
||||
|
||||
\item{desc_hrvar}{Character vector of length 3 containing the HR attributes to use when returning the
|
||||
"describe" output. See \code{network_describe()}.}
|
||||
\item{desc_hrvar}{Character vector of length 3 containing the HR attributes
|
||||
to use when returning the \code{"describe"} output. See \code{network_describe()}.}
|
||||
|
||||
\item{return}{String specifying what output to return. Defaults to "plot-louvain". Valid return options include:
|
||||
\item{return}{String specifying what output to return. Defaults to "plot-louvain". Valid
|
||||
return options include:
|
||||
\itemize{
|
||||
\item 'plot-louvain': return a network plot coloured by Louvain communities, saving a PDF to path.
|
||||
\item 'plot-hrvar': return a network plot coloured by HR attribute, saving a PDF to path.
|
||||
\item 'plot-sankey': return a sankey plot combining communities and HR attribute.
|
||||
\item 'table': return a vertex summary table with counts in communities and HR attribute.
|
||||
\item 'data': return a vertex data file that matches vertices with communities and HR attributes.
|
||||
\item 'describe': return a list of data frames which describe each of the identified communities.
|
||||
The first data frame is a summary table of all the communities.
|
||||
\item 'network': return igraph object.
|
||||
\item \code{'plot-louvain'}: return a network plot coloured by Louvain communities,
|
||||
saving a PDF to path.
|
||||
\item \code{'plot-hrvar'}: return a network plot coloured by HR attribute, saving a
|
||||
PDF to path.
|
||||
\item \code{'plot-sankey'}: return a sankey plot combining communities and HR
|
||||
attribute.
|
||||
\item \code{'table'}: return a vertex summary table with counts in communities and
|
||||
HR attribute.
|
||||
\item \code{'data'}: return a vertex data file that matches vertices with
|
||||
communities and HR attributes.
|
||||
\item \code{'describe'}: return a list of data frames which describe each of the
|
||||
identified communities. The first data frame is a summary table of all the
|
||||
communities.
|
||||
\item \code{'network'}: return igraph object.
|
||||
}}
|
||||
|
||||
\item{size_threshold}{Numeric value representing the maximum number of edges before \code{network_leiden()}
|
||||
switches to use a more efficient, but less elegant plotting method (native igraph). Defaults to 5000.
|
||||
Set as \code{0} to co-erce to a fast plotting method every time, and \code{Inf} to always use the default plotting
|
||||
method.}
|
||||
\item{size_threshold}{Numeric value representing the maximum number of edges
|
||||
before \code{network_leiden()} switches to use a more efficient, but less
|
||||
elegant plotting method (native igraph). Defaults to 5000. Set as \code{0} to
|
||||
coerce to a fast plotting method every time, and \code{Inf} to always use the
|
||||
default plotting method.}
|
||||
}
|
||||
\value{
|
||||
See \code{return}.
|
||||
}
|
||||
\description{
|
||||
\ifelse{html}{\out{<a href='https://www.tidyverse.org/lifecycle/#experimental'><img src='figures/lifecycle-experimental.svg' alt='Experimental lifecycle'></a>}}{\strong{Experimental}}
|
||||
Take a P2P network query and implement the Louvain community detection method. The
|
||||
\strong{igraph} implementation of the Louvain method is used.
|
||||
|
||||
Take a P2P network query and implement the Louvain community detection
|
||||
method. The 'igraph' implementation of the Louvain method is used.
|
||||
}
|
||||
\examples{
|
||||
# Simulate a small person-to-person dataset
|
||||
|
@ -69,3 +86,13 @@ p2p_data \%>\%
|
|||
return = "plot")
|
||||
|
||||
}
|
||||
\seealso{
|
||||
Other Network:
|
||||
\code{\link{external_network_plot}()},
|
||||
\code{\link{g2g_data}},
|
||||
\code{\link{network_g2g}()},
|
||||
\code{\link{network_leiden}()},
|
||||
\code{\link{network_p2p}()},
|
||||
\code{\link{p2p_data_sim}()}
|
||||
}
|
||||
\concept{Network}
|
||||
|
|
|
@ -27,64 +27,79 @@ network_p2p(
|
|||
|
||||
\item{hrvar}{String containing the label for the HR attribute.}
|
||||
|
||||
\item{display}{String determining what output to return. Valid values include:
|
||||
\item{display}{String determining what output to return. Valid values
|
||||
include:
|
||||
\itemize{
|
||||
\item \code{"hrvar"} (default): compute analysis or visuals without computing communities.
|
||||
\item \code{"louvain"}: compute analysis or visuals with community detection, using the Louvain
|
||||
algorithm.
|
||||
\item \code{"leiden"}: compute analysis or visuals with community detection, using the Leiden algorithm.
|
||||
This requires all the pre-requisites of the \strong{leiden} package installed,
|
||||
which includes Python and \strong{reticulate}.
|
||||
\item \code{"hrvar"} (default): compute analysis or visuals without computing
|
||||
communities.
|
||||
\item \code{"louvain"}: compute analysis or visuals with community detection, using
|
||||
the Louvain algorithm.
|
||||
\item \code{"leiden"}: compute analysis or visuals with community detection, using
|
||||
the Leiden algorithm. This requires all the pre-requisites of the
|
||||
\strong{leiden} package installed, which includes Python and \strong{reticulate}.
|
||||
}}
|
||||
|
||||
\item{return}{String specifying what output to return. Defaults to "plot".
|
||||
Valid return options include:
|
||||
\itemize{
|
||||
\item \code{'plot'}: return a network plot.
|
||||
\item \code{'sankey'}: return a sankey plot combining communities and HR attribute. This is only valid if
|
||||
a community detection method is selected at \code{display}.
|
||||
\item \code{'table'}: return a vertex summary table with counts in communities and HR attribute.
|
||||
\item \code{'data'}: return a vertex data file that matches vertices with communities and HR attributes.
|
||||
\item \code{'describe'}: return a list of data frames which describe each of the identified communities.
|
||||
The first data frame is a summary table of all the communities. This is only valid if a community
|
||||
detection method is selected at \code{display}.
|
||||
\item \code{'sankey'}: return a sankey plot combining communities and HR attribute.
|
||||
This is only valid if a community detection method is selected at
|
||||
\code{display}.
|
||||
\item \code{'table'}: return a vertex summary table with counts in communities and
|
||||
HR attribute.
|
||||
\item \code{'data'}: return a vertex data file that matches vertices with
|
||||
communities and HR attributes.
|
||||
\item \code{'describe'}: return a list of data frames which describe each of the
|
||||
identified communities. The first data frame is a summary table of all the
|
||||
communities. This is only valid if a community detection method is selected
|
||||
at \code{display}.
|
||||
\item \code{'network'}: return igraph object.
|
||||
}}
|
||||
|
||||
\item{path}{File path for saving the PDF output. Defaults to a timestamped path based on current parameters.}
|
||||
\item{path}{File path for saving the PDF output. Defaults to a timestamped
|
||||
path based on current parameters.}
|
||||
|
||||
\item{desc_hrvar}{Character vector of length 3 containing the HR attributes to use when returning the
|
||||
"describe" output. See \code{network_describe()}.}
|
||||
\item{desc_hrvar}{Character vector of length 3 containing the HR attributes
|
||||
to use when returning the \code{"describe"} output. See \code{network_describe()}.}
|
||||
|
||||
\item{bg_fill}{String to specify background fill colour.}
|
||||
|
||||
\item{font_col}{String to specify font and link colour.}
|
||||
|
||||
\item{legend_pos}{String to specify position of legend. Defaults to "bottom". See \code{ggplot2::theme()}.}
|
||||
\item{legend_pos}{String to specify position of legend. Defaults to
|
||||
\code{"bottom"}. See \code{ggplot2::theme()}.}
|
||||
|
||||
\item{palette}{Function for generating a colour palette with a single argument \code{n}. Uses "rainbow" by default.}
|
||||
\item{palette}{Function for generating a colour palette with a single
|
||||
argument \code{n}. Uses "rainbow" by default.}
|
||||
|
||||
\item{node_alpha}{A numeric value between 0 and 1 to specify the transparency of the nodes.}
|
||||
\item{node_alpha}{A numeric value between 0 and 1 to specify the transparency
|
||||
of the nodes.}
|
||||
|
||||
\item{res}{Resolution parameter to be passed to \code{leiden::leiden()}. Defaults to 0.5.}
|
||||
\item{res}{Resolution parameter to be passed to \code{leiden::leiden()}. Defaults
|
||||
to 0.5.}
|
||||
|
||||
\item{seed}{Seed for the random number generator passed to \code{leiden::leiden()} to ensure consistency. Only applicable
|
||||
when \code{display} is set to "leiden".}
|
||||
\item{seed}{Seed for the random number generator passed to \code{leiden::leiden()}
|
||||
to ensure consistency. Only applicable when \code{display} is set to \code{"leiden"}.}
|
||||
|
||||
\item{algorithm}{String to specify the node placement algorithm to be used. Defaults to "fr" for the force-directed
|
||||
algorithm of Fruchterman and Reingold. See \url{https://rdrr.io/cran/ggraph/man/layout_tbl_graph_igraph.html} for a
|
||||
full list of options.}
|
||||
\item{algorithm}{String to specify the node placement algorithm to be used.
|
||||
Defaults to \code{"fr"} for the force-directed algorithm of Fruchterman and
|
||||
Reingold. See
|
||||
\url{https://rdrr.io/cran/ggraph/man/layout_tbl_graph_igraph.html} for a full
|
||||
list of options.}
|
||||
|
||||
\item{size_threshold}{Numeric value representing the maximum number of edges before \code{network_leiden()}
|
||||
switches to use a more efficient, but less elegant plotting method (native igraph). Defaults to 5000.
|
||||
Set as \code{0} to co-erce to a fast plotting method every time, and \code{Inf} to always use the default plotting
|
||||
method.}
|
||||
\item{size_threshold}{Numeric value representing the maximum number of edges
|
||||
before \code{network_leiden()} switches to use a more efficient, but less
|
||||
elegant plotting method (native igraph). Defaults to 5000. Set as \code{0} to
|
||||
coerce to a fast plotting method every time, and \code{Inf} to always use the
|
||||
default plotting method.}
|
||||
}
|
||||
\description{
|
||||
\ifelse{html}{\out{<a href='https://www.tidyverse.org/lifecycle/#experimental'><img src='figures/lifecycle-experimental.svg' alt='Experimental lifecycle'></a>}}{\strong{Experimental}}
|
||||
|
||||
Pass a data frame containing a person-to-person query and return a network visualization.
|
||||
Options are available for community detection using either the Louvain or the Leiden algorithms.
|
||||
Pass a data frame containing a person-to-person query and return a network
|
||||
visualization. Options are available for community detection using either the
|
||||
Louvain or the Leiden algorithms.
|
||||
}
|
||||
\examples{
|
||||
# Simulate a small person-to-person dataset
|
||||
|
@ -130,3 +145,13 @@ p2p_data \%>\%
|
|||
algorithm = "fr")
|
||||
|
||||
}
|
||||
\seealso{
|
||||
Other Network:
|
||||
\code{\link{external_network_plot}()},
|
||||
\code{\link{g2g_data}},
|
||||
\code{\link{network_g2g}()},
|
||||
\code{\link{network_leiden}()},
|
||||
\code{\link{network_louvain}()},
|
||||
\code{\link{p2p_data_sim}()}
|
||||
}
|
||||
\concept{Network}
|
||||
|
|
|
@ -18,16 +18,33 @@ the lattice will be connected.}
|
|||
}
|
||||
\description{
|
||||
Generate an person-to-person query / edgelist based on the graph
|
||||
according to the Watts-Strogatz small-world network model. Organizational data
|
||||
fields are also simulated for \code{Organization}, \code{LevelDesignation}, and \code{City}.
|
||||
according to the Watts-Strogatz small-world network model. Organizational
|
||||
data fields are also simulated for \code{Organization}, \code{LevelDesignation}, and
|
||||
\code{City}.
|
||||
}
|
||||
\details{
|
||||
This is a wrapper around \code{igraph::watts.strogatz.game()}. See igraph documentation
|
||||
for details on methodology. Loop edges and multiple edges are disabled. Size of the
|
||||
network can be changing the arguments \code{size} and \code{nei}.
|
||||
This is a wrapper around \code{igraph::watts.strogatz.game()}. See igraph
|
||||
documentation for details on methodology. Loop edges and multiple edges are
|
||||
disabled. Size of the network can be changing the arguments \code{size} and \code{nei}.
|
||||
}
|
||||
\examples{
|
||||
# Simulate a p2p dataset with 800 edges
|
||||
p2p_data_sim(size = 200, nei = 4)
|
||||
|
||||
}
|
||||
\seealso{
|
||||
Other Data:
|
||||
\code{\link{dv_data}},
|
||||
\code{\link{em_data}},
|
||||
\code{\link{g2g_data}}
|
||||
|
||||
Other Network:
|
||||
\code{\link{external_network_plot}()},
|
||||
\code{\link{g2g_data}},
|
||||
\code{\link{network_g2g}()},
|
||||
\code{\link{network_leiden}()},
|
||||
\code{\link{network_louvain}()},
|
||||
\code{\link{network_p2p}()}
|
||||
}
|
||||
\concept{Data}
|
||||
\concept{Network}
|
||||
|
|
|
@ -26,34 +26,32 @@ working patterns; "time" plots the Flexibility Index for the group over time.}
|
|||
|
||||
\item{end_hour}{See \code{flex_index()}.}
|
||||
}
|
||||
\value{
|
||||
ggplot object. See \code{method}.
|
||||
}
|
||||
\description{
|
||||
This is a helper function for plotting visualizations for the Flexibility Index
|
||||
using the \code{data} output from \code{flex_index()}. This is used within \code{flex_index()} itself
|
||||
as an internal function.
|
||||
This is a helper function for plotting visualizations for the
|
||||
Flexibility Index using the \code{data} output from \code{flex_index()}. This is used
|
||||
within \code{flex_index()} itself as an internal function.
|
||||
}
|
||||
\examples{
|
||||
\donttest{
|
||||
# Pre-calculate Flexibility Index
|
||||
fi_output <- flex_index(em_data, return = "data")
|
||||
|
||||
|
||||
# Examples of how to test the plotting options individually
|
||||
# Sample of 10 work patterns
|
||||
em_data \%>\%
|
||||
flex_index(return = "data") \%>\%
|
||||
plot_flex_index(method = "sample")
|
||||
plot_flex_index(fi_output, method = "sample")
|
||||
|
||||
# 10 most common work patterns
|
||||
em_data \%>\%
|
||||
flex_index(return = "data") \%>\%
|
||||
plot_flex_index(method = "common")
|
||||
plot_flex_index(fi_output, method = "common")
|
||||
|
||||
# Plot Flexibility Index over time
|
||||
em_data \%>\%
|
||||
flex_index(return = "data") \%>\%
|
||||
plot_flex_index(method = "time")
|
||||
|
||||
}
|
||||
plot_flex_index(fi_output, method = "time")
|
||||
|
||||
}
|
||||
\seealso{
|
||||
Other Work Patterns:
|
||||
Other Working Patterns:
|
||||
\code{\link{flex_index}()},
|
||||
\code{\link{identify_shifts_wp}()},
|
||||
\code{\link{workpatterns_area}()},
|
||||
|
@ -62,4 +60,4 @@ Other Work Patterns:
|
|||
\code{\link{workpatterns_classify}()},
|
||||
\code{\link{workpatterns_hclust}()}
|
||||
}
|
||||
\concept{Work Patterns}
|
||||
\concept{Working Patterns}
|
||||
|
|
|
@ -39,6 +39,7 @@ For mature functions to remove common outliers, please see the following:
|
|||
\seealso{
|
||||
Other Data Validation:
|
||||
\code{\link{check_query}()},
|
||||
\code{\link{extract_hr}()},
|
||||
\code{\link{flag_ch_ratio}()},
|
||||
\code{\link{flag_em_ratio}()},
|
||||
\code{\link{flag_extreme}()},
|
||||
|
|
|
@ -18,6 +18,7 @@ Other Support:
|
|||
\code{\link{check_inputs}()},
|
||||
\code{\link{combine_signals}()},
|
||||
\code{\link{cut_hour}()},
|
||||
\code{\link{extract_date_range}()}
|
||||
\code{\link{extract_date_range}()},
|
||||
\code{\link{extract_hr}()}
|
||||
}
|
||||
\concept{Support}
|
||||
|
|
|
@ -27,6 +27,7 @@ Additional option to return the underlying data with a flag of items for review.
|
|||
\seealso{
|
||||
Other Data Validation:
|
||||
\code{\link{check_query}()},
|
||||
\code{\link{extract_hr}()},
|
||||
\code{\link{flag_ch_ratio}()},
|
||||
\code{\link{flag_em_ratio}()},
|
||||
\code{\link{flag_extreme}()},
|
||||
|
|
|
@ -37,6 +37,7 @@ Returns a HTML report by default.
|
|||
\seealso{
|
||||
Other Data Validation:
|
||||
\code{\link{check_query}()},
|
||||
\code{\link{extract_hr}()},
|
||||
\code{\link{flag_ch_ratio}()},
|
||||
\code{\link{flag_em_ratio}()},
|
||||
\code{\link{flag_extreme}()},
|
||||
|
|
|
@ -53,6 +53,7 @@ dv_data \%>\% track_HR_change()
|
|||
\seealso{
|
||||
Other Data Validation:
|
||||
\code{\link{check_query}()},
|
||||
\code{\link{extract_hr}()},
|
||||
\code{\link{flag_ch_ratio}()},
|
||||
\code{\link{flag_em_ratio}()},
|
||||
\code{\link{flag_extreme}()},
|
||||
|
|
|
@ -68,7 +68,7 @@ workpatterns_area(em_data, return = "table")
|
|||
|
||||
}
|
||||
\seealso{
|
||||
Other Work Patterns:
|
||||
Other Working Patterns:
|
||||
\code{\link{flex_index}()},
|
||||
\code{\link{identify_shifts_wp}()},
|
||||
\code{\link{plot_flex_index}()},
|
||||
|
@ -77,4 +77,4 @@ Other Work Patterns:
|
|||
\code{\link{workpatterns_classify}()},
|
||||
\code{\link{workpatterns_hclust}()}
|
||||
}
|
||||
\concept{Work Patterns}
|
||||
\concept{Working Patterns}
|
||||
|
|
|
@ -158,7 +158,7 @@ em_data \%>\% workpatterns_classify(method = "pav", return = "plot-area")
|
|||
|
||||
}
|
||||
\seealso{
|
||||
Other Work Patterns:
|
||||
Other Working Patterns:
|
||||
\code{\link{flex_index}()},
|
||||
\code{\link{identify_shifts_wp}()},
|
||||
\code{\link{plot_flex_index}()},
|
||||
|
@ -167,4 +167,4 @@ Other Work Patterns:
|
|||
\code{\link{workpatterns_classify_pav}()},
|
||||
\code{\link{workpatterns_hclust}()}
|
||||
}
|
||||
\concept{Work Patterns}
|
||||
\concept{Working Patterns}
|
||||
|
|
|
@ -60,7 +60,7 @@ workpatterns_classify_bw(em_data)
|
|||
|
||||
}
|
||||
\seealso{
|
||||
Other Work Patterns:
|
||||
Other Working Patterns:
|
||||
\code{\link{flex_index}()},
|
||||
\code{\link{identify_shifts_wp}()},
|
||||
\code{\link{plot_flex_index}()},
|
||||
|
@ -69,4 +69,4 @@ Other Work Patterns:
|
|||
\code{\link{workpatterns_classify}()},
|
||||
\code{\link{workpatterns_hclust}()}
|
||||
}
|
||||
\concept{Work Patterns}
|
||||
\concept{Working Patterns}
|
||||
|
|
|
@ -66,7 +66,7 @@ workpatterns_classify_pav(em_data, return = "plot-area")
|
|||
|
||||
}
|
||||
\seealso{
|
||||
Other Work Patterns:
|
||||
Other Working Patterns:
|
||||
\code{\link{flex_index}()},
|
||||
\code{\link{identify_shifts_wp}()},
|
||||
\code{\link{plot_flex_index}()},
|
||||
|
@ -75,4 +75,4 @@ Other Work Patterns:
|
|||
\code{\link{workpatterns_classify}()},
|
||||
\code{\link{workpatterns_hclust}()}
|
||||
}
|
||||
\concept{Work Patterns}
|
||||
\concept{Working Patterns}
|
||||
|
|
|
@ -101,7 +101,7 @@ workpatterns_hclust(em_data,
|
|||
|
||||
}
|
||||
\seealso{
|
||||
Other Work Patterns:
|
||||
Other Working Patterns:
|
||||
\code{\link{flex_index}()},
|
||||
\code{\link{identify_shifts_wp}()},
|
||||
\code{\link{plot_flex_index}()},
|
||||
|
@ -110,4 +110,4 @@ Other Work Patterns:
|
|||
\code{\link{workpatterns_classify_pav}()},
|
||||
\code{\link{workpatterns_classify}()}
|
||||
}
|
||||
\concept{Work Patterns}
|
||||
\concept{Working Patterns}
|
||||
|
|
Загрузка…
Ссылка в новой задаче