Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 206235

Predictors are in random order in sjPlot using tab_model (r) (with reproducible code now)

$
0
0

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.

A csv with a working example dataset can be downloaded here: https://drive.google.com/file/d/1DUu6mUDMxob2eX91IAOJXA7cYiDLAMYQ/view?usp=sharing

Here is my working r code

Packages that are currently loaded

library(pacman) p_load(haven, tidyverse, utils, plyr, tidyr, car, psych, lme4,lmerTest, sjPlot, performance, expss, sjlabelled)

exampledata <- read.csv("exampledata.csv")

Run model

model <- lmer(depvar ~ predictor1*predictor2 + covariate1 + covariate2 + (1|id), data = exampledata) summary(model)

Make table

table <- tab_model(model)

This is my output from summary(model

This is the generated table from 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


Viewing all articles
Browse latest Browse all 206235

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>