Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 205372

Summarise all confidence intervals

$
0
0
library(gmodels)
library(dplyr)

df<- data.frame(a=1:5,b=6:10,c=11:15)

df %>% 
  summarise_all(funs(mean,sd,min,max))

At the moment I have a df which is producing a summary of the mean, sd, min, and max.

df %>% 
  summarise_all(funs(mean,sd,min,max, function(x) ci(x,confidence=0.95)[2]))

I am wanting do something similar and add lower ci (and eventually upper) ci using dplyr. However this is the error I get: Error: function(x) ci(x, confidence = 0.95)[2] must be a function name (quoted or unquoted) or an unquoted call, not function.

Call rlang::last_error() to see a back-trace.

sapply(df, function(x) ci(x,confidence=0.95)[2])

I know I can get the lower ci with a sapply but want to do this in dplyr.


Viewing all articles
Browse latest Browse all 205372

Trending Articles