Specify an outcome variable and return p-test outputs. All numeric variables in the dataset are used as predictor variables.

p_test(data, outcome, behavior, paired = FALSE)

Arguments

data

A Person Query dataset in the form of a data frame.

outcome

A string specifying the name of a binary variable, i.e. can only contain the values 1 or 0. Used to group the two distributions.

behavior

A character vector specifying the column to be used as the behavior to test.

paired

Specify whether the dataset is paired or not. Defaults to TRUE.

Value

Returns a numeric value representing the p-value outcome of the test.

Details

This function is a wrapper around wilcox.test() from 'stats'.

Author

Mark Powers mark.powers@microsoft.com

Examples

# Simulate a binary variable X
# Returns a single p-value
library(dplyr)
sq_data %>%
  mutate(X = ifelse(Email_hours > 6, 1, 0)) %>%
  p_test(outcome = "X", behavior = "External_network_size")
#> [1] 4.847578e-82