From 1c165a06a75bd6fb156c0f49078465c8d462329a Mon Sep 17 00:00:00 2001 From: Niklas Hohmann <67792281+NiklasHohmann@users.noreply.github.com> Date: Thu, 22 Aug 2024 07:54:50 +0200 Subject: [PATCH 1/3] update renv, add figs --- .gitignore | 3 +- code/make_table.R | 28 +++++ renv.lock | 267 ++++++++++++++++++++++------------------------ renv/activate.R | 80 ++++++++++---- 4 files changed, 220 insertions(+), 158 deletions(-) diff --git a/.gitignore b/.gitignore index 7ee9a27..2b823fb 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ .Ruserdata # don't track csv files -*.csv \ No newline at end of file +*.csv +*.pdf \ No newline at end of file diff --git a/code/make_table.R b/code/make_table.R index cef1d69..1cbf91d 100644 --- a/code/make_table.R +++ b/code/make_table.R @@ -64,3 +64,31 @@ table["total", "families"] <- sum(table[group_names,"families"]) table cat("Table successfully generated!\n") + +#### make plots #### +library(ggplot2) +## plot occurrences +df = messinian_db +ggplot(df, aes( x = group.name, fill = region.new)) + + geom_bar(position = "dodge") + + xlab("Group") + + ylab("No. occurrences") + + theme(axis.text.x = element_text(angle = 90)) +ggsave("figs/occ.pdf") + +ggplot(df, aes( x = group.name , group = Locality, y = Locality, fill = region.new, )) + + geom_bar(position = "dodge") + + xlab("Group") + + ylab("No. occurrences") + + theme(axis.text.x = element_text(angle = 90)) + +df = data.frame(group = rep(group_names, each = 3), + regions = rep(regions, length(group_names)), + nloc = rep(NA, length(regions) * length(group_names))) +for (i in seq_len(nrow(df))){ + df[i, "nloc"] = length(unique(messinian_db$Locality[messinian_db$group.name == df$group[i] & messinian_db$region.new == df$regions[i]])) +} + +ggplot(df, aes(x = group, y = nloc, fill = regions)) + + geom_bar(position = position_dodge(), stat = "identity") +ggsave("figs/locs.pdf") diff --git a/renv.lock b/renv.lock index 84e91ca..491e005 100644 --- a/renv.lock +++ b/renv.lock @@ -1,6 +1,6 @@ { "R": { - "Version": "4.3.2", + "Version": "4.4.1", "Repositories": [ { "Name": "CRAN", @@ -11,18 +11,18 @@ "Packages": { "DBI": { "Package": "DBI", - "Version": "1.2.2", + "Version": "1.2.3", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "methods" ], - "Hash": "164809cd72e1d5160b4cb3aa57f510fe" + "Hash": "065ae649b05f1ff66bb0c793107508f5" }, "MASS": { "Package": "MASS", - "Version": "7.3-60", + "Version": "7.3-61", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -33,11 +33,11 @@ "stats", "utils" ], - "Hash": "a56a6365b3fa73293ea8d084be0d9bb0" + "Hash": "0cafd6f0500e5deba33be22c46bf6055" }, "Matrix": { "Package": "Matrix", - "Version": "1.6-4", + "Version": "1.7-0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -50,7 +50,7 @@ "stats", "utils" ], - "Hash": "d9c655b30a2edc6bb2244c1d1e8d549d" + "Hash": "1920b2f11133b12350024297d8a4ff4a" }, "R6": { "Package": "R6", @@ -74,18 +74,18 @@ }, "Rcpp": { "Package": "Rcpp", - "Version": "1.0.12", + "Version": "1.0.13", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "methods", "utils" ], - "Hash": "5ea2700d21e038ace58269ecdbeb9ec0" + "Hash": "f27411eb6d9c3dada5edd444b8416675" }, "XML": { "Package": "XML", - "Version": "3.99-0.16", + "Version": "3.99-0.17", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -93,7 +93,7 @@ "methods", "utils" ], - "Hash": "131e2febe15d5bbca3a37bd69e71b873" + "Hash": "bc2a8a1139d8d4bd9c46086708945124" }, "askpass": { "Package": "askpass", @@ -136,13 +136,13 @@ }, "backports": { "Package": "backports", - "Version": "1.4.1", + "Version": "1.5.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R" ], - "Hash": "c39fbec8a30d23e721980b8afb31984c" + "Hash": "e1e1b9d75c37401117b636b7ae50827a" }, "base64enc": { "Package": "base64enc", @@ -180,10 +180,10 @@ }, "bitops": { "Package": "bitops", - "Version": "1.0-7", + "Version": "1.0-8", "Source": "Repository", "Repository": "CRAN", - "Hash": "b7d8d8ee39869c18d8846a184dd8a1af" + "Hash": "da69e6b6f8feebec0827205aad3fdbd8" }, "blob": { "Package": "blob", @@ -206,14 +206,13 @@ }, "broom": { "Package": "broom", - "Version": "1.0.5", + "Version": "1.0.6", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "backports", "dplyr", - "ellipsis", "generics", "glue", "lifecycle", @@ -223,17 +222,18 @@ "tibble", "tidyr" ], - "Hash": "fd25391c3c4f6ecf0fa95f1e6d15378c" + "Hash": "a4652c36d1f8abfc3ddf4774f768c934" }, "bslib": { "Package": "bslib", - "Version": "0.6.1", + "Version": "0.8.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "base64enc", "cachem", + "fastmap", "grDevices", "htmltools", "jquerylib", @@ -244,22 +244,22 @@ "rlang", "sass" ], - "Hash": "c0d8599494bc7fb408cd206bbdd9cab0" + "Hash": "b299c6741ca9746fb227debcb0f9fb6c" }, "cachem": { "Package": "cachem", - "Version": "1.0.8", + "Version": "1.1.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "fastmap", "rlang" ], - "Hash": "c35768291560ce302c0a6589f92e837d" + "Hash": "cd9a672193789068eb5a2aad65a0dedf" }, "callr": { "Package": "callr", - "Version": "3.7.5", + "Version": "3.7.6", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -268,7 +268,7 @@ "processx", "utils" ], - "Hash": "9f0e4fae4963ba775a5e5c520838c87b" + "Hash": "d7e13f49c19103ece9e58ad2d83a7354" }, "cellranger": { "Package": "cellranger", @@ -284,14 +284,14 @@ }, "cli": { "Package": "cli", - "Version": "3.6.1", + "Version": "3.6.3", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "utils" ], - "Hash": "89e6d8219950eac806ae0c489052048a" + "Hash": "b21916dd77a27642b447374a5d30ecf3" }, "clipr": { "Package": "clipr", @@ -305,7 +305,7 @@ }, "colorspace": { "Package": "colorspace", - "Version": "2.1-0", + "Version": "2.1-1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -315,14 +315,14 @@ "methods", "stats" ], - "Hash": "f20c47fd52fae58b4e377c37bb8c335b" + "Hash": "d954cb1c57e8d8b756165d7ba18aa55a" }, "commonmark": { "Package": "commonmark", - "Version": "1.9.0", + "Version": "1.9.1", "Source": "Repository", "Repository": "CRAN", - "Hash": "d691c61bff84bd63c383874d2d0c3307" + "Hash": "5d8225445acb167abf7797de48b2ee3c" }, "conflicted": { "Package": "conflicted", @@ -349,7 +349,7 @@ }, "crayon": { "Package": "crayon", - "Version": "1.5.2", + "Version": "1.5.3", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -357,32 +357,32 @@ "methods", "utils" ], - "Hash": "e8a1e41acf02548751f45c718d55aa6a" + "Hash": "859d96e65ef198fd43e82b9628d593ef" }, "curl": { "Package": "curl", - "Version": "5.2.0", + "Version": "5.2.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R" ], - "Hash": "ce88d13c0b10fe88a37d9c59dba2d7f9" + "Hash": "411ca2c03b1ce5f548345d2fc2685f7a" }, "data.table": { "Package": "data.table", - "Version": "1.15.2", + "Version": "1.15.4", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "methods" ], - "Hash": "536dfe4ac4093b5d115caed7a1a7223b" + "Hash": "8ee9ac56ef633d0c7cab8b2ca87d683e" }, "dbplyr": { "Package": "dbplyr", - "Version": "2.4.0", + "Version": "2.5.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -406,7 +406,7 @@ "vctrs", "withr" ], - "Hash": "59351f28a81f0742720b85363c4fdd61" + "Hash": "39b2e002522bfd258039ee4e889e0fd1" }, "desc": { "Package": "desc", @@ -423,14 +423,14 @@ }, "digest": { "Package": "digest", - "Version": "0.6.34", + "Version": "0.6.37", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "utils" ], - "Hash": "7ede2ee9ea8d3edbf1ca84c1e333ad1a" + "Hash": "33698c4b3127fc9f506654607fb73676" }, "dplyr": { "Package": "dplyr", @@ -474,27 +474,16 @@ ], "Hash": "54ed3ea01b11e81a86544faaecfef8e2" }, - "ellipsis": { - "Package": "ellipsis", - "Version": "0.3.2", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "rlang" - ], - "Hash": "bb0eec2fe32e88d9e2836c2f73ea2077" - }, "evaluate": { "Package": "evaluate", - "Version": "0.23", + "Version": "0.24.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "methods" ], - "Hash": "daf4a1246be12c1fa8c7705a0935c1a0" + "Hash": "a1066cbc05caee9a4bf6d90f194ff4da" }, "fansi": { "Package": "fansi", @@ -510,17 +499,17 @@ }, "farver": { "Package": "farver", - "Version": "2.1.1", + "Version": "2.1.2", "Source": "Repository", "Repository": "CRAN", - "Hash": "8106d78941f34855c440ddb946b8f7a5" + "Hash": "680887028577f3fa2a81e410ed0d6e42" }, "fastmap": { "Package": "fastmap", - "Version": "1.1.1", + "Version": "1.2.0", "Source": "Repository", "Repository": "CRAN", - "Hash": "f7736a18de97dea803bde0a2daaafb27" + "Hash": "aa5e1cd11c2d15497494c5292d7ffcc8" }, "filelock": { "Package": "filelock", @@ -562,14 +551,14 @@ }, "fs": { "Package": "fs", - "Version": "1.6.3", + "Version": "1.6.4", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "methods" ], - "Hash": "47b5f30c720c23999b913a1a635cf0bb" + "Hash": "15aeb8c27f5ea5161f9f6a641fafd93a" }, "gargle": { "Package": "gargle", @@ -634,7 +623,7 @@ }, "ggplot2": { "Package": "ggplot2", - "Version": "3.5.0", + "Version": "3.5.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -655,7 +644,7 @@ "vctrs", "withr" ], - "Hash": "52ef83f93f74833007f193b2d4c159a2" + "Hash": "44c6a2f8202d5b7e878ea274b1092426" }, "ggthemes": { "Package": "ggthemes", @@ -742,7 +731,7 @@ }, "gtable": { "Package": "gtable", - "Version": "0.3.4", + "Version": "0.3.5", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -753,7 +742,7 @@ "lifecycle", "rlang" ], - "Hash": "b29cf3031f49b04ab9c852c912547eef" + "Hash": "e18861963cbc65a27736e02b3cd3c4a0" }, "haven": { "Package": "haven", @@ -778,14 +767,14 @@ }, "highr": { "Package": "highr", - "Version": "0.10", + "Version": "0.11", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "xfun" ], - "Hash": "06230136b2d2b9ba5805e1963fa6e890" + "Hash": "d65ba49117ca223614f71b60d85b8ab7" }, "hms": { "Package": "hms", @@ -803,20 +792,19 @@ }, "htmltools": { "Package": "htmltools", - "Version": "0.5.7", + "Version": "0.5.8.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "base64enc", "digest", - "ellipsis", "fastmap", "grDevices", "rlang", "utils" ], - "Hash": "2d7b3857980e0e0d0a1fd6f11928ab0f" + "Hash": "81d371a9cc60640e74e4ab6ac46dcedc" }, "httr": { "Package": "httr", @@ -907,7 +895,7 @@ }, "knitr": { "Package": "knitr", - "Version": "1.45", + "Version": "1.48", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -919,7 +907,7 @@ "xfun", "yaml" ], - "Hash": "1ec462871063897135c1bcbe0fc8f07d" + "Hash": "acf380f300c721da9fde7df115a5f86f" }, "labeling": { "Package": "labeling", @@ -934,7 +922,7 @@ }, "lattice": { "Package": "lattice", - "Version": "0.22-5", + "Version": "0.22-6", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -945,7 +933,7 @@ "stats", "utils" ], - "Hash": "7c5e89f04e72d6611c77451f6331a091" + "Hash": "cc5ac1ba4c238c7ca9fa6a87ca11a7e2" }, "lifecycle": { "Package": "lifecycle", @@ -1041,18 +1029,18 @@ }, "munsell": { "Package": "munsell", - "Version": "0.5.0", + "Version": "0.5.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "colorspace", "methods" ], - "Hash": "6dfe8bf774944bd5595785e3229d8771" + "Hash": "4fd8900853b746af55b81fda99da7695" }, "nlme": { "Package": "nlme", - "Version": "3.1-164", + "Version": "3.1-166", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1062,17 +1050,17 @@ "stats", "utils" ], - "Hash": "a623a2239e642806158bc4dc3f51565d" + "Hash": "ccbb8846be320b627e6aa2b4616a2ded" }, "openssl": { "Package": "openssl", - "Version": "2.1.1", + "Version": "2.2.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "askpass" ], - "Hash": "2a0dc8c6adfb6f032e4d4af82d258ab5" + "Hash": "c62edf62de70cadf40553e10c739049d" }, "pillar": { "Package": "pillar", @@ -1093,7 +1081,7 @@ }, "pkgbuild": { "Package": "pkgbuild", - "Version": "1.4.3", + "Version": "1.4.4", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1104,7 +1092,7 @@ "desc", "processx" ], - "Hash": "c0143443203205e6a2760ce553dafc24" + "Hash": "a29e8e134a460a01e0ca67a4763c595b" }, "pkgconfig": { "Package": "pkgconfig", @@ -1118,24 +1106,25 @@ }, "pkgload": { "Package": "pkgload", - "Version": "1.3.4", + "Version": "1.4.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "cli", - "crayon", "desc", "fs", "glue", + "lifecycle", "methods", "pkgbuild", + "processx", "rlang", "rprojroot", "utils", "withr" ], - "Hash": "876c618df5ae610be84356d5d7a5d124" + "Hash": "2ec30ffbeec83da57655b850cf2d3e0e" }, "plyr": { "Package": "plyr", @@ -1170,7 +1159,7 @@ }, "processx": { "Package": "processx", - "Version": "3.8.3", + "Version": "3.8.4", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1179,7 +1168,7 @@ "ps", "utils" ], - "Hash": "82d48b1aec56084d9438dbf98087a7e9" + "Hash": "0c90a7d71988856bad2a2a45dd871bb9" }, "progress": { "Package": "progress", @@ -1197,14 +1186,14 @@ }, "ps": { "Package": "ps", - "Version": "1.7.6", + "Version": "1.7.7", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "utils" ], - "Hash": "dd2b9319ee0656c8acf45c7f40c59de7" + "Hash": "878b467580097e9c383acbb16adab57a" }, "purrr": { "Package": "purrr", @@ -1223,14 +1212,14 @@ }, "ragg": { "Package": "ragg", - "Version": "1.2.7", + "Version": "1.3.2", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "systemfonts", "textshaping" ], - "Hash": "90a1b8b7e518d7f90480d56453b4d062" + "Hash": "e3087db406e079a8a2fd87f413918ed3" }, "rappdirs": { "Package": "rappdirs", @@ -1244,7 +1233,7 @@ }, "rdflib": { "Package": "rdflib", - "Version": "0.2.8", + "Version": "0.2.9", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1256,11 +1245,11 @@ "tidyr", "utils" ], - "Hash": "7aabe63f0e0a33190643e25ba9dd3774" + "Hash": "7d812c4fa75df359492a135421fa0c12" }, "readr": { "Package": "readr", - "Version": "2.1.4", + "Version": "2.1.5", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1279,7 +1268,7 @@ "utils", "vroom" ], - "Hash": "b5047343b3825f37ad9d3b5d89aa1078" + "Hash": "9de96463d2117f6ac49980577939dfb3" }, "readxl": { "Package": "readxl", @@ -1327,17 +1316,17 @@ }, "renv": { "Package": "renv", - "Version": "1.0.3", + "Version": "1.0.7", "Source": "Repository", - "Repository": "CRAN", + "Repository": "RSPM", "Requirements": [ "utils" ], - "Hash": "41b847654f567341725473431dd0d5ab" + "Hash": "397b7b2a265bc5a7a06852524dabae20" }, "reprex": { "Package": "reprex", - "Version": "2.0.2", + "Version": "2.1.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1355,22 +1344,22 @@ "utils", "withr" ], - "Hash": "d66fe009d4c20b7ab1927eb405db9ee2" + "Hash": "97b1d5361a24d9fb588db7afe3e5bcbf" }, "rlang": { "Package": "rlang", - "Version": "1.1.1", + "Version": "1.1.4", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "utils" ], - "Hash": "a85c767b55f0bf9b7ad16c6d7baee5bb" + "Hash": "3eec01f8b1dee337674b2e34ab1f9bc1" }, "rmarkdown": { "Package": "rmarkdown", - "Version": "2.25", + "Version": "2.28", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1383,18 +1372,17 @@ "jsonlite", "knitr", "methods", - "stringr", "tinytex", "tools", "utils", "xfun", "yaml" ], - "Hash": "d65e35823c817f09f4de424fcdfa812a" + "Hash": "062470668513dcda416927085ee9bdc7" }, "roxygen2": { "Package": "roxygen2", - "Version": "7.2.3", + "Version": "7.3.2", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1416,7 +1404,7 @@ "withr", "xml2" ], - "Hash": "7b153c746193b143c14baa072bae4e27" + "Hash": "6ee25f9054a70f44d615300ed531ba8d" }, "rprojroot": { "Package": "rprojroot", @@ -1430,14 +1418,14 @@ }, "rstudioapi": { "Package": "rstudioapi", - "Version": "0.15.0", + "Version": "0.16.0", "Source": "Repository", "Repository": "CRAN", - "Hash": "5564500e25cffad9e22244ced1379887" + "Hash": "96710351d642b70e8f02ddeb237c46a7" }, "rvest": { "Package": "rvest", - "Version": "1.0.3", + "Version": "1.0.4", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1450,14 +1438,13 @@ "rlang", "selectr", "tibble", - "withr", "xml2" ], - "Hash": "a4a5ac819a467808c60e36e92ddf195e" + "Hash": "0bcf0c6f274e90ea314b812a6d19a519" }, "sass": { "Package": "sass", - "Version": "0.4.8", + "Version": "0.4.9", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1467,7 +1454,7 @@ "rappdirs", "rlang" ], - "Hash": "168f9353c76d4c4b0a0bbf72e2c2d035" + "Hash": "d53dbfddf695303ea4ad66f86e99b95d" }, "scales": { "Package": "scales", @@ -1511,7 +1498,7 @@ }, "stringi": { "Package": "stringi", - "Version": "1.8.3", + "Version": "1.8.4", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1520,7 +1507,7 @@ "tools", "utils" ], - "Hash": "058aebddea264f4c99401515182e656a" + "Hash": "39e1144fd75428983dc3f63aa53dfa91" }, "stringr": { "Package": "stringr", @@ -1548,26 +1535,28 @@ }, "systemfonts": { "Package": "systemfonts", - "Version": "1.0.5", + "Version": "1.1.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", - "cpp11" + "cpp11", + "lifecycle" ], - "Hash": "15b594369e70b975ba9f064295983499" + "Hash": "213b6b8ed5afbf934843e6c3b090d418" }, "textshaping": { "Package": "textshaping", - "Version": "0.3.7", + "Version": "0.4.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "cpp11", + "lifecycle", "systemfonts" ], - "Hash": "997aac9ad649e0ef3b97f96cddd5622b" + "Hash": "5142f8bc78ed3d819d26461b641627ce" }, "tibble": { "Package": "tibble", @@ -1590,7 +1579,7 @@ }, "tidyr": { "Package": "tidyr", - "Version": "1.3.0", + "Version": "1.3.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1609,11 +1598,11 @@ "utils", "vctrs" ], - "Hash": "e47debdc7ce599b070c8e78e8ac0cfcf" + "Hash": "915fb7ce036c22a6a33b5a8adb712eb1" }, "tidyselect": { "Package": "tidyselect", - "Version": "1.2.0", + "Version": "1.2.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1625,7 +1614,7 @@ "vctrs", "withr" ], - "Hash": "79540e5fcd9e0435af547d885f184fd5" + "Hash": "829f27b9c4919c16b593794a6344d6c0" }, "tidyverse": { "Package": "tidyverse", @@ -1680,13 +1669,13 @@ }, "tinytex": { "Package": "tinytex", - "Version": "0.49", + "Version": "0.52", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "xfun" ], - "Hash": "5ac22900ae0f386e54f1c307eca7d843" + "Hash": "cfbad971a71f0e27cec22e544a08bc3b" }, "tzdb": { "Package": "tzdb", @@ -1711,13 +1700,13 @@ }, "uuid": { "Package": "uuid", - "Version": "1.1-1", + "Version": "1.2-1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R" ], - "Hash": "3d78edfb977a69fc7a0341bee25e163f" + "Hash": "34e965e62a41fcafb1ca60e9b142085b" }, "vctrs": { "Package": "vctrs", @@ -1771,7 +1760,7 @@ }, "withr": { "Package": "withr", - "Version": "3.0.0", + "Version": "3.0.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1779,18 +1768,20 @@ "grDevices", "graphics" ], - "Hash": "d31b6c62c10dcf11ec530ca6b0dd5d35" + "Hash": "07909200e8bbe90426fbfeb73e1e27aa" }, "xfun": { "Package": "xfun", - "Version": "0.41", + "Version": "0.47", "Source": "Repository", "Repository": "CRAN", "Requirements": [ + "R", + "grDevices", "stats", "tools" ], - "Hash": "460a5e0fe46a80ef87424ad216028014" + "Hash": "36ab21660e2d095fef0d83f689e0477c" }, "xml2": { "Package": "xml2", @@ -1807,14 +1798,14 @@ }, "yaml": { "Package": "yaml", - "Version": "2.3.8", + "Version": "2.3.10", "Source": "Repository", "Repository": "CRAN", - "Hash": "29240487a071f535f5e5d5a323b7afbd" + "Hash": "51dab85c6c98e50a18d7551e9d49f76c" }, "zen4R": { "Package": "zen4R", - "Version": "0.9", + "Version": "0.10", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1822,22 +1813,24 @@ "R6", "XML", "atom4R", + "cli", "httr", "jsonlite", "keyring", "methods", + "plyr", "tools", "utf8", "xml2" ], - "Hash": "c276a810a7fc656e140c79051c69fbbf" + "Hash": "e985844f4518bc1cb3abd116693c11e4" }, "zip": { "Package": "zip", - "Version": "2.3.0", + "Version": "2.3.1", "Source": "Repository", "Repository": "CRAN", - "Hash": "d98c94dacb7e0efcf83b0a133a705504" + "Hash": "fcc4bd8e6da2d2011eb64a5e5cc685ab" } } } diff --git a/renv/activate.R b/renv/activate.R index cb5401f..d13f993 100644 --- a/renv/activate.R +++ b/renv/activate.R @@ -2,11 +2,13 @@ local({ # the requested version of renv - version <- "1.0.3" + version <- "1.0.7" attr(version, "sha") <- NULL # the project directory - project <- getwd() + project <- Sys.getenv("RENV_PROJECT") + if (!nzchar(project)) + project <- getwd() # use start-up diagnostics if enabled diagnostics <- Sys.getenv("RENV_STARTUP_DIAGNOSTICS", unset = "FALSE") @@ -31,6 +33,14 @@ local({ if (!is.null(override)) return(override) + # if we're being run in a context where R_LIBS is already set, + # don't load -- presumably we're being run as a sub-process and + # the parent process has already set up library paths for us + rcmd <- Sys.getenv("R_CMD", unset = NA) + rlibs <- Sys.getenv("R_LIBS", unset = NA) + if (!is.na(rlibs) && !is.na(rcmd)) + return(FALSE) + # next, check environment variables # TODO: prefer using the configuration one in the future envvars <- c( @@ -50,9 +60,22 @@ local({ }) - if (!enabled) + # bail if we're not enabled + if (!enabled) { + + # if we're not enabled, we might still need to manually load + # the user profile here + profile <- Sys.getenv("R_PROFILE_USER", unset = "~/.Rprofile") + if (file.exists(profile)) { + cfg <- Sys.getenv("RENV_CONFIG_USER_PROFILE", unset = "TRUE") + if (tolower(cfg) %in% c("true", "t", "1")) + sys.source(profile, envir = globalenv()) + } + return(FALSE) + } + # avoid recursion if (identical(getOption("renv.autoloader.running"), TRUE)) { warning("ignoring recursive attempt to run renv autoloader") @@ -108,6 +131,21 @@ local({ } + heredoc <- function(text, leave = 0) { + + # remove leading, trailing whitespace + trimmed <- gsub("^\\s*\\n|\\n\\s*$", "", text) + + # split into lines + lines <- strsplit(trimmed, "\n", fixed = TRUE)[[1L]] + + # compute common indent + indent <- regexpr("[^[:space:]]", lines) + common <- min(setdiff(indent, -1L)) - leave + paste(substring(lines, common), collapse = "\n") + + } + startswith <- function(string, prefix) { substring(string, 1, nchar(prefix)) == prefix } @@ -610,6 +648,9 @@ local({ # if the user has requested an automatic prefix, generate it auto <- Sys.getenv("RENV_PATHS_PREFIX_AUTO", unset = NA) + if (is.na(auto) && getRversion() >= "4.4.0") + auto <- "TRUE" + if (auto %in% c("TRUE", "True", "true", "1")) return(renv_bootstrap_platform_prefix_auto()) @@ -801,24 +842,23 @@ local({ # the loaded version of renv doesn't match the requested version; # give the user instructions on how to proceed - remote <- if (!is.null(description[["RemoteSha"]])) { + dev <- identical(description[["RemoteType"]], "github") + remote <- if (dev) paste("rstudio/renv", description[["RemoteSha"]], sep = "@") - } else { + else paste("renv", description[["Version"]], sep = "@") - } # display both loaded version + sha if available friendly <- renv_bootstrap_version_friendly( version = description[["Version"]], - sha = description[["RemoteSha"]] + sha = if (dev) description[["RemoteSha"]] ) - fmt <- paste( - "renv %1$s was loaded from project library, but this project is configured to use renv %2$s.", - "- Use `renv::record(\"%3$s\")` to record renv %1$s in the lockfile.", - "- Use `renv::restore(packages = \"renv\")` to install renv %2$s into the project library.", - sep = "\n" - ) + fmt <- heredoc(" + renv %1$s was loaded from project library, but this project is configured to use renv %2$s. + - Use `renv::record(\"%3$s\")` to record renv %1$s in the lockfile. + - Use `renv::restore(packages = \"renv\")` to install renv %2$s into the project library. + ") catf(fmt, friendly, renv_bootstrap_version_friendly(version), remote) FALSE @@ -1041,7 +1081,7 @@ local({ # if jsonlite is loaded, use that instead if ("jsonlite" %in% loadedNamespaces()) { - json <- catch(renv_json_read_jsonlite(file, text)) + json <- tryCatch(renv_json_read_jsonlite(file, text), error = identity) if (!inherits(json, "error")) return(json) @@ -1050,7 +1090,7 @@ local({ } # otherwise, fall back to the default JSON reader - json <- catch(renv_json_read_default(file, text)) + json <- tryCatch(renv_json_read_default(file, text), error = identity) if (!inherits(json, "error")) return(json) @@ -1063,14 +1103,14 @@ local({ } renv_json_read_jsonlite <- function(file = NULL, text = NULL) { - text <- paste(text %||% read(file), collapse = "\n") + text <- paste(text %||% readLines(file, warn = FALSE), collapse = "\n") jsonlite::fromJSON(txt = text, simplifyVector = FALSE) } renv_json_read_default <- function(file = NULL, text = NULL) { # find strings in the JSON - text <- paste(text %||% read(file), collapse = "\n") + text <- paste(text %||% readLines(file, warn = FALSE), collapse = "\n") pattern <- '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' locs <- gregexpr(pattern, text, perl = TRUE)[[1]] @@ -1118,14 +1158,14 @@ local({ map <- as.list(map) # remap strings in object - remapped <- renv_json_remap(json, map) + remapped <- renv_json_read_remap(json, map) # evaluate eval(remapped, envir = baseenv()) } - renv_json_remap <- function(json, map) { + renv_json_read_remap <- function(json, map) { # fix names if (!is.null(names(json))) { @@ -1152,7 +1192,7 @@ local({ # recurse if (is.recursive(json)) { for (i in seq_along(json)) { - json[i] <- list(renv_json_remap(json[[i]], map)) + json[i] <- list(renv_json_read_remap(json[[i]], map)) } } From bb7f32817ebb678eb20871b24f7a75d767c94029 Mon Sep 17 00:00:00 2001 From: Niklas Hohmann <67792281+NiklasHohmann@users.noreply.github.com> Date: Thu, 22 Aug 2024 09:24:57 +0200 Subject: [PATCH 2/3] update doi to download latest version of DB --- code/download_data.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/download_data.R b/code/download_data.R index 672b686..b30d20e 100644 --- a/code/download_data.R +++ b/code/download_data.R @@ -2,6 +2,6 @@ # download latest version of the database from Zenodo, https://zenodo.org/doi/10.5281/zenodo.10782428 cat("Downloading raw data\n") -zen4R::download_zenodo("10.5281/zenodo.10782428", path = "data/") +zen4R::download_zenodo("10.5281/zenodo.13358435", path = "data/") cat("Data successfully downloaded! \n") \ No newline at end of file From 0c180c77443c7779f2aac06793983bcf7871a4a3 Mon Sep 17 00:00:00 2001 From: Niklas Hohmann <67792281+NiklasHohmann@users.noreply.github.com> Date: Thu, 22 Aug 2024 10:06:18 +0200 Subject: [PATCH 3/3] make figures, update readme --- README.md | 15 ++++-- code/{make_table.R => make_table_and_plots.R} | 51 +++++++++++-------- 2 files changed, 41 insertions(+), 25 deletions(-) rename code/{make_table.R => make_table_and_plots.R} (74%) diff --git a/README.md b/README.md index 16285ac..9b62c3f 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.10782803.svg)](https://doi.org/10.5281/zenodo.10782803) -Supplementary code for _"A revised marine fossil record of the Mediterranean before and after the Messinian Salinity Crisis"_. Generates summary statistics and maps. +Supplementary code for _"A revised marine fossil record of the Mediterranean before and after the Messinian Salinity Crisis"_ (Agiadi et al 2024, [DOI: 10.5194/essd-2024-75](https://doi.org/10.5194/essd-2024-75)). Generates summary statistics, figures, and maps. Project webpage: [REMARE project](https://sites.google.com/view/kagiadi/projects/remare) @@ -51,7 +51,7 @@ source("code/download_data.R") to download the latest version of the database from Zenodo. Then, run ```R -source("code/make_table.R") +source("code/make_table_and_plots.R") ``` in the console to produce the summary statistics of the database (stored in the variable `table`). You can view the values by running @@ -60,12 +60,12 @@ in the console to produce the summary statistics of the database (stored in the table ``` -in the console. Details on producing the map are given in the file `code/make_maps.R`. +in the console, and inspect the figures in `figs/`. Details on producing the map are given in the file `code/make_maps.R`. ## Repository structure * _code_ : folder with R code - * _make_table.R_ : script to generate table 1 + * _make_table_and_plots.R_ : script to generate table 1 and figures * _make_maps.R_ : script to generate the maps * _download_data.R_ : script to download data from Zenodo * _data_ : folder for raw data. Initially empty, will be filled with downloaded data after the script in `code/download_data` is run. @@ -77,6 +77,13 @@ in the console. Details on producing the map are given in the file `code/make_ma * _README_ : README file * _renv.lock_ : lock file for `renv` package +## References + +This repository downloads and uses data from + +* Agiadi, K., Hohmann, N., Gliozzi, E., Thivaiou, D., Francesca, B., Taviani, M., Bianucci, G., Collareta, A., Londeix, L., Faranda, C., Bulian, F., Koskeridou, E., Lozar, F., Mancini, A. M., Dominici, S., Moissette, P., Bajo Campos, I., Borghi, E., Iliopoulos, G., … Garcia-Castellanos, D. (2024). Revised marine fossil record of the Mediterranean before and after the Messinian Salinity Crisis [Data set]. Zenodo. https://doi.org/10.5281/zenodo.13358435 + + ## Funding This work was supported by the Austrian Science Fund (FWF) project “Late Miocene Mediterranean Marine Ecosystem Crisis” (2022–2026), Project no. V 986, [DOI 10.55776/V986](https://www.doi.org/10.55776/V986) (PI: K.Agiadi). diff --git a/code/make_table.R b/code/make_table_and_plots.R similarity index 74% rename from code/make_table.R rename to code/make_table_and_plots.R index 1cbf91d..6eba1a7 100644 --- a/code/make_table.R +++ b/code/make_table_and_plots.R @@ -67,28 +67,37 @@ cat("Table successfully generated!\n") #### make plots #### library(ggplot2) +cat("Creating plots\n") ## plot occurrences -df = messinian_db -ggplot(df, aes( x = group.name, fill = region.new)) + - geom_bar(position = "dodge") + - xlab("Group") + - ylab("No. occurrences") + - theme(axis.text.x = element_text(angle = 90)) -ggsave("figs/occ.pdf") - -ggplot(df, aes( x = group.name , group = Locality, y = Locality, fill = region.new, )) + - geom_bar(position = "dodge") + - xlab("Group") + - ylab("No. occurrences") + - theme(axis.text.x = element_text(angle = 90)) +make_occ_plot = function(file_name){ + df = data.frame(group = rep(group_names, each = 3), + regions = rep(regions, length(group_names)), + nocc = rep(NA, length(regions) * length(group_names))) + for (i in seq_len(nrow(df))){ + df[i, "nocc"] = length(unique(messinian_db$ID[messinian_db$group.name == df$group[i] & messinian_db$region.new == df$regions[i]])) + } + ggplot(df, aes(x = group, fill = regions, y = nocc)) + + geom_bar(stat = "identity", position = "dodge") + + theme_classic() + ggsave(file_name) +} +make_occ_plot("figs/occ.pdf") -df = data.frame(group = rep(group_names, each = 3), - regions = rep(regions, length(group_names)), - nloc = rep(NA, length(regions) * length(group_names))) -for (i in seq_len(nrow(df))){ - df[i, "nloc"] = length(unique(messinian_db$Locality[messinian_db$group.name == df$group[i] & messinian_db$region.new == df$regions[i]])) +make_loc_plot = function(file_name){ + df = data.frame(group = rep(group_names, each = 3), + regions = rep(regions, length(group_names)), + nloc = rep(NA, length(regions) * length(group_names))) + for (i in seq_len(nrow(df))){ + df[i, "nloc"] = length(unique(messinian_db$Locality[messinian_db$group.name == df$group[i] & messinian_db$region.new == df$regions[i]])) + } + + ggplot(df, aes(x = group, y = nloc, fill = regions)) + + geom_bar(position = position_dodge(), stat = "identity") + + theme_classic() + ggsave(file_name) } +make_loc_plot("figs/locs.pdf") + + -ggplot(df, aes(x = group, y = nloc, fill = regions)) + - geom_bar(position = position_dodge(), stat = "identity") -ggsave("figs/locs.pdf") +cat("Plots are in figs/ \n")