Problem with my code

What is the problem with this code?

consort_plot(data = ba_para_flujograma,
             order = c(id_mujer = "Registros\nidentificados\n",
                       excluir = "Excluidas",
                       regresa_sn = "Análisis\nde retorno",
                       id_mujer = ""
                        #para_analisis = "Analisis principal",
             ),
             side_box = c("excluir"),
             allocation = c("regresa_sn"),
             #dist = 0.03,
             cex = 0.6)
Error en add_box(gp_list, txt = txt, just = text_just, text_width = text_width): 
  Text with length of 1 or same node number as `prev_box`.

I think we need to see some sample data to try to answer that.

A handy way to supply some sample data is the dput() function. In the case of a large dataset something like dput(head(mydata, 100)) should supply the data we need. Just do dput(mydata) where mydata is your data. Copy the output and paste it here between
```

```

1 Like

Maybe have a look at the example here as well: R Workflow – 8 Data Overview (hbiostat.org)

Hi, i can't show dput() cause the dimention of the data.frame are 47245 rows and 6 columns, but I can show this:

head(ba_para_flujograma)
# A tibble: 6 × 6
  id_mujer excluir  edad match_demo_sn resultado_hpv regresa_sn
     <dbl> <chr>   <dbl>         <dbl> <chr>         <chr>     
1    43360 NA         43             1 NEG           Regresa   
2   255074 NA         67             1 NEG           No Regresa
3   249484 NA         66             1 NEG           No Regresa
4   249470 NA         46             1 NEG           Regresa   
5    29248 NA         39             1 NEG           Regresa   
6    89203 NA         43             1 NEG           Regresa 

map(ba_para_flujograma[, -c(1,3)], table)
$excluir

                 menor de 30 no está en base Demostración           positivo inmediato 
                         258                         4609                           36 

$match_demo_sn

    0     1 
 4864 42381 

$resultado_hpv

  NEG 
47245 

$regresa_sn

No Regresa    Regresa 
     21788      20554 

Thanks that is helpful but we probably do not need to have all your data though I am not familiar with {consort} .

If you can give us a sample, say 200 rows, it should help. Do

dput(head( dput(head(ba_para_flujograma, 200))

and paste the results here should be enough, I hope.

1 Like

Hi, here you have the ouput. Thanks for the help.

> dput(head( dput(head(ba_para_flujograma, 200))))

structure(list(id_mujer = c(43360, 255074, 249484, 249470, 29248, 
89203, 68039, 255345, 94004, 255324, 94733, 96950, 255340, 87795, 
88980, 87014, 43378, 38871, 250027, 250040, 250033, 194487, 60808, 
100943, 255011, 87910, 254976, 254961, 95223, 218829, 61312, 
250585, 250580, 250574, 87220, 198442, 100289, 42667, 256165, 
106015, 255023, 58421, 267538, 255647, 94736, 255034, 255354, 
167732, 16913, 102552, 251072, 146733, 74684, 96109, 253105, 
78926, 95208, 255575, 89193, 89263, 255563, 255568, 255584, 251562, 
251634, 251611, 251510, 251571, 251622, 251550, 252928, 22236, 
61845, 97985, 256273, 94653, 97470, 53303, 14703, 254246, 93195, 
67756, 107302, 25490, 256115, 256408, 256125, 256136, 253254, 
60722, 94215, 252577, 252627, 252612, 32218, 255187, 170600, 
170509, 62908, 39425, 94812, 256457, 256413, 256462, 256443, 
14121, 25342, 253166, 253179, 253201, 253236, 41327, 17167, 234923, 
212863, 212791, 96969, 156989, 164170, 112051, 99248, 250107, 
253734, 97190, 253737, 47608, 11948, 254283, 254273, 254200, 
94063, 261919, 101127, 261926, 105947, 84083, 55757, 257434, 
95550, 148752, 50816, 61166, 254364, 50030, 52890, 25834, 254278, 
16811, 20034, 25267, 25015, 96262, 100475, 95951, 261929, 160864, 
137721, 79038, 255569, 86610, 153925, 25172, 255567, 66316, 255579, 
14129, 255576, 66620, 67790, 255644, 24754, 43370, 25918, 25751, 
25670, 46047, 161431, 255307, 216052, 93757, 261950, 105662, 
261941, 261948, 134653, 135881, 261938, 257476, 79839, 17633, 
30968, 261243, 65999, 260961, 259076, 10558, 96424, 255887, 25963, 
255897), excluir = c(NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
NA, NA, NA, NA, NA, NA, "positivo inmediato", NA, NA, NA, "no está en base Demostración", 
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, "no está en base Demostración", 
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
NA, NA, "menor de 30", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 
NA, NA, NA, NA, NA, NA), edad = c(43, 67, 66, 46, 39, 43, 63, 
53, 51, 64, 40, 41, 62, 63, 69, 40, 42, 43, 33, 39, 61, 34, 45, 
56, 44, 40, 49, 42, 50, 51, 43, 53, 62, 44, 38, 43, 49, 61, 36, 
49, 43, 46, 36, 38, 39, 48, 35, 60, 50, 51, 53, 33, 35, 56, 37, 
44, 43, 34, 34, 54, 49, 53, 54, 33, 33, 35, 42, 42, 65, 60, 36, 
51, 40, 44, 41, 54, 37, 37, 41, 46, 61, 57, 54, 53, 56, 37, 40, 
41, 39, 33, 38, 39, 49, 36, 33, 42, 33, 37, 52, 60, 32, 56, 48, 
35, 45, 38, 43, 33, 35, 58, 35, 37, 35, 60, 52, 44, 57, 35, 34, 
55, 36, 47, 38, 51, 34, 43, 32, 51, 51, 43, 37, 45, 59, 54, 37, 
60, 50, 62, 43, 37, 50, 45, 39, 52, 55, 47, 37, 38, 51, 49, 49, 
28, 41, 51, 52, 54, 49, 33, 57, 37, 39, 40, 52, 38, 50, 50, 54, 
46, 32, 37, 42, 44, 43, 52, 59, 48, 37, 42, 57, 33, 65, 51, 55, 
33, 59, 34, 50, 38, 49, 47, 37, 44, 34, 59, 67, 36, 42, 58, 37, 
47), match_demo_sn = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), resultado_hpv = c("NEG", 
"NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", 
"NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", 
"NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", 
"NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", 
"NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", 
"NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", 
"NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", 
"NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", 
"NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", 
"NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", 
"NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", 
"NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", 
"NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", 
"NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", 
"NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", 
"NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", 
"NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", 
"NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", 
"NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", 
"NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", 
"NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", 
"NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", "NEG", 
"NEG"), regresa_sn = c("Regresa", "No Regresa", "No Regresa", 
"Regresa", "Regresa", "Regresa", "No Regresa", "Regresa", "Regresa", 
"Regresa", "Regresa", "Regresa", "No Regresa", "Regresa", "Regresa", 
"Regresa", "Regresa", "Regresa", "Regresa", "Regresa", "No Regresa", 
"Regresa", "Regresa", "Regresa", "Regresa", "No Regresa", "No Regresa", 
"Regresa", "Regresa", "No Regresa", "Regresa", "No Regresa", 
"No Regresa", "No Regresa", "Regresa", "Regresa", "Regresa", 
"Regresa", "Regresa", "Regresa", "Regresa", "No Regresa", "Regresa", 
"Regresa", "Regresa", "Regresa", "No Regresa", "Regresa", NA, 
"Regresa", "Regresa", "Regresa", NA, "No Regresa", "Regresa", 
"Regresa", "Regresa", "Regresa", "No Regresa", "Regresa", "No Regresa", 
"Regresa", "No Regresa", "No Regresa", "Regresa", "No Regresa", 
"No Regresa", "No Regresa", "Regresa", "No Regresa", "Regresa", 
"Regresa", "Regresa", "Regresa", "No Regresa", "Regresa", "Regresa", 
"No Regresa", "No Regresa", "Regresa", "No Regresa", "No Regresa", 
"No Regresa", "Regresa", "Regresa", "Regresa", "Regresa", "Regresa", 
"No Regresa", "Regresa", "Regresa", "No Regresa", "Regresa", 
"Regresa", "No Regresa", "Regresa", "No Regresa", "Regresa", 
"Regresa", "Regresa", NA, "Regresa", "Regresa", "No Regresa", 
"Regresa", "Regresa", "Regresa", "No Regresa", "Regresa", "No Regresa", 
"No Regresa", "Regresa", "Regresa", "No Regresa", "Regresa", 
"Regresa", "Regresa", "No Regresa", "Regresa", "No Regresa", 
"Regresa", "Regresa", "No Regresa", "Regresa", "No Regresa", 
"Regresa", "Regresa", "No Regresa", "Regresa", "Regresa", "Regresa", 
"Regresa", "No Regresa", "No Regresa", "Regresa", "Regresa", 
"Regresa", "No Regresa", "No Regresa", "Regresa", "Regresa", 
"Regresa", "No Regresa", "No Regresa", "Regresa", "Regresa", 
"Regresa", "Regresa", "Regresa", "Regresa", "Regresa", NA, "Regresa", 
"Regresa", "Regresa", "Regresa", "Regresa", "Regresa", "No Regresa", 
"Regresa", "Regresa", "Regresa", "Regresa", "Regresa", "Regresa", 
"No Regresa", "No Regresa", "No Regresa", "Regresa", "Regresa", 
"No Regresa", "No Regresa", "No Regresa", "Regresa", "Regresa", 
"Regresa", "No Regresa", "Regresa", "Regresa", "Regresa", "No Regresa", 
"No Regresa", "Regresa", "Regresa", "Regresa", "No Regresa", 
"No Regresa", "No Regresa", "Regresa", "Regresa", "Regresa", 
"Regresa", "Regresa", "No Regresa", "No Regresa", "No Regresa", 
"No Regresa", "No Regresa", "Regresa", "Regresa")), row.names = c(NA, 
-200L), class = c("tbl_df", "tbl", "data.frame"))
structure(list(id_mujer = c(43360, 255074, 249484, 249470, 29248, 
89203), excluir = c(NA_character_, NA_character_, NA_character_, 
NA_character_, NA_character_, NA_character_), edad = c(43, 67, 
66, 46, 39, 43), match_demo_sn = c(1, 1, 1, 1, 1, 1), resultado_hpv = c("NEG", 
"NEG", "NEG", "NEG", "NEG", "NEG"), regresa_sn = c("Regresa", 
"No Regresa", "No Regresa", "Regresa", "Regresa", "Regresa")), row.names = c(NA, 
-6L), class = c("tbl_df", "tbl", "data.frame"))

Thaks, I got te data with no problem.

I have been playing around with consrast_plot() and I really do not understand what it is doing. I certainly do not see why your code is not working.

I'll keep working on it but let's hope someone with more knowledge comes along.