Skip to content

Commit

Permalink
removed tabulzer dependent functions
Browse files Browse the repository at this point in the history
  • Loading branch information
thiyangt committed Apr 22, 2023
1 parent 82eaa0a commit 98586c5
Show file tree
Hide file tree
Showing 13 changed files with 39 additions and 305 deletions.
Binary file modified .DS_Store
Binary file not shown.
11 changes: 1 addition & 10 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: denguedatahub
Title: A Tidy Format Datasets of Dengue by Country
Version: 1.0.1
Version: 1.0.2
Authors@R:
person("Thiyanga S.", "Talagala", , "ttalagala@sjp.ac.lk", role = c("aut", "cre"),
comment = c(ORCID = "0000-0002-0656-9789"))
Expand All @@ -12,19 +12,10 @@ Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.1
Imports:
magrittr,
rvest,
stringr,
xml2,
dplyr,
tabulizer,
purrr,
tibble,
tidyr,
rlang (>= 0.4.11)
Depends:
R (>= 3.5.0)
SystemRequirements: Java (>= 7.0)
LazyData: true
Suggests:
roxygen2
8 changes: 0 additions & 8 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,12 @@ export(":=")
export(.data)
export(as_label)
export(as_name)
export(convert_srilanka_wer_to_tidy)
export(enquo)
export(enquos)
export(filter_year_wer)
export(get_addresses)
export(min_max)
importFrom(dplyr,bind_rows)
importFrom(dplyr,filter)
importFrom(dplyr,select)
importFrom(magrittr,"%>%")
importFrom(rlang,":=")
importFrom(rlang,.data)
importFrom(rlang,as_label)
importFrom(rlang,as_name)
importFrom(rlang,enquo)
importFrom(rlang,enquos)
importFrom(tabulizer,extract_tables)
121 changes: 0 additions & 121 deletions R/convert_srilanka_wer_to_tidy.R

This file was deleted.

21 changes: 0 additions & 21 deletions R/filter_year_wer_link.R

This file was deleted.

19 changes: 0 additions & 19 deletions R/get_address.R

This file was deleted.

4 changes: 2 additions & 2 deletions R/min_max.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ min_max <- function(data, variable.to.minmax, local=FALSE, group.var){

cases = as.name(variable.to.minmax)

data.tbl <- data %>%
data.tbl <- data |>
dplyr::mutate(
min.cases = min(!!enquo(cases)),
max.cases = max(!!enquo(cases)),
Expand All @@ -23,7 +23,7 @@ min_max <- function(data, variable.to.minmax, local=FALSE, group.var){
group_var <- as.name(group.var)
cases = as.name(variable.to.minmax)

data.tbl <- data %>% dplyr::group_by(!!enquo(group_var)) %>%
data.tbl <- data |> dplyr::group_by(!!enquo(group_var)) |>
dplyr::mutate(
min.group = min(!!enquo(cases)),
max.group = max(!!enquo(cases)),
Expand Down
19 changes: 5 additions & 14 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,11 @@ head(level_of_risk)
## Sri Lanka Weekly Dengue Cases

```{r}
head(srilanka_weekly_data)
srilanka_weekly_data
```

## Obtain dengue data from weekly epidemiological reports published by [Epidemiology Unit, Ministry of Health, Sri Lanka](https://www.epid.gov.lk/web/index.php?option=com_content&view=article&id=148&Itemid=449&lang=en)

```{r, warning=FALSE, message=FALSE}
ad.list <- get_addresses("http://www.epid.gov.lk/web/index.php?option=com_content&view=article&id=148&Itemid=449&lang=en")
wer2023url <- filter_year_wer(2023, ad.list[1:9])
data2023 <- convert_srilanka_wer_to_tidy(year=2023, url.part2=wer2023url,
start.date.first = "2022-12-31",
end.date.first = "2023-01-06",
start.date.last = "2023-01-28",
end.date.last = "2023-02-03",
week.no=c(52, 1:4))
data2023
```
## World

```{r}
world_annual
```
65 changes: 31 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,42 +45,39 @@ head(level_of_risk)
## Sri Lanka Weekly Dengue Cases

``` r
head(srilanka_weekly_data)
#> # A tibble: 6 × 6
#> year week start.date end.date district cases
#> <dbl> <dbl> <date> <date> <chr> <dbl>
#> 1 2006 52 2006-12-23 2006-12-29 Colombo 71
#> 2 2006 52 2006-12-23 2006-12-29 Gampaha 12
#> 3 2006 52 2006-12-23 2006-12-29 Kalutara 12
#> 4 2006 52 2006-12-23 2006-12-29 Kandy 20
#> 5 2006 52 2006-12-23 2006-12-29 Matale 4
#> 6 2006 52 2006-12-23 2006-12-29 NuwaraEliya 1
srilanka_weekly_data
#> # A tibble: 21,960 × 6
#> year week start.date end.date district cases
#> <dbl> <dbl> <date> <date> <chr> <dbl>
#> 1 2006 52 2006-12-23 2006-12-29 Colombo 71
#> 2 2006 52 2006-12-23 2006-12-29 Gampaha 12
#> 3 2006 52 2006-12-23 2006-12-29 Kalutara 12
#> 4 2006 52 2006-12-23 2006-12-29 Kandy 20
#> 5 2006 52 2006-12-23 2006-12-29 Matale 4
#> 6 2006 52 2006-12-23 2006-12-29 NuwaraEliya 1
#> 7 2006 52 2006-12-23 2006-12-29 Galle 1
#> 8 2006 52 2006-12-23 2006-12-29 Hambanthota 1
#> 9 2006 52 2006-12-23 2006-12-29 Matara 11
#> 10 2006 52 2006-12-23 2006-12-29 Jaffna 0
#> # ℹ 21,950 more rows
```

## Obtain dengue data from weekly epidemiological reports published by [Epidemiology Unit, Ministry of Health, Sri Lanka](https://www.epid.gov.lk/web/index.php?option=com_content&view=article&id=148&Itemid=449&lang=en)
## World

``` r
ad.list <- get_addresses("http://www.epid.gov.lk/web/index.php?option=com_content&view=article&id=148&Itemid=449&lang=en")
wer2023url <- filter_year_wer(2023, ad.list[1:9])
data2023 <- convert_srilanka_wer_to_tidy(year=2023, url.part2=wer2023url,
start.date.first = "2022-12-31",
end.date.first = "2023-01-06",
start.date.last = "2023-01-28",
end.date.last = "2023-02-03",
week.no=c(52, 1:4))
data2023
#> # A tibble: 130 × 6
#> year week start.date end.date district cases
#> <dbl> <dbl> <date> <date> <chr> <dbl>
#> 1 2023 52 2022-12-31 2023-01-06 Colombo 25
#> 2 2023 52 2022-12-31 2023-01-06 Gampaha 23
#> 3 2023 52 2022-12-31 2023-01-06 Kalutara 74
#> 4 2023 52 2022-12-31 2023-01-06 Kandy 50
#> 5 2023 52 2022-12-31 2023-01-06 Matale 25
#> 6 2023 52 2022-12-31 2023-01-06 NuwaraEliya 3
#> 7 2023 52 2022-12-31 2023-01-06 Galle 28
#> 8 2023 52 2022-12-31 2023-01-06 Hambantota 13
#> 9 2023 52 2022-12-31 2023-01-06 Matara 22
#> 10 2023 52 2022-12-31 2023-01-06 Jaffna 12
#> # ℹ 120 more rows
world_annual
#> # A tibble: 6,750 × 4
#> entity code year incidence
#> <chr> <chr> <dbl> <dbl>
#> 1 Afghanistan AFG 1990 23371
#> 2 Afghanistan AFG 1991 25794
#> 3 Afghanistan AFG 1992 29766
#> 4 Afghanistan AFG 1993 32711
#> 5 Afghanistan AFG 1994 34268
#> 6 Afghanistan AFG 1995 35823
#> 7 Afghanistan AFG 1996 37397
#> 8 Afghanistan AFG 1997 38862
#> 9 Afghanistan AFG 1998 39660
#> 10 Afghanistan AFG 1999 39987
#> # ℹ 6,740 more rows
```
Binary file modified data-raw/.DS_Store
Binary file not shown.
37 changes: 0 additions & 37 deletions man/convert_srilanka_wer_to_tidy.Rd

This file was deleted.

19 changes: 0 additions & 19 deletions man/filter_year_wer.Rd

This file was deleted.

Loading

0 comments on commit 98586c5

Please sign in to comment.