Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
margauxgo committed May 28, 2024
1 parent 1ae6022 commit b848f60
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 15 deletions.
15 changes: 11 additions & 4 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,17 @@ readr::read_csv("data-raw/dictionary.csv") |>
kableExtra::scroll_box(height = "400px")
```

## Example
## Examples

```{r eval=FALSE, message=FALSE, warning=FALSE, include=FALSE, paged.print=FALSE}
### 1. Housing conditions across municipalities

The location map displayed above was created as follows:

```{r eval=FALSE, message=FALSE, warning=FALSE, include=TRUE, paged.print=FALSE}
library(wsabrazil)
library(ggplot2)
library(sf)
library(dplyr)
# library(cowplot)
shapefile <- st_read("man/gadm41_BRA_2.json")
merged_data <- merge(shapefile, wsabrazil, by.x = "CC_2", by.y = "municipality_code")
Expand All @@ -110,7 +113,10 @@ ggplot() +
legend.text = element_text(color = "#333333", size = 16))
```

From the dataset, we can explore the distribution of water sources in the whole country. We create here a horizontal bar plot to visualize the frequency of different water sources available, utilizing variables such as piped water or stored rainwater. We observe from the resulting plot (see Figure below) that the majority of private households are supplied by piped water. Interestingly, almost none of the households store rainwater. This is possibly due to factors such as local climate patterns and infrastructure limitations.
### 2. Water supply in Brazil

From the dataset, we can also explore the distribution of water sources in the whole country. We create here a horizontal bar plot to visualize the frequency of different water sources available, utilizing variables such as piped water or stored rainwater. We observe from the resulting plot (see Figure below) that the majority of private households are supplied by piped water. Interestingly, almost none of the households store rainwater. This is possibly due to factors such as local climate patterns and infrastructure limitations.

```{r, eval=FALSE}
library(dplyr)
library(ggplot2)
Expand All @@ -136,6 +142,7 @@ plot <- ggplot(data_long_summary, aes(x = total_frequency, y = reorder(water_sou
plot + scale_x_continuous(labels = scales::number_format())
```

![](man/figures/Rplot01.png)

## License
Expand Down
48 changes: 37 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -457,15 +457,41 @@ wastewater discharged into other outlet

</div>

## Example

From the dataset, we can explore the distribution of water sources in
the whole country. We create here a horizontal bar plot to visualize the
frequency of different water sources available, utilizing variables such
as piped water or stored rainwater. We observe from the resulting plot
(see Figure below) that the majority of private households are supplied
by piped water. Interestingly, almost none of the households store
rainwater. This is possibly due to factors such as local climate
## Examples

### 1. Housing conditions across municipalities

The location map displayed above was created as follows:

``` r
library(wsabrazil)
library(ggplot2)
library(sf)
library(dplyr)

shapefile <- st_read("man/gadm41_BRA_2.json")
merged_data <- merge(shapefile, wsabrazil, by.x = "CC_2", by.y = "municipality_code")

# Plot the choropleth map
ggplot() +
geom_sf(data = merged_data, aes(fill = as.factor(sector_type))) +
scale_fill_manual(name = "sector_type", values = c("0" = "#E69F00", "1" = "#0072B2"),
labels = c("0" = "poor", "1" = "correct")) +
labs(title = "Housing conditions across municipalities") +
theme(plot.title = element_text(hjust = 0.5, face = "bold", color = "#333333", size = 24),
legend.title = element_text(face = "bold", color = "#333333", size = 16),
legend.text = element_text(color = "#333333", size = 16))
```

### 2. Water supply in Brazil

From the dataset, we can also explore the distribution of water sources
in the whole country. We create here a horizontal bar plot to visualize
the frequency of different water sources available, utilizing variables
such as piped water or stored rainwater. We observe from the resulting
plot (see Figure below) that the majority of private households are
supplied by piped water. Interestingly, almost none of the households
store rainwater. This is possibly due to factors such as local climate
patterns and infrastructure limitations.

``` r
Expand Down Expand Up @@ -509,12 +535,12 @@ citation("wsabrazil")
#> To cite package 'wsabrazil' in publications use:
#>
#> Götschmann M, Santos L (2024). "wsabrazil: Wastewater management and
#> household infrastructure in Brazil - Demographic Census 2010."
#> household infrastructure in Brazil."
#>
#> A BibTeX entry for LaTeX users is
#>
#> @Misc{gotschmann_etall:2024,
#> title = {wsabrazil: Wastewater management and household infrastructure in Brazil - Demographic Census 2010},
#> title = {wsabrazil: Wastewater management and household infrastructure in Brazil},
#> author = {Margaux Götschmann and Lais Santos},
#> year = {2024},
#> abstract = {This dataset about wastewater management and household infrastructure from various Brazilian regions provides insights into wastewater disposal habits, water sources, bathroom facilities, and sanitation infrastructure.},
Expand Down

0 comments on commit b848f60

Please sign in to comment.