-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.Rhistory
341 lines (341 loc) · 13.2 KB
/
.Rhistory
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
remove.packages("washr")
devtools::install_github("https://github.com/openwashdata/washr", ref="dev-metadata")
library(washr)
setup_rawdata()
# 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)
# Read data --------------------------------------------------------------------
planetaryhid <- read_excel("data-raw/HDR23-24_Statistical_Annex_PHDI_Table.xlsx")
View(planetaryhid)
# Read data --------------------------------------------------------------------
planetaryhdi <- read_excel("data-raw/HDR23-24_Statistical_Annex_PHDI_Table.xlsx")
View(planetaryhid)
# Read data --------------------------------------------------------------------
planetaryhdi <- read_excel("data-raw/HDR23-24_Statistical_Annex_PHDI_Table.xlsx")
View(planetaryhdi)
# Read data --------------------------------------------------------------------
planetaryhdi <- read_excel("data-raw/HDR23-24_Statistical_Annex_PHDI_Table.xlsx", skip = 5)
View(planetaryhdi)
# Read data --------------------------------------------------------------------
planetaryhdi <- read_excel("data-raw/HDR23-24_Statistical_Annex_PHDI_Table.xlsx", skip = 6)
View(planetaryhdi)
# Read data --------------------------------------------------------------------
planetaryhdi <- read_excel("data-raw/HDR23-24_Statistical_Annex_PHDI_Table.xlsx", skip = 6)
View(planetaryhdi)
# Read data --------------------------------------------------------------------
planetaryhdi <- read_excel("data-raw/HDR23-24_Statistical_Annex_PHDI_Table.xlsx", skip = 4)
View(planetaryhdi)
# Read data --------------------------------------------------------------------
planetaryhdi <- read_excel("data-raw/HDR23-24_Statistical_Annex_PHDI_Table.xlsx", skip = 7)
View(planetaryhdi)
# Drop all columns that start with ".."
planetaryhdi <- planetaryhdi[, !grepl("^\\.\\.", names(planetaryhdi))]
View(planetaryhdi)
# Drop all rows where everything except "country" is NA
planetaryhdi <- planetaryhdi[rowSums(is.na(planetaryhdi)) < ncol(planetaryhdi), ]
View(planetaryhdi)
# Drop all rows where all columns except Country are NA
planetaryhdi <- planetaryhdi[rowSums(is.na(planetaryhdi[, -1])) < ncol(planetaryhdi) - 1, ]
View(planetaryhdi)
library(tidyverse)
planetaryhdi <- planetaryhdi |>
filter(rowSums(!is.na(select(., -country))) > 0)
planetaryhdi <- planetaryhdi |>
filter(rowSums(!is.na(select(planetaryhdi, -country))) > 0)
planetaryhdi <- planetaryhdi |>
filter(rowSums(!is.na(select(planetaryhdi, -Country))) > 0)
View(planetaryhdi)
# 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
View(planetaryhdi)
# Drop the first row
planetaryhdi <- planetaryhdi[-1, ]
View(planetaryhdi)
View(planetaryhdi)
# 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)
# 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, ]
# 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")))
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()
devtools::check()
devtools::install()
washr::setup_website()
washr::setup_website()
?citation
washr::update_citation("10.5281/zenodo.14355748")
pkgdown::build_site()
washr::add_metadata()
washr::update_metadata()
washr::add_creator(name = "Yash Dubey", email = "[email protected]")
washr::generate_jsonld()
washr::update_gsheet_metadata("yashdubey132")
devtools::check()
devtools::build_readme()
pkgdown::build_website()
pkgdown::build_site()
washr::setup_website()
devtools::build_readme()
washr::setup_website()
devtools::build_readme()
devtools::build_readme()
washr::setup_website()
devtools::build_readme()
citation <- utils::readCitationFile("inst/CITATION")
citation
citation$doi
biblio_metadata <- readr::read_csv("data/metadata/biblio.csv", show_col_types = FALSE)
biblio_metadata$keywords[1]
remove.packages("washr")
devtools::install_github("https://github.com/openwashdata/washr", ref = "dev-metadata")
library(washr)
washr::update_gsheet_metadata()
washr::update_gsheet_metadata("yashdubey132")
remove.packages("washr")
install.packages("https://github.com/openwashdata/washr", ref = "dev-metadata")
devtools::install_github("https://github.com/openwashdata/washr", ref="dev-metadata")
washr::update_citation("10.581.test")
devtools::build_readme()