I would like to put a table in a file word with the package RTF.
My code is
univ_quali<-function(dataset){ print(cbind(prop.table(table(sex)), t(t(table(sex)))))}
univ_quali(sex)
[,1] [,2]
1 0.5754717 61
2 0.4245283 45
I tried this
addTable(rapportrtf,univ_quali(sex))
but it return a table like that on the word document:
V1 V2
0.5754717 61
0.4245283 45
I would like
percentage sum
1 0.5754717 61
2 0.4245283 45
Reproductible exemple:
set.seed(24)
sex <- sample(c("male", "female"), 106, replace=TRUE)
How can i do?