Skip to content

Commit

Permalink
Small correction to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
pitkant committed Jan 31, 2022
1 parent 4551a0c commit 9e32fc3
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ Suggests:
magrittr,
kableExtra,
rmarkdown,
covr
covr,
ggrepel
VignetteBuilder: knitr
NeedsCompilation: no
Repository: CRAN
Expand Down
29 changes: 24 additions & 5 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,11 @@ sotkanet.indicators <- SotkanetIndicators()
head(sotkanet.indicators$indicator.title.fi)
```

Here is a simple example of data retrieval and visualization, using indicator describing private dental care use among 0-17 years old in 2015-2020.
Here is an example of data retrieval and visualization, using indicator describing private dental care use among 0-17 years old in 2015-2020.

```{r sotkanet_example, eval=TRUE}
library(ggplot2)
library(ggrepel)
hammashoito <- GetDataSotkanet(indicators = 1075, years = 2015:2020, genders = "total", region.category = "MAAKUNTA")
Expand All @@ -75,23 +76,41 @@ hammashoito_metadata <- SotkanetIndicatorMetadata(id = 1075)
plot_caption <- paste0("Lähde: Sotkanet \n",
"Data päivitetty ", hammashoito_metadata$`data-updated`)
plot <- ggplot(hammashoito,aes(x=year,y=primary.value,group=region.title.fi))+
plot <- ggplot(hammashoito, aes(x=year, y=primary.value, group=region.title.fi))+
geom_line(aes(color=region.title.fi)) +
geom_point(aes(color=region.title.fi))
plot + labs(title = "Yksityisen hammashuollon käynnit",
plot + labs(title = "Yksityisen hammashuollon käynnit 2015-2020",
subtitle = "0 - 17-vuotiailla / 1 000 vastaavanikäistä",
x = "Vuosi",
y = "Käyntien lkm",
caption = plot_caption,
color = "Maakunta")
color = "Maakunta") +
geom_text_repel(
aes(color = region.title.fi, label = ifelse(year == 2020, region.title.fi, NA_character_)),
xlim = c(2021, 2023),
direction = "both",
hjust = 0,
segment.size = .7,
segment.alpha = .5,
segment.linetype = "dotted",
box.padding = .4,
segment.curvature = -0.1,
segment.ncp = 3,
segment.angle = 20) +
theme(legend.position = "none",
panel.background = element_rect(fill = "linen")) +
scale_x_continuous(
expand = c(0, 0),
limits = c(2015, 2022),
breaks = seq(2015, 2020))
```

For more in-depth examples, see the package vignette or online [tutorial page](http://ropengov.github.io/sotkanet/articles/tutorial.html).

### Contributing

* [Submit suggestions and bug reports](https://github.com/ropengov/sotkanet/issues) (provide the output of `sessionInfo()` and `packageVersion("sorvi")` and preferably provide a [reproducible example](http://adv-r.had.co.nz/Reproducibility.html))
* [Submit suggestions and bug reports](https://github.com/ropengov/sotkanet/issues) (provide the output of `sessionInfo()` and `packageVersion("sotkanet")` and preferably provide a [reproducible example](http://adv-r.had.co.nz/Reproducibility.html))
* [Send a pull request](https://github.com/ropengov/sotkanet/pulls)
* [Star us on the Github page](https://github.com/ropengov/sotkanet/)
* [See our website](http://ropengov.org/community/) for additional contact information
Expand Down
Binary file modified man/figures/README-sotkanet_example-1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9e32fc3

Please sign in to comment.