Power

library(pwr)
fun_calculation <- function(n,sig.level,power,alternative,es,type){
d <- cohen.ES(test = 't',size = es)\$effect.size
result <- lapply(sig.level,function(x){pwr.t.test(d = d,n = n,sig.level = x,power = power,alternative = alternative,type = type)})
result.df <- data.frame(sig.level,ceiling(sapply(result,function(x)as.numeric(x[1]))))
colnames(result.df)[2] <- paste0('d=',d,',power=',power,',type=',type,'<br>alternative=',alternative,',Effects size=',es)
return(result.df)
}
type <- 'one.sample'
sig.level <- seq(0.01,0.1,by=0.01)
n.df <- Reduce(function(x,y){merge(x, y)},lapply(c(0.7,0.8,0.9),function(x)fun_calculation(NULL,sig.level,x,'two.sided','small',type)))
n:『Number of observations(per sample)』(Reference manual)
sig.level d=0.2,power=0.7,type=one.sample
alternative=two.sided,Effects size=small
d=0.2,power=0.8,type=one.sample
alternative=two.sided,Effects size=small
d=0.2,power=0.9,type=one.sample
alternative=two.sided,Effects size=small
0.01 244 296 376
0.02 206 254 329
0.03 184 230 301
0.04 169 212 281
0.05 157 199 265
0.06 147 188 252
0.07 139 178 241
0.08 131 170 232
0.09 125 163 223
0.1 119 156 216

Conventional effects size

n.df <- Reduce(function(x,y){merge(x, y)},lapply(c("small","medium","large"),function(x)fun_calculation(NULL,sig.level,0.9,'two.sided',x,type)))
n:『Number of observations(per sample)』(Reference manual)
sig.level d=0.2,power=0.9,type=one.sample
alternative=two.sided,Effects size=small
d=0.5,power=0.9,type=one.sample
alternative=two.sided,Effects size=medium
d=0.8,power=0.9,type=one.sample
alternative=two.sided,Effects size=large
0.01 376 63 27
0.02 329 55 24
0.03 301 51 22
0.04 281 47 20
0.05 265 44 19
0.06 252 42 18
0.07 241 40 17
0.08 232 39 17
0.09 223 37 16
0.1 216 36 15