I'm using the tab_model function in sjPlot in r. This function normally works smoothly for me, however, I noticed that the output table is oddly ordering variables in an order other than is in the lmer output.
Data at the bottom of the question.
Here is my working r code
#Packages that are currently loaded
library(lmerTest)
library(sjPlot)
library(sjlabelled)
##Run model
model <- lmer(depvar ~ predictor1*predictor2 + covariate1 + covariate2 + (1|id), data = exampledata)
summary(model)
#Make table
table <- tab_model(model)
I know that one solution is to reorder the predictors manually, however, this is not optimal, because I also want to assign labels to the predictors, and when i try to do both, the labels are assigned in the default, as opposed to manually redone, order.
Any leads on why my table is being printed in an order other than the lmer output would be most appreciated!
Thank you in advance for any ideas you might have!
Michael
Data:
exampledata <- structure(list(X = c(142L, 51L, 720L, 730L, 664L, 826L, 605L,
587L, 216L, 75L, 862L, 928L, 935L, 972L, 724L, 840L, 506L, 771L,
393L, 14L, 592L, 62L, 635L, 572L, 800L, 36L, 744L, 971L, 166L,
649L, 901L, 975L, 723L, 145L, 895L, 1017L, 677L, 570L, 106L,
451L, 1018L, 13L, 735L, 579L, 433L, 586L, 56L, 363L, 889L, 504L
), id = c(202L, 139L, 662L, 671L, 610L, 751L, 566L, 554L, 270L,
153L, 773L, 819L, 831L, 858L, 665L, 759L, 494L, 707L, 402L, 110L,
556L, 145L, 592L, 542L, 729L, 130L, 683L, 858L, 221L, 600L, 797L,
862L, 665L, 204L, 793L, 889L, 624L, 541L, 175L, 453L, 889L, 110L,
678L, 548L, 440L, 552L, 141L, 381L, 789L, 492L), predictor1 = c(1L,
0L, 1L, 1L, 1L, 1L, 0L, 0L, 0L, 0L, 1L, 1L, 0L, 1L, 0L, 1L, 1L,
0L, 0L, 1L, 1L, 1L, 0L, 1L, 1L, 1L, 0L, 0L, 1L, 0L, 0L, 0L, 1L,
0L, 0L, 0L, 0L, 1L, 1L, 0L, 1L, 0L, 1L, 0L, 0L, 1L, 0L, 0L, 0L,
0L), predictor2 = c(0.5, -0.5, -0.5, 0.5, 0.5, 0.5, -0.5, 0.5,
0.5, -0.5, -0.5, -0.5, 0.5, 0.5, -0.5, -0.5, 0.5, -0.5, 0.5,
-0.5, -0.5, -0.5, -0.5, 0.5, -0.5, 0.5, -0.5, 0.5, 0.5, 0.5,
0.5, -0.5, -0.5, 0.5, 0.5, 0.5, 0.5, -0.5, -0.5, 0.5, 0.5, -0.5,
0.5, -0.5, 0.5, 0.5, -0.5, -0.5, -0.5, 0.5), covariate1 = c(2L,
-1L, -1L, -1L, -1L, -1L, -1L, 2L, 2L, -1L, 2L, -1L, -1L, -1L,
-1L, -1L, -1L, -1L, -1L, -1L, 2L, 2L, -1L, -1L, -1L, -1L, -1L,
-1L, -1L, -1L, 2L, 2L, -1L, -1L, 2L, -1L, -1L, -1L, -1L, -1L,
-1L, -1L, -1L, -1L, 2L, 2L, -1L, 2L, -1L, 2L), covariate2 = c(0L,
-1L, 1L, 1L, 1L, 1L, 1L, 0L, 0L, 1L, 0L, 1L, -1L, 1L, 1L, -1L,
-1L, 1L, 1L, -1L, 0L, 0L, 1L, -1L, 1L, -1L, -1L, 1L, 1L, -1L,
0L, 0L, 1L, -1L, 0L, -1L, -1L, 1L, -1L, 1L, -1L, -1L, 1L, -1L,
0L, 0L, 1L, 0L, 1L, 0L), depvar = c(25, 16.6666666666667, 66.6666666666667,
33.3333333333333, 41.6666666666667, 0, 8.33333333333333, 25,
83.3333333333333, 58.3333333333333, 91.6666666666667, 33.3333333333333,
41.6666666666667, 0, 0, 41.6666666666667, 33.3333333333333, 50,
100, 16.6666666666667, 100, 66.6666666666667, 25, 66.6666666666667,
50, NA, 16.6666666666667, 0, 8.33333333333333, 16.6666666666667,
75, 58.3333333333333, 0, 41.6666666666667, 50, 16.6666666666667,
16.6666666666667, 0, 50, 50, 25, 8.33333333333333, 41.6666666666667,
41.6666666666667, 41.6666666666667, 50, 66.6666666666667, 58.3333333333333,
50, 50)), row.names = c(NA, -50L), class = "data.frame")