add_stats.data.frame: add_stats data frame function

Description Usage Arguments Examples

View source: R/add_stats.data.frame.r

Description

add_stats.data.frame is a function to add a tidy data frame of results to a tidystats list. tidystats does not support all possible statistical tests, so it may not be able to produce tidy output of a statistical model. The best solution for now is to tidy the output of a statistical test yourself, creating a tidy data frame, and then use add_stats, which will call this function, to add it to the tidystats list.

Usage

1
2
3
4
## S3 method for class 'data.frame'
add_stats(results, output, identifier = NULL,
  type = NULL, confirmatory = NULL, notes = NULL, class = NULL,
  args = NULL)

Arguments

results

A tidystats list.

output

A data frame that contains statistical output in a tidy format.

identifier

A character string identifying the model. Automatically created if not provided.

type

A character string indicating the type of test. One of "hypothesis", "manipulation check", "contrast", "descriptives", or "other". Can be abbreviated.

confirmatory

A boolean to indicate whether the statistical test was confirmatory (TRUE) or exploratory (FALSE). Can be NA.

notes

A character string to add additional information. Some statistical tests produce notes information, which will be overwritten if notes are provided.

class

Unused.

args

Unused.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# Create an empty list to store the results in
results <- list()

# Example: Manual chi-squared test of independence
x_squared_data <- data.frame(
  statistic = c("X-squared", "df", "p"),
  value = c(5.4885, 6, 0.4828),
  method = "Chi-squared test of independence"
  )

# Add results to results
results <- add_stats(results, x_squared_data)

WillemSleegers/tidystats-v0.3 documentation built on Aug. 12, 2019, 5:31 p.m.