summarySE: Automatically create summary standard error for plotting...

View source: R/summarySE.R

summarySER Documentation

Automatically create summary standard error for plotting error bar in ggplot2

Description

This function creates summary standard error for plotting error bar in ggplot2

Usage

summarySE(
  data = NULL,
  measurevar,
  groupvars = NULL,
  na.rm = TRUE,
  conf.interval = 0.95,
  drop = TRUE
)

Arguments

data

specify dataframe

measurevar

specify measure variables for mean, n, sd, se, ci

groupvars

specify grouping variables

na.rm

TRUE/FALSE whether to remove missing values or not

conf.interval

specify confidence interval

drop

TRUE/FALSE specify whether to drop or not

Value

returns a dataframe with n, mean, sd, ci, se

Examples

## Not run: 
dsummary <- summarySE(iris,
  measurevar = "Petal.Width",
  groupvars = c("Species", "Sepal.Length")
)
dsummary <- summarySE(iris,
  measurevar = "Sepal.Length",
  groupvars = c("Species", "Petal.Width"), F
)
ggplot(dsummary, aes(Sepal.Length, Petal.Width)) +
  geom_point() +
  geom_errorbar(aes(ymin = Petal.Width - se, ymax = Petal.Width + se), width = .03) +
  geom_smooth()

## End(Not run)

IbrahimHE/wrangler documentation built on March 27, 2022, 4:23 p.m.