Merge branch 'main' into feature/working-patterns-and-flexibility-score

This commit is contained in:
Martin Chan 2021-02-03 11:33:10 +00:00
Родитель 2a2f287376 786d97dd1f
Коммит e991c1148e
21 изменённых файлов: 49 добавлений и 48 удалений

Просмотреть файл

@ -16,5 +16,9 @@
# Ignore all figures
^man/figures
# Ignore all vignettes
^vignettes
# Ignore vignettes
^vignettes/best-practices.Rmd$
^vignettes/Change-over-time.Rmd$
^vignettes/IV-report.Rmd$
^vignettes/text-mining-capabilities.Rmd$
^Meta$

Просмотреть файл

@ -23,19 +23,17 @@ Description: Opinionated functions that enable easier and faster
This package adheres to tidyverse principles and works well with the pipe syntax.
wpa is built with the beginner-to-intermediate R users in mind, and is optimised for
simplicity.
URL: https://github.com/microsoft/wpa
BugReports: https://github.com/microsoft/wpa/issues
URL: https://github.com/microsoft/wpa/
BugReports: https://github.com/microsoft/wpa/issues/
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
Depends:
R (>= 3.1.2)
Imports:
base,
dplyr,
stats,
utils,
tibble,
tidyr,
tidyselect (>= 1.0.0),
magrittr,
@ -46,7 +44,6 @@ Imports:
Information,
scales,
htmltools,
knitr,
markdown,
rmarkdown,
networkD3,
@ -55,15 +52,15 @@ Imports:
ggraph,
igraph,
proxy,
rlang,
ggwordcloud,
methods,
data.table,
lifecycle
data.table
RoxygenNote: 7.1.1
Roxygen: list(markdown = TRUE)
VignetteBuilder: knitr
Suggests:
knitr,
extrafont,
leiden
leiden,
lifecycle
Language: en-US

Просмотреть файл

@ -186,8 +186,6 @@ importFrom(proxy,dist)
importFrom(purrr,map_if)
importFrom(purrr,pmap)
importFrom(purrr,reduce)
importFrom(rlang,"!!")
importFrom(rlang,sym)
importFrom(scales,percent)
importFrom(scales,wrap_format)
importFrom(stats,cutree)

Просмотреть файл

@ -8,7 +8,7 @@
#' @author Tannaz Sattari Tabrizi <Tannaz.Sattari@microsoft.com>
#'
#' @description
#' \Sexpr[results=rd]{lifecycle::badge("experimental")}
#' `r lifecycle::badge('experimental')`
#' Returns a data frame that gives a percentage of the group combinations that best represent
#' the population provided. Uses a person to person query.
#'

Просмотреть файл

@ -6,7 +6,7 @@
#' @title Implement the Leiden community detection on a Person to Person network query
#'
#' @description
#' \Sexpr[results=rd]{lifecycle::badge("experimental")}
#' `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**.

Просмотреть файл

@ -6,7 +6,7 @@
#' @title Implement the Louvain community detection on a Person to Person network query
#'
#' @description
#' \Sexpr[results=rd]{lifecycle::badge("experimental")}
#' `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.
#'

Просмотреть файл

@ -6,7 +6,7 @@
#' @title Create a network plot with the person-to-person query
#'
#' @description
#' \Sexpr[results=rd]{lifecycle::badge("experimental")}
#' `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.
#'

Просмотреть файл

@ -31,6 +31,7 @@
#' ## Run plot
#' period_change(sq_data, compvar = "Workweek_span", before_end = "2019-11-16")
#'
#' \donttest{
#' ## Run plot with more specific arguments
#' period_change(sq_data,
#' compvar = "Workweek_span",
@ -39,7 +40,7 @@
#' after_start = "2019-12-03",
#' after_end = "2019-12-16",
#' return = "percentage")
#'
#' }
#' @family Flexible Input
#' @export

Просмотреть файл

@ -6,7 +6,7 @@
#' @title Create hierarchical clusters of selected metrics using a Person query
#'
#' @description
#' \Sexpr[results=rd]{lifecycle::badge("questioning")}
#' `r lifecycle::badge('questioning')`
#' Apply hierarchical clustering to selected metrics. Person averages are computed prior to clustering.
#' The hierarchical clustering uses cosine distance and the ward.D method
#' of agglomeration.
@ -43,12 +43,13 @@
#' k = 4,
#' return = "table")
#'
#' \donttest{
#' ## Return data with clusters appended
#' personas_hclust(sq_data,
#' metrics = c("Collaboration_hours", "Workweek_span"),
#' k = 4,
#' return = "data")
#'
#' }
#'
#' @family Work Patterns
#'

Просмотреть файл

@ -5,7 +5,9 @@
#' @title Remove outliers from a person query across time
#'
#' @description This function takes in a selected metric and uses z-score (number of standard
#' @description
#' `r lifecycle::badge('experimental')`
#' This function takes in a selected metric and uses z-score (number of standard
#' deviations) to identify and remove outlier weeks for individuals across time. There are applications
#' in this for removing weeks with abnormally low collaboration
#' activity, e.g. holidays. Retains metrics with z > -2.
@ -15,7 +17,6 @@
#' has a longer runtime compared to `identify_outlier()`.
#'
#' @details
#' This function is on an experimental lifecycle.
#' For mature functions to remove common outliers, please see the following:
#' - `identify_holidayweeks()`
#' - `identify_nkw()`

Просмотреть файл

@ -48,7 +48,7 @@ tm_clean <- function(data,
# Remove WPI custom irrelevant words
if(!is.data.frame(stopwords)){
stopwords <- tibble::tibble(word = "")
stopwords <- dplyr::tibble(word = "")
}

Просмотреть файл

@ -242,8 +242,6 @@ workpatterns_hclust <- function(data,
#'
#' @import ggplot2
#' @import dplyr
#' @importFrom rlang sym
#' @importFrom rlang "!!"
#' @importFrom tidyselect all_of
#' @importFrom tidyr gather
#'
@ -387,7 +385,7 @@ run_sum_hr <- function(data,
mode_val <- uni[which.max(tabulate(match(hour_raw, uni)))]
tibble::tibble(cluster = x$cluster[1],
dplyr::tibble(cluster = x$cluster[1],
median_hour = median(hour_raw),
p5_hour = stats::quantile(hour_raw, .05),
p25_hour = stats::quantile(hour_raw, .25),

Просмотреть файл

@ -1,10 +1,10 @@
# wpa <img src="man/figures/logo2.png" align="right" width=15% />
# wpa <img src="https://raw.githubusercontent.com/microsoft/wpa/main/man/figures/logo2.png" align="right" width=15% />
[![R build status](https://github.com/microsoft/wpa/workflows/R-CMD-check/badge.svg)](https://github.com/microsoft/wpa/actions) [![CodeFactor](https://www.codefactor.io/repository/github/microsoft/wpa/badge)](https://www.codefactor.io/repository/github/microsoft/wpa) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://www.tidyverse.org/lifecycle/#maturing)
[![R build status](https://github.com/microsoft/wpa/workflows/R-CMD-check/badge.svg)](https://github.com/microsoft/wpa/actions/) [![CodeFactor](https://www.codefactor.io/repository/github/microsoft/wpa/badge/)](https://www.codefactor.io/repository/github/microsoft/wpa/) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT/) [![lifecycle](https://img.shields.io/badge/lifecycle-maturing-blue.svg)](https://lifecycle.r-lib.org/articles/stages.html)
## Analyze and Visualize Workplace Analytics data
This is an R package for analyzing and visualizing data from [Microsoft Workplace Analytics](https://www.microsoft.com/microsoft-365/partners/workplaceanalytics).
This is an R package for analyzing and visualizing data from [Microsoft Workplace Analytics](https://docs.microsoft.com/en-us/workplace-analytics/).
## With the **wpa** package, you can...
@ -18,7 +18,7 @@ This is an R package for analyzing and visualizing data from [Microsoft Workplac
Here is an example of **wpa** in action:
<img src="man/figures/output2.gif" align="center" width=80% />
<img src="https://raw.githubusercontent.com/microsoft/wpa/main/man/figures/output2.gif" align="center" width=80% />
---
@ -28,6 +28,7 @@ To get started with the package, please see the following links:
- [Installation and Set-up](https://microsoft.github.io/wpa/analyst_guide_getting_started.html)
- [Full function list](https://microsoft.github.io/wpa/reference/index.html)
- [Analyst Guide](https://microsoft.github.io/wpa/analyst_guide.html)
Also check out our package cheat sheet for a quick glimpse of what **wpa** offers:
@ -40,27 +41,27 @@ Also check out our package cheat sheet for a quick glimpse of what **wpa** offer
We welcome contributions to the package!
### Contributing code
If you would like contribute code to the repo, please read our [Contributor Guide](CONTRIBUTING.md) and [Developer Guide](.github/developer_guide.md). This documentation should provide you all the information you will need to get started.
If you would like contribute code to the repo, please read our [Contributor Guide](https://microsoft.github.io/wpa/CONTRIBUTING.html) and [Developer Guide](https://microsoft.github.io/wpa/developer_guide.html). This documentation should provide you all the information you will need to get started.
### Issues or Feature Requests
If you would like to log an issue or submit a feature request, please create a new issue or comment on an existing issue on [GitHub Issues](https://github.com/microsoft/wpa/issues) on this repo.
### Reporting Security Issues
Please do not report security vulnerabilities through public GitHub issues. Please read our Security document [for more details](.github/reporting_security_issues.md).
Please do not report security vulnerabilities through public GitHub issues. Please read our Security document [for more details](https://microsoft.github.io/wpa/reporting_security_issues.html).
### Changelog
See [NEWS.md](NEWS.md) for the package changelog.
See [NEWS.md](https://microsoft.github.io/wpa/news/index.html) for the package changelog.
---
## Code of Conduct
We would ask you to please read the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct) prior to engaging with this package.
We would ask you to please read the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/) prior to engaging with this package.
**Trademarks**
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow [Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general). Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow [Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general/). Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.
---

Просмотреть файл

@ -15,7 +15,7 @@ network_describe(
\item{hrvar}{Character vector of length 3 containing the HR attributes to be used.}
}
\description{
\Sexpr[results=rd]{lifecycle::badge("experimental")}
\ifelse{html}{\out{<a href='https://www.tidyverse.org/lifecycle/#experimental'><img src='figures/lifecycle-experimental.svg' alt='Experimental lifecycle'></a>}}{\strong{Experimental}}
Returns a data frame that gives a percentage of the group combinations that best represent
the population provided. Uses a person to person query.
}

Просмотреть файл

@ -62,7 +62,7 @@ Set as \code{0} to co-erce to a fast plotting method every time, and \code{Inf}
method.}
}
\description{
\Sexpr[results=rd]{lifecycle::badge("experimental")}
\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}.

Просмотреть файл

@ -55,7 +55,7 @@ Set as \code{0} to co-erce to a fast plotting method every time, and \code{Inf}
method.}
}
\description{
\Sexpr[results=rd]{lifecycle::badge("experimental")}
\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.
}

Просмотреть файл

@ -81,7 +81,7 @@ Set as \code{0} to co-erce to a fast plotting method every time, and \code{Inf}
method.}
}
\description{
\Sexpr[results=rd]{lifecycle::badge("experimental")}
\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.
}

Просмотреть файл

@ -41,6 +41,7 @@ that the variable has not changed, using a Wilcox signed-rank test.
## Run plot
period_change(sq_data, compvar = "Workweek_span", before_end = "2019-11-16")
\donttest{
## Run plot with more specific arguments
period_change(sq_data,
compvar = "Workweek_span",
@ -49,7 +50,7 @@ period_change(sq_data,
after_start = "2019-12-03",
after_end = "2019-12-16",
return = "percentage")
}
}
\seealso{
Other Flexible Input:

Просмотреть файл

@ -23,7 +23,7 @@ Valid options include:
}}
}
\description{
\Sexpr[results=rd]{lifecycle::badge("questioning")}
\ifelse{html}{\out{<a href='https://www.tidyverse.org/lifecycle/#questioning'><img src='figures/lifecycle-questioning.svg' alt='Questioning lifecycle'></a>}}{\strong{Questioning}}
Apply hierarchical clustering to selected metrics. Person averages are computed prior to clustering.
The hierarchical clustering uses cosine distance and the ward.D method
of agglomeration.
@ -40,12 +40,13 @@ personas_hclust(sq_data,
k = 4,
return = "table")
\donttest{
## Return data with clusters appended
personas_hclust(sq_data,
metrics = c("Collaboration_hours", "Workweek_span"),
k = 4,
return = "data")
}
}
\seealso{

Просмотреть файл

@ -18,6 +18,7 @@ having removed the person-weeks that are below 2 standard
deviations of each individual's collaboration activity.
}
\description{
\ifelse{html}{\out{<a href='https://www.tidyverse.org/lifecycle/#experimental'><img src='figures/lifecycle-experimental.svg' alt='Experimental lifecycle'></a>}}{\strong{Experimental}}
This function takes in a selected metric and uses z-score (number of standard
deviations) to identify and remove outlier weeks for individuals across time. There are applications
in this for removing weeks with abnormally low collaboration
@ -28,7 +29,6 @@ identified and removed \strong{with respect to each individual}, as opposed to t
has a longer runtime compared to \code{identify_outlier()}.
}
\details{
This function is on an experimental lifecycle.
For mature functions to remove common outliers, please see the following:
\itemize{
\item \code{identify_holidayweeks()}

Просмотреть файл

@ -20,17 +20,15 @@ knitr::opts_chunk$set(
## Background
This document walks through the **wpa** package, and provides some examples on how to use some of the functions. For our full online documentation for the package, please visit <https://microsoft.github.io/wpa>. For anything else related to Workplace Analytics, please visit <https://docs.microsoft.com/en-us/workplace-analytics/>.
This document walks through the **wpa** package, and provides some examples on how to use some of the functions. For our full online documentation for the package, please visit <https://microsoft.github.io/wpa/>. For anything else related to Workplace Analytics, please visit <https://docs.microsoft.com/en-us/workplace-analytics/>.
### Setting up
To start off using **wpa**, you'll have to load it by running `library(wpa)`. For the purpose of our examples, let's also loada few of the component packages of **tidyverse** (alternatively, you can just run `library(tidyverse)`:
To start off using **wpa**, you'll have to load it by running `library(wpa)`. For the purpose of our examples, let's also load **dplyr** as a component package of **tidyverse** (alternatively, you can just run `library(tidyverse)`:
```{r message=FALSE, warning=FALSE}
library(wpa)
library(dplyr)
library(tibble)
library(tidyr)
```
The package ships with a standard Person query dataset `sq_data`:
@ -202,4 +200,4 @@ Running the function will open up a HTML report in your browser, summarising the
## Feedback
Hope you found this useful! If you have any suggestions or feedback, please log them at <https://github.com/microsoft/wpa/issues>.
Hope you found this useful! If you have any suggestions or feedback, please log them at <https://github.com/microsoft/wpa/issues/>.