library(kirkegaard)
## Loading required package: tidyverse
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.5
## ✔ forcats 1.0.0 ✔ stringr 1.5.1
## ✔ ggplot2 3.5.2 ✔ tibble 3.2.1
## ✔ lubridate 1.9.4 ✔ tidyr 1.3.1
## ✔ purrr 1.0.4
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
## Loading required package: magrittr
##
##
## Attaching package: 'magrittr'
##
##
## The following object is masked from 'package:purrr':
##
## set_names
##
##
## The following object is masked from 'package:tidyr':
##
## extract
##
##
## Loading required package: weights
##
## Loading required package: Hmisc
##
##
## Attaching package: 'Hmisc'
##
##
## The following objects are masked from 'package:dplyr':
##
## src, summarize
##
##
## The following objects are masked from 'package:base':
##
## format.pval, units
##
##
## Loading required package: assertthat
##
##
## Attaching package: 'assertthat'
##
##
## The following object is masked from 'package:tibble':
##
## has_name
##
##
## Loading required package: psych
##
##
## Attaching package: 'psych'
##
##
## The following object is masked from 'package:Hmisc':
##
## describe
##
##
## The following objects are masked from 'package:ggplot2':
##
## %+%, alpha
##
##
##
## Attaching package: 'kirkegaard'
##
##
## The following object is masked from 'package:psych':
##
## rescale
##
##
## The following object is masked from 'package:assertthat':
##
## are_equal
##
##
## The following object is masked from 'package:purrr':
##
## is_logical
##
##
## The following object is masked from 'package:base':
##
## +
load_packages(
googlesheets4,
ggrepel
)
theme_set(theme_bw())
options(
digits = 3
)
#multithreading
#library(future)
#plan(multisession(workers = 8))
gs4_deauth()
d_india = read_sheet("https://docs.google.com/spreadsheets/d/10LwswrONcsQho43y45_XobsTLzKGfURA-_59RZ0dzfs/edit?gid=0#gid=0") %>% df_legalize_names()
## ✔ Reading from "Indian NIQ".
## ✔ Range 'Sheet1'.
d_india %>%
mutate(
US = str_detect(Short, "^US")
) %>%
# GG_scatter("Year_meas", "IQ_cor", case_names = "Short", color = "US") +
ggplot(aes(Year_meas, IQ_cor)) +
geom_point(aes(color = US)) +
geom_text_repel(aes(label = Short), vjust = -1, size = 3) +
labs(
x = "Year of dataset",
y = "IQ estimate",
title = "Studies of Indian IQ"
)
GG_save("India NIQ studies.png")
#versions
write_sessioninfo()
## R version 4.5.1 (2025-06-13)
## Platform: x86_64-pc-linux-gnu
## Running under: Linux Mint 21.1
##
## Matrix products: default
## BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.10.0
## LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0 LAPACK version 3.10.0
##
## locale:
## [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
## [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
## [5] LC_MONETARY=en_DK.UTF-8 LC_MESSAGES=en_US.UTF-8
## [7] LC_PAPER=en_DK.UTF-8 LC_NAME=C
## [9] LC_ADDRESS=C LC_TELEPHONE=C
## [11] LC_MEASUREMENT=en_DK.UTF-8 LC_IDENTIFICATION=C
##
## time zone: Europe/Brussels
## tzcode source: system (glibc)
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] ggrepel_0.9.6 googlesheets4_1.1.1 kirkegaard_2025-08-18
## [4] psych_2.5.3 assertthat_0.2.1 weights_1.0.4
## [7] Hmisc_5.2-3 magrittr_2.0.3 lubridate_1.9.4
## [10] forcats_1.0.0 stringr_1.5.1 dplyr_1.1.4
## [13] purrr_1.0.4 readr_2.1.5 tidyr_1.3.1
## [16] tibble_3.2.1 ggplot2_3.5.2 tidyverse_2.0.0
##
## loaded via a namespace (and not attached):
## [1] tidyselect_1.2.1 farver_2.1.2 fastmap_1.2.0 digest_0.6.37
## [5] rpart_4.1.24 timechange_0.3.0 lifecycle_1.0.4 cluster_2.1.8.1
## [9] survival_3.8-3 gdata_3.0.1 compiler_4.5.1 rlang_1.1.6
## [13] sass_0.4.10 tools_4.5.1 yaml_2.3.10 data.table_1.17.0
## [17] knitr_1.50 labeling_0.4.3 htmlwidgets_1.6.4 curl_6.2.2
## [21] mnormt_2.1.1 plyr_1.8.9 withr_3.0.2 foreign_0.8-90
## [25] nnet_7.3-20 grid_4.5.1 googledrive_2.1.1 jomo_2.7-6
## [29] colorspace_2.1-1 mice_3.17.0 scales_1.3.0 gtools_3.9.5
## [33] iterators_1.0.14 MASS_7.3-65 cli_3.6.4 rmarkdown_2.29
## [37] ragg_1.4.0 reformulas_0.4.0 generics_0.1.3 rstudioapi_0.17.1
## [41] httr_1.4.7 tzdb_0.5.0 minqa_1.2.8 cachem_1.1.0
## [45] splines_4.5.1 parallel_4.5.1 cellranger_1.1.0 base64enc_0.1-3
## [49] vctrs_0.6.5 boot_1.3-31 glmnet_4.1-8 Matrix_1.7-3
## [53] jsonlite_2.0.0 hms_1.1.3 mitml_0.4-5 Formula_1.2-5
## [57] htmlTable_2.4.3 systemfonts_1.2.2 foreach_1.5.2 jquerylib_0.1.4
## [61] glue_1.8.0 nloptr_2.2.1 pan_1.9 codetools_0.2-19
## [65] stringi_1.8.7 shape_1.4.6.1 gtable_0.3.6 lme4_1.1-37
## [69] munsell_0.5.1 pillar_1.10.2 htmltools_0.5.8.1 R6_2.6.1
## [73] textshaping_1.0.0 Rdpack_2.6.4 evaluate_1.0.3 lattice_0.22-5
## [77] rbibutils_2.3 backports_1.5.0 gargle_1.5.2 broom_1.0.8
## [81] bslib_0.9.0 Rcpp_1.0.14 gridExtra_2.3 nlme_3.1-168
## [85] checkmate_2.3.2 xfun_0.52 fs_1.6.6 pkgconfig_2.0.3
#write data to file for reuse
# d %>% write_rds("data/data_for_reuse.rds")
#OSF
if (F) {
library(osfr)
#login
osf_auth(readr::read_lines("~/.config/osf_token"))
#the project we will use
osf_proj = osf_retrieve_node("https://osf.io/XXX/")
#upload all files in project
#overwrite existing (versioning)
osf_upload(
osf_proj,
path = c("data", "figures", "papers", "notebook.Rmd", "notebook.html", "sessions_info.txt"),
conflicts = "overwrite"
)
}