Function to compare treatment from lm or aov using data frames

mean_comparison(
  data,
  fb_smr,
  variable,
  model_facts,
  comp_facts,
  test_comp = "SNK",
  sig_level = 0.05,
  graph_opts = FALSE,
  digits = 2
)

Arguments

data

Fieldbook data.

fb_smr

Summary of the variables in the fieldbook.

variable

Model used for the experimental design.

model_facts

Comparison test (default = "SNK"). Others: "TUKEY", "DUNCAN".

comp_facts

Significance level for the analysis (default = 0.05).

test_comp

Significance level for the analysis (default = 0.05).

sig_level

Significance level for the analysis (default = 0.05).

graph_opts

Include option in the table for graphs (default = FALSE).

digits

Number of digits in the table.

Value

data frame

Details

For compare the factors you should use ":". For example, to compare treatment1 and treatment2: treatment1:treatment2.

Examples

library(inti) library(googlesheets4) if (gs4_has_token()) { url <- paste0("https://docs.google.com/spreadsheets/d/" , "15r7ZwcZZHbEgltlF6gSFvCTFA-CFzVBWwg3mFlRyKPs") # browseURL(url) gs <- as_sheets_id(url) (data <- gs %>% range_read("fb")) fbsm <- fieldbook_summary(data , last_factor = "genotype" , model_facts = "treat*genotype" , comp_facts = "treat:genotype" ) mc <- mean_comparison(data , fb_smr = fbsm , variable = "HI" , graph_opts = TRUE ) table <- mc$comparison # fbsm %>% sheet_write(ss = gs, sheet = "fbsm") }