0
library(streamgraph)

df:

    str
# A tibble: 20 x 3
# Groups:   gname [7]
   gname                                            iyear total
   <chr>                                            <int> <int>
 1 Islamic State of Iraq and the Levant (ISIL)       2016  1454
 2 Islamic State of Iraq and the Levant (ISIL)       2017  1315
 3 Islamic State of Iraq and the Levant (ISIL)       2014  1249
 4 Taliban                                           2015  1249
 5 Islamic State of Iraq and the Levant (ISIL)       2015  1221
 6 Taliban                                           2016  1065
 7 Taliban                                           2014  1035
 8 Taliban                                           2017   894
 9 Al-Shabaab                                        2014   871
10 Taliban                                           2012   800
11 Taliban                                           2013   775
12 Al-Shabaab                                        2017   570
13 Al-Shabaab                                        2016   564
14 Boko Haram                                        2015   540
15 Shining Path (SL)                                 1989   509
16 Communist Party of India - Maoist (CPI-Maoist)    2010   505
17 Shining Path (SL)                                 1984   502
18 Boko Haram                                        2014   495
19 Shining Path (SL)                                 1983   493
20 Farabundo Marti National Liberation Front (FMLN)  1991   492

Code for the streamgraph function:

streamgraph(data = str,key = "gname",date = "iyear", value = "total") %>%
  sg_annotate(label="ISIL", x=as.Date("2016-01-01"), y=1454, size=14)

Unfortunately it doesn't show any output. Do you know how to solve this problem?

  • Please add a easily **minimal reproducible** example. [See here](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example/5963610#5963610) for an excellent guide on how to create good MRE. The example you posted is **not** eaysily usable. – dario Feb 08 '20 at 10:44
  • 1
    I wonder if you should use `data = df` in `streamgraph()` instead of `data = str`. I can actually see an output on my side. – jazzurro Feb 08 '20 at 11:32
  • No, actually. Even changing the name of the dataframe I still se no output. – Antonio Mastroianni Feb 08 '20 at 11:44
  • I am not sure what's happening on your side, given I can produce a graphic. If you want, I am happy to temporarily drop what I got. – jazzurro Feb 08 '20 at 12:23
  • Yes please that would be great. – Antonio Mastroianni Feb 08 '20 at 13:55
  • Have a look and see if you can find any differences between yours and mine. If everything is identical and you cannot produce the graphic, something is wrong somewhere. – jazzurro Feb 08 '20 at 14:27

1 Answers1

1

This is a temporary answer for you given you said you want to see that I am actually producing the graphic. Compare this with your own code. I am happy to remove this answer once you finish the comparison.

df <- data.frame(gname = c("Islamic State of Iraq and the Levant (ISIL)",
                           "Islamic State of Iraq and the Levant (ISIL)",
                           "Islamic State of Iraq and the Levant (ISIL)",
                           "Taliban",
                           "Islamic State of Iraq and the Levant (ISIL)",
                           "Taliban",
                           "Taliban",
                           "Taliban",
                           "Al-Shabaab",
                           "Taliban",
                           "Taliban",
                           "Al-Shabaab",
                           "Al-Shabaab",
                           "Boko Haram",
                           "Shining Path (SL)",
                           "Communist Party of India - Maoist (CPI-Maoist)",
                           "Shining Path (SL)",
                           "Boko Haram",
                           "Shining Path (SL)",
                           "Farabundo Marti National Liberation Front (FMLN)"),
                 iyear = c(2016, 2017, 2014, 2015, 2015, 2016, 2014,
                           2017, 2014, 2012, 2013, 2017, 2016, 2015, 1989, 2010,
                           1984, 2014, 1983, 1991),
                 total = c(1454, 1315, 1249, 1249, 1221, 1065,
                           1035, 894, 871, 800, 775, 570,
                           564, 540, 509, 505, 502, 495,
                           493, 492),
                 stringsAsFactors = F)


streamgraph(data = df ,key = "gname", date = "iyear", value = "total") %>%
sg_annotate(label = "ISIL", x = as.Date("2016-01-01"), y = 1454, size = 14)

enter image description here

jazzurro
  • 23,179
  • 35
  • 66
  • 76
  • I ctrl+c ctr+v but still no output is coming out. Do you know of anything that could cause a conflict in the output? – Antonio Mastroianni Feb 08 '20 at 14:45
  • @AntonioMastroianni I have no clue, unfortunately. You may want to clean up your session once and restart R, at least. If you keep having the same issue, you may want to check the github page of the package. You may be able to find relevant information. – jazzurro Feb 08 '20 at 14:52
  • 1
    @AntonioMastroianni The package author (hrbrmstr) has been around on SO for a long time. He is a very cool and knowledgeable person. I highly recommend you to talk with him if you have not solve this issue. – jazzurro Feb 09 '20 at 03:34