IndrajeetPatil / ggstatsplot

Enhancing {ggplot2} plots with statistical analysis 📊📣
https://indrajeetpatil.github.io/ggstatsplot/
GNU General Public License v3.0
1.97k stars 184 forks source link

Using ggcoefstats to display a tbl_df containing the output of a brms model #114

Closed vini-macuch-silva closed 5 years ago

vini-macuch-silva commented 5 years ago

Hi,

I tried displaying the output of a Bayesian regression model using ggcoefstats but I just can't manage to get it to work. I don't have reproducible code as it basically involves one function (ggcoefstats()) and one line of code, but here's my workflow, described in words:

  1. After fitting my model using brms() and saving the output as an .RDS file, I load the .RDS file and convert it to a tidied tibble using broom.mixed::tidy(), which supports brms;

  2. I then try displaying the tibble using ggcoefstats, but I get an error without any description. To be more precise, I'm trying ggstatsplot::ggcoefstats(x = RT_model_tidy), without any test statistic specification. Note that the tibble has all the appropriate columns, as required (i.e., term and estimate).

Thanks in advance for any tips!

vini-macuch-silva commented 5 years ago

Here's a more reproducible example of my workflow:

ggstatsplot::ggcoefstats(
  x = RT_model_tidy)
#> Error in class(x)[[1]] %in% unsupported.mods: object 'RT_model_tidy' not found
ibecav commented 5 years ago

Hi,

Your code is failing long before you get to ggstatsplot::ggcoefstats. Both the examples you posted highlight the fact that your original model is not being found. Could be bad path information or something about your file structure.

You need to get rid of this error first.

`RT_model <- readRDS("model-outputs/RT_model.RDS")

> Warning in gzfile(file, "rb"): cannot open compressed file 'model-outputs/

> RT_model.RDS', probable reason 'No such file or directory'

> Error in gzfile(file, "rb"): cannot open the connection`

When `RT_model <- readRDS("model-outputs/RT_model.RDS")

str(RT_model )` works you'll know you're on the right track

vini-macuch-silva commented 5 years ago

Hi Chuck,

Thanks very much for that. That was indeed the case when I imported the files in a wrong tab on RStudio (incomplete path information). Now that I'm doing it within the right path structure, I still get the error with ggstatsplot::ggcoefstats. str(RT_model) works fine.

IndrajeetPatil commented 5 years ago

I know why this is not working for you. For objects of class tbl (or any other kind of dataframe), the statistic argument should not be NULL. This is a bug. Apologies!

I will push a change soon to solve this.

vini-macuch-silva commented 5 years ago

Right, thanks for the input, Indrajeet. However, I tried specifying that before, and there was still an error to do with factor levels, here:

Error in `levels<-`(`*tmp*`, value = as.character(levels)) : 
  factor level [5] is duplicated
IndrajeetPatil commented 5 years ago

Can you share what your output from brms models look like? It's hard to diagnose what's going on without looking at the tbl you are entering into the function.

vini-macuch-silva commented 5 years ago

Sure. Here's the whole thing:

# A tibble: 16 x 8
   effect   component group         term                      estimate std.error  conf.low conf.high
   <chr>    <chr>     <chr>         <chr>                        <dbl>     <dbl>     <dbl>     <dbl>
 1 fixed    cond      NA            (Intercept)               5.79       0.0340   5.73       5.86   
 2 fixed    cond      NA            typeFal                  -0.0299     0.0102  -0.0503    -0.00970
 3 fixed    cond      NA            typeVer                  -0.000543   0.0105  -0.0218     0.0203 
 4 ran_pars cond      item          sd__(Intercept)           0.215      0.0219   0.176      0.261  
 5 ran_pars cond      item          sd__typeFal               0.0146     0.0110   0.000473   0.0399 
 6 ran_pars cond      item          sd__typeVer               0.0212     0.0133   0.00110    0.0492 
 7 ran_pars cond      submission_id sd__(Intercept)           0.266      0.0159   0.236      0.299  
 8 ran_pars cond      submission_id sd__typeFal               0.0268     0.0163   0.00168    0.0621 
 9 ran_pars cond      submission_id sd__typeVer               0.0366     0.0134   0.0124     0.0642 
10 ran_pars cond      item          cor__(Intercept).typeFal -0.0257     0.428   -0.817      0.804  
11 ran_pars cond      item          cor__(Intercept).typeVer  0.266      0.370   -0.592      0.877  
12 ran_pars cond      item          cor__typeFal.typeVer      0.0910     0.509   -0.858      0.910  
13 ran_pars cond      submission_id cor__(Intercept).typeFal  0.280      0.352   -0.506      0.887  
14 ran_pars cond      submission_id cor__(Intercept).typeVer  0.630      0.210    0.172      0.957  
15 ran_pars cond      submission_id cor__typeFal.typeVer      0.391      0.413   -0.608      0.942  
16 ran_pars cond      Residual      sd__Observation           0.281      0.00283  0.275      0.286  
vini-macuch-silva commented 5 years ago
structure(list(effect = c("fixed", "fixed", "fixed", "ran_pars", 
"ran_pars", "ran_pars", "ran_pars", "ran_pars", "ran_pars", "ran_pars", 
"ran_pars", "ran_pars", "ran_pars", "ran_pars", "ran_pars", "ran_pars"
), component = c("cond", "cond", "cond", "cond", "cond", "cond", 
"cond", "cond", "cond", "cond", "cond", "cond", "cond", "cond", 
"cond", "cond"), group = c(NA, NA, NA, "item", "item", "item", 
"submission_id", "submission_id", "submission_id", "item", "item", 
"item", "submission_id", "submission_id", "submission_id", "Residual"
), term = c("(Intercept)", "typeFal", "typeVer", "sd__(Intercept)", 
"sd__typeFal", "sd__typeVer", "sd__(Intercept)", "sd__typeFal", 
"sd__typeVer", "cor__(Intercept).typeFal", "cor__(Intercept).typeVer", 
"cor__typeFal.typeVer", "cor__(Intercept).typeFal", "cor__(Intercept).typeVer", 
"cor__typeFal.typeVer", "sd__Observation"), estimate = c(5.79418020957549, 
-0.0299178294218983, -0.000543140330436366, 0.214901438289064, 
0.0145870005142796, 0.0212152601138147, 0.265633253331641, 0.0268342032692802, 
0.036577612834576, -0.0256856477612839, 0.266130254159324, 0.0910009988749176, 
0.280384450435342, 0.629537299755329, 0.391078090510186, 0.280676574316031
), std.error = c(0.0340467311389221, 0.0102467481398605, 0.0105458815397743, 
0.0218767813989946, 0.0109683166452514, 0.0133175131228213, 0.0159054036467544, 
0.016340278071177, 0.013378593916756, 0.427895549336247, 0.370327479701484, 
0.509081518250157, 0.352015939695904, 0.210406715087688, 0.412585303158786, 
0.00283085864789277), conf.low = c(5.72869764343181, -0.0502841546638398, 
-0.0217512012400585, 0.176442638000084, 0.000472546142398068, 
0.00110340440165403, 0.236496895925071, 0.00168445484930733, 
0.0123511951107462, -0.81651962728396, -0.592387172951057, -0.858480410089071, 
-0.505662422408689, 0.172449614654224, -0.608014248669021, 0.275309086825284
), conf.high = c(5.86175766957825, -0.00969644072211255, 0.020340298583478, 
0.261147443639607, 0.0398844979780345, 0.0491598171502455, 0.298768289857492, 
0.0620956630791208, 0.0642347909939091, 0.804363992044674, 0.876577119518248, 
0.910125087999616, 0.886647479360548, 0.956547406098323, 0.941858420921083, 
0.286319019445041)), row.names = c(NA, -16L), class = c("tbl_df", 
"tbl", "data.frame"))
IndrajeetPatil commented 5 years ago

Ohhh. Now I see what the problem is. Every term in the term column should have unique names. That is not the case in your dataframe. There are a number of repeated terms (e.g., "sd__(Intercept)", "sd__typeFal", etc.). Once you remove these repeated terms, the function works just fine. So the solution is to rename terms so that there unique term names.


# setup
set.seed(123)
library(tidyverse)

# data
df <- structure(
  list(
    effect = c(
      "fixed",
      "fixed",
      "fixed",
      "ran_pars",
      "ran_pars",
      "ran_pars",
      "ran_pars",
      "ran_pars",
      "ran_pars",
      "ran_pars",
      "ran_pars",
      "ran_pars",
      "ran_pars",
      "ran_pars",
      "ran_pars",
      "ran_pars"
    ),
    component = c(
      "cond",
      "cond",
      "cond",
      "cond",
      "cond",
      "cond",
      "cond",
      "cond",
      "cond",
      "cond",
      "cond",
      "cond",
      "cond",
      "cond",
      "cond",
      "cond"
    ),
    group = c(
      NA,
      NA,
      NA,
      "item",
      "item",
      "item",
      "submission_id",
      "submission_id",
      "submission_id",
      "item",
      "item",
      "item",
      "submission_id",
      "submission_id",
      "submission_id",
      "Residual"
    ),
    term = c(
      "(Intercept)",
      "typeFal",
      "typeVer",
      "sd__(Intercept)",
      "sd__typeFal",
      "sd__typeVer",
      "sd__(Intercept)",
      "sd__typeFal",
      "sd__typeVer",
      "cor__(Intercept).typeFal",
      "cor__(Intercept).typeVer",
      "cor__typeFal.typeVer",
      "cor__(Intercept).typeFal",
      "cor__(Intercept).typeVer",
      "cor__typeFal.typeVer",
      "sd__Observation"
    ),
    estimate = c(
      5.79418020957549,
      -0.0299178294218983,
      -0.000543140330436366,
      0.214901438289064,
      0.0145870005142796,
      0.0212152601138147,
      0.265633253331641,
      0.0268342032692802,
      0.036577612834576,
      -0.0256856477612839,
      0.266130254159324,
      0.0910009988749176,
      0.280384450435342,
      0.629537299755329,
      0.391078090510186,
      0.280676574316031
    ),
    std.error = c(
      0.0340467311389221,
      0.0102467481398605,
      0.0105458815397743,
      0.0218767813989946,
      0.0109683166452514,
      0.0133175131228213,
      0.0159054036467544,
      0.016340278071177,
      0.013378593916756,
      0.427895549336247,
      0.370327479701484,
      0.509081518250157,
      0.352015939695904,
      0.210406715087688,
      0.412585303158786,
      0.00283085864789277
    ),
    conf.low = c(
      5.72869764343181,
      -0.0502841546638398,
      -0.0217512012400585,
      0.176442638000084,
      0.000472546142398068,
      0.00110340440165403,
      0.236496895925071,
      0.00168445484930733,
      0.0123511951107462,
      -0.81651962728396,
      -0.592387172951057,
      -0.858480410089071,
      -0.505662422408689,
      0.172449614654224,
      -0.608014248669021,
      0.275309086825284
    ),
    conf.high = c(
      5.86175766957825,
      -0.00969644072211255,
      0.020340298583478,
      0.261147443639607,
      0.0398844979780345,
      0.0491598171502455,
      0.298768289857492,
      0.0620956630791208,
      0.0642347909939091,
      0.804363992044674,
      0.876577119518248,
      0.910125087999616,
      0.886647479360548,
      0.956547406098323,
      0.941858420921083,
      0.286319019445041
    )
  ),
  row.names = c(NA, -16L),
  class = c("tbl_df",
            "tbl", "data.frame")
)

# checking how many times each term is repeated
df %>% dplyr::count(term)
#> # A tibble: 10 x 2
#>    term                         n
#>    <chr>                    <int>
#>  1 (Intercept)                  1
#>  2 cor__(Intercept).typeFal     2
#>  3 cor__(Intercept).typeVer     2
#>  4 cor__typeFal.typeVer         2
#>  5 sd__(Intercept)              2
#>  6 sd__Observation              1
#>  7 sd__typeFal                  2
#>  8 sd__typeVer                  2
#>  9 typeFal                      1
#> 10 typeVer                      1

# creating a dataframe with only unique term names
unique_term_df <- df %>% dplyr::count(term) %>% dplyr::filter(n == 1L)

# subsetting dataframe to have unique term names
df1 <- dplyr::filter(df, term %in% c(unique_term_df$term))

# plot
ggstatsplot::ggcoefstats(df1)
#> Note: No model diagnostics information available for the object of class tbl_df .
#> 
#> Note: For the object of class tbl_df , the argument `statistic` is not specified ('t', 'z', or 'f'),
#>  so no labels will be displayed.
#> 
#> Note: No p-values and/or statistic available for regression coefficients from tbl_df object, so skipping labels.
#> 

Created on 2018-12-20 by the reprex package (v0.2.1)

Session info ``` r devtools::session_info() #> - Session info ---------------------------------------------------------- #> setting value #> version R Under development (unstable) (2018-11-30 r75724) #> os Windows 10 x64 #> system x86_64, mingw32 #> ui RTerm #> language (EN) #> collate English_United States.1252 #> ctype English_United States.1252 #> tz Asia/Calcutta #> date 2018-12-20 #> #> - Packages -------------------------------------------------------------- #> package * version date lib #> assertthat 0.2.0 2017-04-11 [1] #> backports 1.1.3 2018-12-14 [1] #> BayesFactor 0.9.12-4.2 2018-05-19 [1] #> bayesplot 1.6.0 2018-08-02 [1] #> bindr 0.1.1 2018-03-13 [1] #> bindrcpp * 0.2.2 2018-03-29 [1] #> boot 1.3-20 2017-08-06 [2] #> broom 0.5.1.9000 2018-12-19 [1] #> broom.mixed 0.2.3.9000 2018-11-28 [1] #> callr 3.1.0 2018-12-10 [1] #> cellranger 1.1.0 2016-07-27 [1] #> cli 1.0.1.9000 2018-10-30 [1] #> cluster 2.0.7-1 2018-04-13 [2] #> coda 0.19-2 2018-10-08 [1] #> codetools 0.2-15 2016-10-05 [2] #> coin 1.2-2 2017-11-28 [1] #> colorspace 1.3-2 2016-12-14 [1] #> cowplot 0.9.99 2018-10-29 [1] #> crayon 1.3.4 2017-09-16 [1] #> curl 3.2 2018-03-28 [1] #> data.table 1.11.8 2018-09-30 [1] #> DEoptimR 1.0-8 2016-11-19 [1] #> desc 1.2.0 2018-10-30 [1] #> devtools 2.0.1 2018-10-26 [1] #> digest 0.6.18 2018-10-10 [1] #> dplyr * 0.7.8 2018-11-10 [1] #> effsize 0.7.1 2017-03-21 [1] #> emmeans 1.3.1 2018-12-13 [1] #> estimability 1.3 2018-02-11 [1] #> evaluate 0.12 2018-10-09 [1] #> exact2x2 1.6.3 2018-07-27 [1] #> exactci 1.3-3 2017-10-02 [1] #> fansi 0.4.0 2018-11-05 [1] #> fit.models 0.5-14 2017-04-06 [1] #> forcats * 0.3.0 2018-02-19 [1] #> foreign 0.8-71 2018-07-20 [2] #> fs 1.2.6 2018-08-23 [1] #> generics 0.0.2 2018-11-29 [1] #> ggcorrplot 0.1.2.9000 2018-12-17 [1] #> ggExtra 0.8 2018-11-08 [1] #> ggplot2 * 3.1.0.9000 2018-12-15 [1] #> ggrepel 0.8.0 2018-05-09 [1] #> ggridges 0.5.1 2018-09-27 [1] #> ggsignif 0.4.0 2017-08-03 [1] #> ggstatsplot 0.0.7.9000 2018-12-20 [1] #> glmmTMB 0.2.2.0 2018-07-03 [1] #> glue 1.3.0 2018-07-17 [1] #> groupedstats 0.0.4.9000 2018-12-12 [1] #> gtable 0.2.0 2016-02-26 [1] #> gtools 3.8.1 2018-06-26 [1] #> haven 2.0.0 2018-11-22 [1] #> highr 0.7 2018-06-09 [1] #> hms 0.4.2 2018-03-10 [1] #> htmltools 0.3.6 2017-04-28 [1] #> httpuv 1.4.5.1 2018-12-18 [1] #> httr 1.4.0 2018-12-11 [1] #> jmv 0.9.6 2018-12-11 [1] #> jmvcore 0.9.5.2 2018-12-10 [1] #> jsonlite 1.6 2018-12-07 [1] #> knitr 1.21 2018-12-10 [1] #> labeling 0.3 2014-08-23 [1] #> later 0.7.5 2018-09-18 [1] #> lattice 0.20-38 2018-11-04 [2] #> lazyeval 0.2.1 2017-10-29 [1] #> lme4 1.1-19 2018-11-10 [1] #> lubridate 1.7.4 2018-04-11 [1] #> magrittr 1.5 2014-11-22 [1] #> MASS 7.3-51.1 2018-11-01 [2] #> Matrix 1.2-15 2018-11-01 [1] #> MatrixModels 0.4-1 2015-08-22 [1] #> mc2d 0.1-18 2017-03-06 [1] #> memoise 1.1.0 2017-04-21 [1] #> metafor 2.0-0 2017-06-22 [1] #> mime 0.6 2018-10-05 [1] #> miniUI 0.1.1.1 2018-05-18 [1] #> minqa 1.2.4 2014-10-09 [1] #> mnormt 1.5-5 2016-10-15 [1] #> modelr 0.1.2 2018-05-11 [1] #> modeltools 0.2-22 2018-07-16 [1] #> multcomp 1.4-8 2017-11-08 [1] #> munsell 0.5.0 2018-06-12 [1] #> mvtnorm 1.0-8 2018-05-31 [1] #> nlme 3.1-137 2018-04-07 [2] #> nloptr 1.2.1 2018-10-03 [1] #> paletteer 0.1.0 2018-07-10 [1] #> pbapply 1.3-4 2018-01-10 [1] #> pcaPP 1.9-73 2018-01-14 [1] #> pillar 1.3.1 2018-12-15 [1] #> pkgbuild 1.0.2 2018-10-16 [1] #> pkgconfig 2.0.2 2018-08-16 [1] #> pkgload 1.0.2 2018-10-29 [1] #> plyr 1.8.4 2016-06-08 [1] #> prediction 0.3.6.1 2018-12-04 [1] #> prettyunits 1.0.2 2015-07-13 [1] #> processx 3.2.1 2018-12-05 [1] #> promises 1.0.1 2018-04-13 [1] #> ps 1.2.1 2018-11-06 [1] #> psych 1.8.11.15 2018-11-16 [1] #> purrr * 0.2.5.9000 2018-11-28 [1] #> purrrlyr 0.0.3 2018-05-29 [1] #> pwr 1.2-2 2018-03-03 [1] #> R6 2.3.0 2018-10-04 [1] #> Rcpp 1.0.0 2018-11-07 [1] #> readr * 1.3.0.9000 2018-12-16 [1] #> readxl 1.1.0 2018-04-20 [1] #> remotes 2.0.2 2018-10-30 [1] #> reshape 0.8.8 2018-10-23 [1] #> reshape2 1.4.3 2017-12-11 [1] #> rjson 0.2.20 2018-06-08 [1] #> rlang 0.3.0.1 2018-10-25 [1] #> rmarkdown 1.11 2018-12-08 [1] #> robust 0.4-18 2017-04-27 [1] #> robustbase 0.93-3 2018-09-21 [1] #> rprojroot 1.3-2 2018-01-03 [1] #> rrcov 1.4-7 2018-11-15 [1] #> rstudioapi 0.8 2018-10-02 [1] #> rvest 0.3.2 2016-06-17 [1] #> sandwich 2.5-0 2018-08-17 [1] #> scales 1.0.0 2018-08-09 [1] #> sessioninfo 1.1.1 2018-11-05 [1] #> shiny 1.2.0 2018-11-02 [1] #> sjlabelled 1.0.15 2018-11-22 [1] #> sjmisc 2.7.6 2018-11-06 [1] #> sjstats 0.17.2 2018-11-15 [1] #> skimr 1.0.3 2018-06-07 [1] #> snakecase 0.9.2 2018-08-14 [1] #> ssanv 1.1 2015-06-23 [1] #> stringdist 0.9.5.1 2018-06-08 [1] #> stringi 1.2.4 2018-07-20 [1] #> stringr * 1.3.1 2018-05-10 [1] #> survival 2.43-3 2018-11-26 [2] #> testthat 2.0.1 2018-10-13 [1] #> TH.data 1.0-9 2018-07-10 [1] #> tibble * 1.4.99.9006 2018-12-19 [1] #> tidyr * 0.8.2 2018-10-28 [1] #> tidyselect 0.2.5 2018-10-11 [1] #> tidyverse * 1.2.1 2017-11-14 [1] #> TMB 1.7.15 2018-11-09 [1] #> usethis 1.4.0.9000 2018-12-12 [1] #> utf8 1.1.4 2018-05-24 [1] #> withr 2.1.2 2018-03-15 [1] #> WRS2 0.10-0 2018-06-15 [1] #> xfun 0.4 2018-10-23 [1] #> xml2 1.2.0 2018-01-24 [1] #> xtable 1.8-3 2018-08-29 [1] #> yaml 2.2.0 2018-07-25 [1] #> zoo 1.8-4 2018-09-19 [1] #> source #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> Github (tidymodels/broom@1c394a7) #> Github (bbolker/broom.mixed@b3ad950) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> Github (r-lib/cli@56538e3) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> Github (wilkelab/cowplot@a4ccd77) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.0) #> Github (r-lib/desc@7c12d36) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.0) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.0) #> Github (brodieG/fansi@ab11e9c) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> local #> Github (daattali/ggExtra@f2a04df) #> Github (tidyverse/ggplot2@9292832) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> local #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> local #> CRAN (R 3.5.1) #> CRAN (R 3.5.0) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.6.0) #> CRAN (R 3.6.0) #> CRAN (R 3.6.0) #> CRAN (R 3.6.0) #> CRAN (R 3.6.0) #> CRAN (R 3.5.0) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.0) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.0) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.0) #> CRAN (R 3.5.0) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> local #> Github (tidyverse/purrr@b4ae036) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> Github (tidyverse/readr@1f84c49) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.5.0) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.6.0) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.0) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> Github (tidyverse/tibble@181aaab) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> Github (r-lib/usethis@923dd75) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.6.0) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> CRAN (R 3.5.1) #> #> [1] C:/Users/inp099/Documents/R/win-library/3.6 #> [2] C:/Program Files/R/R-devel/library ```
vini-macuch-silva commented 5 years ago

Phew, glad to hear. Thanks a lot for your help. The interesting thing is that I initially tried filtering out the random effects, exactly so I would only have the 3 initial rows (no repeated terms), but that didn't work either.

IndrajeetPatil commented 5 years ago

Reopening because I think the documentation can be a bit better to help understand the user what this error is.

IndrajeetPatil commented 5 years ago
# data
df <- tibble::tribble(~term, ~estimate,
              "x", 0.03,
              "x", 0.05)

# attempt to create plot
ggstatsplot::ggcoefstats(df)

#> Note: No model diagnostics information available for the object of class tbl_df .
#> 
#> Note: For the object of class tbl_df , the argument `statistic` is not specified ('t', 'z', or 'f'),
#>  so no labels will be displayed.
#> 
#> Error: All elements in the column `term` should be unique.
#> 
#> Error:

Created on 2018-12-20 by the reprex package (v0.2.1)