Skip to content

Instantly share code, notes, and snippets.

@adisarid
Last active April 27, 2020 18:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adisarid/376494b206594e3d6661abe2de08405f to your computer and use it in GitHub Desktop.
Save adisarid/376494b206594e3d6661abe2de08405f to your computer and use it in GitHub Desktop.
סטטיסטיקה על חללים ונפגעי פעולות איבה 1947-2019
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
חללים פעולות_איבה שנה
197 3 1947
4416 118 1948
295 4 1949
131 6 1950
185 10 1951
145 4 1952
149 15 1953
144 6 1954
141 1 1955
422 12 1956
107 4 1957
86 5 1958
83 3 1959
84 1 1960
85 2 1961
101 2 1962
92 2 1963
106 0 1964
95 4 1965
109 1 1966
1078 19 1967
395 45 1968
453 22 1969
442 59 1970
214 12 1971
193 41 1972
2609 23 1973
382 64 1974
276 33 1975
222 10 1976
317 9 1977
287 55 1978
228 25 1979
223 10 1980
201 12 1981
645 6 1982
279 19 1983
243 8 1984
228 30 1985
175 11 1986
213 14 1987
249 15 1988
208 36 1989
211 33 1990
195 103 1991
220 29 1992
232 45 1993
238 65 1994
242 30 1995
239 58 1996
292 41 1997
199 15 1998
158 9 1999
206 28 2000
211 182 2001
335 307 2002
243 156 2003
197 87 2004
174 48 2005
281 73 2006
113 16 2007
135 32 2008
135 9 2009
165 13 2010
122 23 2011
100 19 2012
105 6 2013
159 33 2014
82 27 2015
80 18 2016
55 12 2017
43 13 2018
27 1 2019
@adisarid
Copy link
Author

The code to produce the chart:

library(tidyverse)
nifgaim <- read_delim("https://gist.githubusercontent.com/adisarid/376494b206594e3d6661abe2de08405f/raw/7304a1eef5dd873158c806b463b299520d7964e9/nifgaim_year.csv",
                      delim = " ") %>% 
  set_names(c("fallen", "terror", "year")) %>% 
  mutate(decade = paste0(floor(year/10)*10, "s"))

img <- tibble(x = 8, y = 5250,
              image = "c:/temp/candle.png")

nifgaim_chart <- nifgaim %>% 
  select(-year) %>% 
  group_by(decade) %>% 
  summarize(across(everything(), sum, na.rm = T)) %>% 
  mutate(nifgaim = fallen+terror) %>% 
  ggplot(aes(x = decade,
             y = nifgaim)) + 
  geom_col(fill = rgb(0/255, 56/255, 184/255)) + 
  saridr::theme_sarid() + 
  ylab("מספר החללים/נפגעי פעולות איבה") + 
  xlab("עשור") + 
  ggtitle('חללי צה"ל ונפגעי פעולות איבה בעשורים, מאז שנת 1947') + 
  labs(caption = "\u202bמקור הנתונים: פרסום מרכז המחקר והמידע של הכנסת, וכתבות עדכניות. ראה בקישור: https://bit.ly/nifgaim\n\u202bהתרשים הוכן על ידי מכון שריד https://www.sarid-ins.co.il") + 
  theme(plot.title = element_text(hjust = 1),
        plot.caption = element_text(hjust = 0)) + 
  ggimage::geom_image(data = img, inherit.aes = F,
                      aes(x, y, image = image), size = 0.15)

ggsave("c:/temp/nifgaim_chart.png", nifgaim_chart)


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment