I want to save output from my R markdown in a table format that I can directly add in my publication.
The code does wilcoxson signed rank test on multiple variables at the same time. I want to export the output I get from the modellist into a table format such that I can have the p - value and the variable names.
Additionally, I also tried using the sjt.frq() function from the sJplot library to get summary statistics for my likert scale data but apparently sjt.frq() does not show up anymore, does anyone know if it has been removed and why does it not show in R anymore? I have added the code I used with sjt.frq().
Thank you for the hep!
samp<-structure(list(ID_formerge = c(44422.98569, 44423.08525, 44423.09342, 44423.09724, 44423.82518), Participant = c("4", "5", "6", "7", "8"), ID_formerge.1 = c("C4", "C5", "C6", "C7", "C8"), country = c("Colombia-Bucaramanga",
"Colombia-Bucaramanga", "Colombia-Bucaramanga", "Colombia-Bucaramanga", "Colombia-Bucaramanga"), Fecha_bankssp = c(44422L, 44423L, 44423L, 44423L, 44423L), att1_goodofall = c(4L, 4L, 2L, 4L, 4L), att2_pvtdisease = c(4L, 4L, 3L, 3L, 4L),att3_curedisease = c(4L, 2L, 4L, 3L, 3L), att4_timewaste = c(4L, 4L, 3L, 5L, 4L), att5_helpgenerations = c(4L, 4L, 4L, 4L, 3L), att6_healthinterfere = c(4L, 3L, 3L, 5L, 3L), att7_helpfamily = c(4L, 3L, 3L, 3L, 4L), att8_noriskstolen = c(4L, 2L, 3L, 4L, 2L), att9_helpdengue = c(4L, 4L, 4L, 4L, 2L), att10_perinfosafe = c(4L, 4L, 3L, 4L, 2L), att11_identhealthproblem = c(4L, 2L, 3L, 3L, 4L), att12_highmedicalcost = c(4L, 3L, 2L, 4L, 3L)), row.names = c(NA,
5L), class = "data.frame")
modellist<-list()
for(i in 6:17){
fmla <- formula(paste(names(samp)[i], "~ country"))
modellist[[i]]<-wilcox.test(fmla, data = samp, paired = FALSE)
}
>#I tried the following way but it did not work.
samp%>%tab_cells(sheet(att1_goodofall,att2_pvtdisease,att3_curedisease))%>%tab_cols(total(label = "W"),am)%>%
tab_stat_fun_df(
funcation(x){
modellist<-list()
for(i in 6:17){
fmla <- formula(paste(names(samp)[i], "~ country"))
modellist[[i]]<-wilcox.test(fmla, data = sam, paired = FALSE)
sheet('p-value' = coef(modellist), confint(model))
}
}
)%>%tab_pivot()
sjt.frq(samp$att1_goodofall,variablelabels=variables['att1_goodofall'],valuelablels=values[['att1_goodofall']])