Skip to content

Commit

Permalink
Updates to Description
Browse files Browse the repository at this point in the history
  • Loading branch information
yashdubey132 committed Dec 10, 2024
1 parent 776e6f3 commit 925546c
Show file tree
Hide file tree
Showing 47 changed files with 22,808 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@
^data-raw$
^LICENSE\.md$
^README\.Rmd$
^_pkgdown\.yml$
^docs$
^pkgdown$
180 changes: 180 additions & 0 deletions .Rhistory
Original file line number Diff line number Diff line change
Expand Up @@ -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()
10 changes: 5 additions & 5 deletions .Rproj.user/17F39D71/rmd-outputs
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
1 change: 1 addition & 0 deletions .Rproj.user/17F39D71/sources/prop/INDEX
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
~%2FDesktop%2Fplanetaryhdi%2FR%2Fplanetaryhdi.R="0B3AF60A"
~%2FDesktop%2Fplanetaryhdi%2FREADME.Rmd="868D0988"
~%2FDesktop%2Fplanetaryhdi%2FREADME.md="C4CE2914"
~%2FDesktop%2Fplanetaryhdi%2F_pkgdown.yml="720BAE5D"
~%2FDesktop%2Fplanetaryhdi%2Fdata-raw%2Fdata_processing.R="C7E723CA"
6 changes: 3 additions & 3 deletions DESCRIPTION
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
Expand All @@ -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
Expand Down
28 changes: 28 additions & 0 deletions _pkgdown.yml
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!"
75 changes: 75 additions & 0 deletions docs/404.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 925546c

Please sign in to comment.