Summarise: Summarise Data

Description Usage Arguments Value Examples

View source: R/Summarise.R

Description

Summarise: ist eine Erweiterung aggregate()

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Summarise(
  ...,
  fun = function(x) length(na.omit(x)),
  key = "variable",
  value = "value",
  na.action = na.pass,
  formula = NULL,
  margins = FALSE,
  margins_name = "Total"
)

Recast2(
  Formula,
  data,
  fun = function(x) length(na.omit(x)),
  key = "variable",
  value = "value",
  na.action = na.pass,
  X,
  id.vars,
  measure.var,
  formula = NULL,
  labels,
  margins = FALSE,
  margins_name = "gesamt"
)

Arguments

...

An Long() daten Formeln,Variablen-Namen

fun

function(x) length(na.omit(x)) an aggregate

key, value

an Long bzw

na.action

an aggregate

formula

Zeilen/Spalten Lang/Weit

margins, margins_name

Gesamt

Value

reshape objek

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
 mean3<- function(x) mean(x, round(na.rm=TRUE),2)
df <- data.frame(
  month = rep(1:3, 2),
  student = rep(c("Amy", "Bob"), each = 3),
  A = c(9, 7, 6, 8, 6, 9),
  B = c(6, 7, 8, 5, 6, 7)
)

Summarise(A + B ~ student, df )

df %>%  Summarise2(
  A,
  B,
  by =  ~ student+ month,
  fun = mean3,
  formula=student ~ month,
  margins = TRUE 
)
#Recast(chol0+chol1+chol6+chol12~g, hyper, mean, "Zeit", "Cholesterin")  
#Summarise(chol0+chol1+chol6+chol12~g, hyper, fun= mean,  key="Zeit", value="Cholesterin")

stp4/stp25aggregate documentation built on Sept. 17, 2021, 5:34 a.m.