strengejacke / sjPlot

sjPlot - Data Visualization for Statistics in Social Science
https://strengejacke.github.io/sjPlot
603 stars 91 forks source link

Add variable names for tab_itemscale #813

Open stefanradev93 opened 2 years ago

stefanradev93 commented 2 years ago

Hi everyone,

it seems that currently the HTML output of the function tab_itemscale does not display the variable names. This is unfortunate, as one might get pretty mixed up when a data frame contains tens of variables.

It appears, however, that the internal list entry df.list in the output does contain the variable names as row.names. So maybe I am missing some argument which controls the display of the variable names in the HTML output?

Best, Stefan

TefyRey commented 2 years ago

Hi Stefan, Have you found any answer on other websites? I have already tried these without showing anything:

library(sjmisc)

retrieve variable and value labels

varlabs <- get_label(MyDataSet)

recveive first item of MyData-index scale

start <- which(colnames(MyDataSet) == "A1_1")

recveive last item of MyData-index scale

end <- which(colnames(MyDataSet) == "A1_10")

create data frame with MyData-index scale

mydf <- data.frame(MyDataSet[, c(start:end)]) colnames(mydf) <- varlabs[c(start:end)] sjt.itemanalysis(mydf)

I found it in: https://www.rdocumentation.org/packages/sjPlot/versions/2.0.0/topics/sjt.itemanalysis

Regards, ESTEFANY