Skip to content

Commit

Permalink
Fixed issue #3 cumulative count charts
Browse files Browse the repository at this point in the history
  • Loading branch information
neilfws committed Oct 20, 2020
1 parent 8d649dd commit 227a89c
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 30 deletions.
22 changes: 14 additions & 8 deletions retractions/code/R/pmretract.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ dat <- doc.retd %>%
as_tibble() %>%
mutate(year = as.numeric(value)) %>%
count(year) %>%
right_join(tibble(year = min(.$year):max(.$year)))
right_join(tibble(year = min(.$year):max(.$year))) %>%
arrange(year)

# plot chart
highchart() %>%
Expand All @@ -78,7 +79,8 @@ dat <- doc.retOf %>%
as_tibble() %>%
mutate(year = as.numeric(value)) %>%
count(year) %>%
right_join(tibble(year = min(.$year):max(.$year)))
right_join(tibble(year = min(.$year):max(.$year))) %>%
arrange(year)

# plot chart
highchart() %>%
Expand Down Expand Up @@ -111,9 +113,10 @@ dat <- doc.retd %>%
as_tibble() %>%
mutate(year = as.numeric(value)) %>%
count(year) %>%
right_join(tibble(year = min(.$year):max(.$year))) %>%
right_join(tibble(year = min(.$year):max(.$year))) %>%
arrange(year) %>%
replace_na(list(n = 0)) %>%
mutate(cs = cumsum(n))
mutate(cs = cumsum(n))

# plot chart
highchart() %>%
Expand All @@ -140,9 +143,10 @@ dat <- doc.retOf %>%
as_tibble() %>%
mutate(year = as.numeric(value)) %>%
count(year) %>%
right_join(tibble(year = min(.$year):max(.$year))) %>%
right_join(tibble(year = min(.$year):max(.$year))) %>%
arrange(year) %>%
replace_na(list(n = 0)) %>%
mutate(cs = cumsum(n))
mutate(cs = cumsum(n))

# plot chart
highchart() %>%
Expand Down Expand Up @@ -177,7 +181,8 @@ dat <- doc.retd %>%
count(year) %>%
right_join(tibble(year = min(.$year):max(.$year))) %>%
right_join(years.total) %>%
mutate(rate = round((100000/total) * n, 3))
mutate(rate = round((100000/total) * n, 3)) %>%
arrange(year)

# plot chart
highchart() %>%
Expand Down Expand Up @@ -206,7 +211,8 @@ dat <- doc.retOf %>%
count(year) %>%
right_join(tibble(year = min(.$year):max(.$year))) %>%
right_join(years.total) %>%
mutate(rate = round((100000/total) * n, 3))
mutate(rate = round((100000/total) * n, 3)) %>%
arrange(year)

# plot chart
highchart() %>%
Expand Down
Loading

0 comments on commit 227a89c

Please sign in to comment.