-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
776e6f3
commit 925546c
Showing
47 changed files
with
22,808 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,6 @@ | |
^data-raw$ | ||
^LICENSE\.md$ | ||
^README\.Rmd$ | ||
^_pkgdown\.yml$ | ||
^docs$ | ||
^pkgdown$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -121,3 +121,183 @@ here::here("inst", "extdata", paste0("planetaryhdi", ".csv"))) | |
openxlsx::write.xlsx(planetaryhdi, | ||
here::here("inst", "extdata", paste0("planetaryhdi", ".xlsx"))) | ||
setup_dictionary() | ||
library(washr) | ||
setup_roxygen() | ||
usethis::use_author(given="Yash", family = "Dubey", role=c("aut", "cre"), email = "[email protected]", comment=c(orcid="0009-0001-2849-970X")) | ||
update_description() | ||
devtools::document() | ||
devtools::check() | ||
devtools::check() | ||
devtools::check() | ||
devtools::install() | ||
setup_readme() | ||
devtools::build_readme() | ||
readr::read_csv("data-raw/dictionary.csv", locale = locale(encoding = "UTF-8")) |> | ||
mutate(across(everything(), ~ iconv(., from = "UTF-8", to = "UTF-8", sub = ""))) |> # Replace invalid UTF-8 characters with "" | ||
dplyr::filter(file_name == "planetaryhdi.rda") |> | ||
dplyr::select(variable_name:description) |> | ||
knitr::kable() |> | ||
kableExtra::kable_styling("striped") |> | ||
kableExtra::scroll_box(height = "200px") | ||
library(tidyverse) | ||
readr::read_csv("data-raw/dictionary.csv", locale = locale(encoding = "UTF-8")) |> | ||
mutate(across(everything(), ~ iconv(., from = "UTF-8", to = "UTF-8", sub = ""))) |> # Replace invalid UTF-8 characters with "" | ||
dplyr::filter(file_name == "planetaryhdi.rda") |> | ||
dplyr::select(variable_name:description) |> | ||
knitr::kable() |> | ||
kableExtra::kable_styling("striped") |> | ||
kableExtra::scroll_box(height = "200px") | ||
devtools::build_readme() | ||
library(rnaturalearthdata) | ||
library(rnaturalearth) | ||
# 2022 HDI worldwide | ||
world <- ne_countries(scale = "medium", returnclass = "sf") | ||
View(world) | ||
devtools::build_readme() | ||
devtools::build_readme() | ||
# Set all columns except country to numeric | ||
planetaryhdi <- planetaryhdi |> | ||
mutate(across(-country, as.numeric)) | ||
# Export Data ------------------------------------------------------------------ | ||
usethis::use_data(planetaryhdi, overwrite = TRUE) | ||
fs::dir_create(here::here("inst", "extdata")) | ||
readr::write_csv(planetaryhdi, | ||
here::here("inst", "extdata", paste0("planetaryhdi", ".csv"))) | ||
openxlsx::write.xlsx(planetaryhdi, | ||
here::here("inst", "extdata", paste0("planetaryhdi", ".xlsx"))) | ||
devtools::build_readme() | ||
# Description ------------------------------------------------------------------ | ||
# R script to process uploaded raw data into a tidy, analysis-ready data frame | ||
# Load packages ---------------------------------------------------------------- | ||
## Run the following code in console if you don't have the packages | ||
## install.packages(c("usethis", "fs", "here", "readr", "readxl", "openxlsx")) | ||
#library(usethis) | ||
library(fs) | ||
library(here) | ||
library(readr) | ||
library(readxl) | ||
library(openxlsx) | ||
library(tidyverse) | ||
# Read data -------------------------------------------------------------------- | ||
# Read the data and skip the initial empty rows and dataset description row | ||
planetaryhdi <- read_excel("data-raw/HDR23-24_Statistical_Annex_PHDI_Table.xlsx", skip = 7) | ||
# Tidy data -------------------------------------------------------------------- | ||
# Drop all columns that start with "..", these are empty columns for readability | ||
planetaryhdi <- planetaryhdi[, !grepl("^\\.\\.", names(planetaryhdi))] | ||
planetaryhdi <- planetaryhdi |> | ||
filter(rowSums(!is.na(select(planetaryhdi, -Country))) > 0) | ||
# Rename columns: | ||
new_col_names <- c("hdi_rank", | ||
"country", | ||
"hdi", | ||
"phdi", | ||
"pct_diff_hdi", | ||
"rank_diff_hdi", | ||
"adj_factor", | ||
"tco2_per_capita_prod", | ||
"co2_emissions_index", | ||
"material_footprint_per_capita", | ||
"material_footprint_index") | ||
names(planetaryhdi) <- new_col_names | ||
# Drop the first row | ||
planetaryhdi <- planetaryhdi[-1, ] | ||
# Set all columns except country to numeric | ||
planetaryhdi <- planetaryhdi |> | ||
mutate(across(-country, as.numeric)) | ||
# Add iso3c names for country | ||
planetaryhdi <- planetaryhdi |> | ||
mutate(iso3c = countrycode::countrycode(country, origin = "country.name", destination = "iso3c")) | ||
planetaryhdi <- planetaryhdi |> | ||
mutate(across( | ||
.cols = -c(country, iso3c, tier_hdi), | ||
.fns = as.numeric | ||
)) | ||
# Add iso3c names for country | ||
planetaryhdi <- planetaryhdi |> | ||
mutate(iso3c = countrycode::countrycode(country, origin = "country.name", destination = "iso3c")) | ||
View(planetaryhdi) | ||
devtools::build_readme() | ||
View(planetaryhdi) | ||
devtools::build_readme() | ||
devtools::check() | ||
devtools::build() | ||
devtools::install() | ||
devtools::build_readme() | ||
devtools::build_readme() | ||
devtools::build_readme() | ||
# Description ------------------------------------------------------------------ | ||
# R script to process uploaded raw data into a tidy, analysis-ready data frame | ||
# Load packages ---------------------------------------------------------------- | ||
## Run the following code in console if you don't have the packages | ||
## install.packages(c("usethis", "fs", "here", "readr", "readxl", "openxlsx")) | ||
#library(usethis) | ||
library(fs) | ||
library(here) | ||
library(readr) | ||
library(readxl) | ||
library(openxlsx) | ||
library(tidyverse) | ||
# Read data -------------------------------------------------------------------- | ||
# Read the data and skip the initial empty rows and dataset description row | ||
planetaryhdi <- read_excel("data-raw/HDR23-24_Statistical_Annex_PHDI_Table.xlsx", skip = 7) | ||
# Tidy data -------------------------------------------------------------------- | ||
# Drop all columns that start with "..", these are empty columns for readability | ||
planetaryhdi <- planetaryhdi[, !grepl("^\\.\\.", names(planetaryhdi))] | ||
planetaryhdi <- planetaryhdi |> | ||
filter(rowSums(!is.na(select(planetaryhdi, -Country))) > 0) | ||
# Rename columns: | ||
new_col_names <- c("hdi_rank", | ||
"country", | ||
"hdi", | ||
"phdi", | ||
"pct_diff_hdi", | ||
"rank_diff_hdi", | ||
"adj_factor", | ||
"tco2_per_capita_prod", | ||
"co2_emissions_index", | ||
"material_footprint_per_capita", | ||
"material_footprint_index") | ||
names(planetaryhdi) <- new_col_names | ||
# Drop the first row | ||
planetaryhdi <- planetaryhdi[-1, ] | ||
# Set all columns except country to numeric | ||
planetaryhdi <- planetaryhdi |> | ||
mutate(across(-country, as.numeric)) | ||
# Add iso3c names for country | ||
planetaryhdi <- planetaryhdi |> | ||
mutate(iso3c = countrycode::countrycode(country, origin = "country.name", destination = "iso3c")) | ||
# Export Data ------------------------------------------------------------------ | ||
usethis::use_data(planetaryhdi, overwrite = TRUE) | ||
fs::dir_create(here::here("inst", "extdata")) | ||
readr::write_csv(planetaryhdi, | ||
here::here("inst", "extdata", paste0("planetaryhdi", ".csv"))) | ||
openxlsx::write.xlsx(planetaryhdi, | ||
here::here("inst", "extdata", paste0("planetaryhdi", ".xlsx"))) | ||
devtools::build_readme() | ||
devtools::build_readme() | ||
devtools::build_readme() | ||
devtools::build_readme() | ||
devtools::build_readme() | ||
devtools::build_readme() | ||
devtools::build_readme()\ | ||
devtools::build_readme()\ | ||
devtools::build_readme() | ||
setup_website() | ||
update_description() | ||
devtools::document() | ||
devtools::check() | ||
update_description() | ||
update_description() | ||
devtools::document() | ||
devtools::check() | ||
devtools::install() | ||
setup_website() | ||
update_description() | ||
devtools::document() | ||
devtools::check() | ||
devtools::install() | ||
remove.packages("planetaryhdi") | ||
devtools::install() | ||
devtools::check() | ||
unlink("/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/planetaryhdi", recursive = TRUE) | ||
devtools::check() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
|
||
|
||
|
||
|
||
|
||
/private/var/folders/q2/thf5k95955q8kn6twjrwljbr00jms0/T/RtmplXx9He/preview-2a9f76de4832.dir/README.html | ||
/private/var/folders/q2/thf5k95955q8kn6twjrwljbr00jms0/T/RtmplXx9He/preview-2a9f14f0c8bd.dir/README.html | ||
/private/var/folders/q2/thf5k95955q8kn6twjrwljbr00jms0/T/RtmplXx9He/preview-2a9f1f69a940.dir/README.html | ||
/private/var/folders/q2/thf5k95955q8kn6twjrwljbr00jms0/T/RtmplXx9He/preview-2a9f171ba51c.dir/README.html | ||
/private/var/folders/q2/thf5k95955q8kn6twjrwljbr00jms0/T/RtmplXx9He/preview-2a9f38215992.dir/README.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
Package: planetaryhdi | ||
Type: Package | ||
Title: Provides Data On Planetary Pressures Adjusted HDI | ||
Title: Planetary Pressures Adjusted Human Development Index Data | ||
Version: 0.1.0 | ||
Author: Yash Dubey | ||
Maintainer: Yash Dubey ([email protected]) | ||
Maintainer: Yash Dubey <[email protected]> | ||
Description: Provides data on Planetary Pressures Adjusted Human Development, adjusted by carbon emissions per capita (production related) and materials footprint per capita. | ||
License: CC BY 4.0 | ||
Encoding: UTF-8 | ||
|
@@ -14,7 +14,7 @@ Authors@R: | |
person("Yash", "Dubey", , "[email protected]", role = c("aut", "cre"), | ||
comment = c(orcid = "0009-0001-2849-970X")) | ||
Language: en-GB | ||
Config/Needs/website: rmarkdown | ||
Config/Needs/website: rmarkdownset | ||
Date: 2024-12-10 | ||
URL: https://github.com/openwashdata/planetaryhdi | ||
BugReports: https://github.com/openwashdata/planetaryhdi/issues | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
url: https://github.com/openwashdata/planetaryhdi | ||
template: | ||
bootstrap: 5 | ||
includes: | ||
in_header: | | ||
<script defer data-domain="openwashdata.github.io" src="https://plausible.io/js/script.js"></script> | ||
home: | ||
links: | ||
- icon: github | ||
text: GitHub repository | ||
href: https://github.com/openwashdata/planetaryhdi | ||
sidebar: | ||
structure: [links, citation, authors, dev, custom] | ||
components: | ||
custom: | ||
title: Funding | ||
text: This project was funded by the [Open Research Data Program of the ETH Board](https://ethrat.ch/en/eth-domain/open-research-data/). | ||
|
||
authors: | ||
footer: | ||
roles: [cre, fnd] | ||
text: "Crafted by" | ||
sidebar: | ||
roles: [cre, aut, ctb] | ||
before: "So *who* does the work?" | ||
after: "Thanks all!" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.