### Power

library(pwr)
fun_calculation <- function(n,sig.level,power,alternative,es){
r <- cohen.ES(test = 'r',size = es)\$effect.size
result <- lapply(sig.level,function(x){pwr.r.test(n = n,r = r,sig.level = x,power = power,alternative = alternative)})
result.df <- data.frame(sig.level,ceiling(sapply(result,function(x)as.numeric(x[1]))))
colnames(result.df)[2] <- paste0('r=',r,',power=',power,'<br>alternative=',alternative,',Effects size=',es)
return(result.df)
}
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')))
n:『Number of observations(per sample)』(Reference manual)
sig.level r=0.1,power=0.7
alternative=two.sided,Effects size=small
r=0.1,power=0.8
alternative=two.sided,Effects size=small
r=0.1,power=0.9
alternative=two.sided,Effects size=small
0.01 958 1,163 1,481
0.02 810 1,000 1,296
0.03 724 904 1,186
0.04 663 835 1,108
0.05 616 782 1,046
0.06 577 739 996
0.07 545 702 953
0.08 517 670 916
0.09 492 642 883
0.1 470 617 853

### 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)))
n:『Number of observations(per sample)』(Reference manual)
sig.level r=0.1,power=0.9
alternative=two.sided,Effects size=small
r=0.3,power=0.9
alternative=two.sided,Effects size=medium
r=0.5,power=0.9
alternative=two.sided,Effects size=large
0.01 1,481 158 52
0.02 1,296 139 46
0.03 1,186 127 42
0.04 1,108 119 40
0.05 1,046 112 38
0.06 996 107 36
0.07 953 102 34
0.08 916 99 33
0.09 883 95 32
0.1 853 92 31