I got it , s to use library(pivottabler),
here is an example
library(pivottabler)
Communication <- sample(c("ORANGE", "TIGO", "MTN"), 100, replace=T)
school <- sample(c("BSA1", "BSA2", "HSA1"), 100, replace=T)
teacher <- sample(c("Tom", "Dick", "Harry"), 100, replace=T)
growth <- rnorm(100, 5, 3)
myDf <- data.frame(school, school1, teacher, growth)
# arguments: qhpvt(dataFrame, rows, columns, calculations, ...)
qpvt(myDf, c("school","school1", "teacher"), NULL,
c("Average Growth"="sum(growth)",
"# of Scholars"="n()"), "# of Scholars2"="n()",
formats=list("%.1f", "%.1f", "%.0f"))
This can help someone else financial institutions.
Thanks