0

My apologise for the banality of the question.

I have a series of list elemnts - all embedded within the same object - where I would like to remove always the same object:

>[13]>
$P3FCz
# A tibble: 5 x 9
  model effect   group    term            estimate std.error statistic           df p.value
  <chr> <chr>    <chr>    <chr>              <dbl>     <dbl>     <dbl>        <dbl>   <dbl>
1 1     fixed    NA       (Intercept)      -1.59       0.898   -1.77    0.000000154    1.00
2 1     fixed    NA       CONDNEG-NOC       0.196      1.27     0.155   0.000000154    1.00
3 1     fixed    NA       CONDNEU-NOC       0.113      1.27     0.0890  0.000000154    1.00
4 1     ran_pars COND     sd__(Intercept)   0.0822    NA       NA      NA             NA   
5 1     ran_pars Residual sd__Observation   4.47      NA       NA      NA             NA   

$P3Cz
# A tibble: 5 x 9
  model effect   group    term            estimate std.error statistic    df p.value
  <chr> <chr>    <chr>    <chr>              <dbl>     <dbl>     <dbl> <dbl>   <dbl>
1 10    fixed    NA       (Intercept)       1.12       0.739    1.52    72.0   0.132
2 10    fixed    NA       CONDNEG-NOC       0.372      1.04     0.356   72.0   0.723
3 10    fixed    NA       CONDNEU-NOC      -0.0441     1.04    -0.0422  72.0   0.966
4 10    ran_pars COND     sd__(Intercept)   0.190     NA       NA       NA    NA    
5 10    ran_pars Residual sd__Observation   3.57      NA       NA       NA    NA

... and so on for other 12 elemnts

whose the column I would like to get rid of, is model. Is there anyone who could suggest how to delete it from this object list, which I've created through this command lines:

models_list <- out_long %>%
  group_by(signals) %>%
  do(fit = lmerTest::lmer(value ~ COND + (1|COND), data = .)) 

statistics <- purrr::map_dfr(models_list$fit, broom.mixed::tidy, .id = "model") %>% 
  group_split(model) %>%  
  setNames(sort(unique(out_long$signals))) 

Thanks in advance for your support

12666727b9
  • 1,133
  • 1
  • 8
  • 22

1 Answers1

1

set the parameter .keep to FALSE as shown below:

purrr::map_dfr(models_list$fit, broom.mixed::tidy, .id = "model") %>% 
  group_split(model, .keep = FALSE) %>%  
  setNames(sort(unique(out_long$signals))) 
Onyambu
  • 67,392
  • 3
  • 24
  • 53
  • Do you know possibly how to merge all the commands lines that I've written above just in a unique pipe chian? – 12666727b9 Nov 02 '21 at 14:31
  • 1
    @mały_statystyczny just use pull after the do command. Ie `do(fit =...)%>%pull(fit)%>%map_dfr(broom.mixed::tidy,.id=...)%>%...` – Onyambu Nov 02 '21 at 15:47
  • thanks for your availability. You're teaching some very brilliant trick. You're pretty worth of some extra reputation points. If ypu do not mind I've just published a new post. It's about reproducing iteratively effective tables for these statistics results. If yu are willing to devote some time on it, I'll be very glad ;-) https://stackoverflow.com/questions/69812844/a-strategy-to-build-iteratively-tables-for-fitted-models-statistics-with-sjplot – 12666727b9 Nov 02 '21 at 16:01