diff --git a/DESCRIPTION b/DESCRIPTION index 0736350..b600414 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: rshift Type: Package Title: Paleoecology Functions for Regime Shift Analysis -Version: 2.2.1 +Version: 2.2.2 Authors@R: c(person("Alex H.", "Room", role = c("aut", "cre", "cph"), email = "alex.room@btinternet.com", @@ -26,14 +26,16 @@ Description: Contains a variety of functions, based around Suggests: R.rsp VignetteBuilder: R.rsp Depends: R (>= 3.5.0) -Imports: grid, tibble, dplyr, ggplot2, magrittr +Imports: grid, tibble, dplyr, ggplot2 License: MIT + file LICENSE NeedsCompilation: yes SystemRequirements: rustc & cargo if building from source +URL: https://github.com/alexhroom/rshift +BugReports: https://github.com/alexhroom/rshift/issues Encoding: UTF-8 LazyData: true RoxygenNote: 7.2.3 -Packaged: 2023-08-14 17:36:35 UTC; alexhroom +Packaged: 2023-08-30 10:19:29 UTC; alexhroom Author: Alex H. Room [aut, cre, cph] (), Felipe Franco-Gaviria [ctb, fnd] (), @@ -42,4 +44,4 @@ Author: Alex H. Room [aut, cre, cph] (), for details) Maintainer: Alex H. Room Repository: CRAN -Date/Publication: 2023-08-14 17:50:03 UTC +Date/Publication: 2023-08-30 11:00:02 UTC diff --git a/MD5 b/MD5 index 478e430..355e0eb 100644 --- a/MD5 +++ b/MD5 @@ -1,12 +1,12 @@ -b90a1ae66293babacef20fae0057557d *DESCRIPTION +eeec7bc37873672e41a636856d200fa2 *DESCRIPTION df7d9cd96e743cdd985e8c727837fdf5 *LICENSE 58cfb950588ff039b7bb86a70a235000 *LICENSE.note -d13fee9352d1e00feb481f2e21a0ab9b *NAMESPACE -e09a7172f1b498a0da698de76328cb46 *R/Hellinger_trans.R -c4e48f145c68172472d4fa6183b30c85 *R/Lanzante.R -133444377d472e69515bad9649501502 *R/RSI_graph.R +9dad121018268ed1b027459dc7e5487a *NAMESPACE +f59aee1f94dcf89bc8c12b2d6c4ff3e3 *R/Hellinger_trans.R +eb27c6b1fa046b979dd897204e2f6f65 *R/Lanzante.R +7020f0650ce9c4c6acfa6bf8ab2b2a33 *R/RSI_graph.R 2dc6590065002e3bd3444b69337b219f *R/Rodionov.R -1b45e2187b57eee0a82131160ee5d68d *R/absolute_to_percentage.R +675e958da4e6a53fcc1af58320ed5118 *R/absolute_to_percentage.R 9ed50886ced6406c37686b653ed6fc3f *R/extendr-wrappers.R 66679f1dd7f9a3573b6ccffae3d2c18e *R/lake_RSI.R ecd833a1a570fc42fcf9d5b20b64e6e0 *R/lake_data.R @@ -17,8 +17,8 @@ cb47ea68431f5dcfac57048c92937eb0 *configure 6a7e3276257e33d8dde031a6f1a59afb *data/lake_data.rda ca4f3bd6bcfbf429c370d179f45cfc8a *inst/AUTHORS fca5e95b47c836d5436fa4b20ca4ca49 *inst/CITATION -dce3d4e0903a092592ce7daf32c86a71 *inst/doc/STARSmanual.ltx -4e26cd6dfa1b14a33838772aef750411 *inst/doc/STARSmanual.pdf +ea7073b5cdd538c754278b25660fff60 *inst/doc/STARSmanual.ltx +10464d4cd7bac56cca23e30ea4a2558f *inst/doc/STARSmanual.pdf 93846e9c326301daf7ba01a83d4f1b11 *man/Hellinger_trans.Rd e6fa2c42258f181728e1d14954dde761 *man/Lanzante.Rd 9f6c50ce5fb118038d6d9548c4da3860 *man/RSI_graph.Rd @@ -28,14 +28,14 @@ df3fc9b0cffee5e4a91f85c0113b4c9d *man/lake_RSI.Rd 0fb1a9bc6c4996dd92da6a1187c0f89e *man/lake_data.Rd e68062d831de3b28748354107a305519 *man/rolling_autoc.Rd 0495b94fa546a21eb2d338c98d8c3957 *man/rust_rodionov.Rd -908b7cb68be1c4831b5c5a28ff2e1bed *src/Makevars -58071ea003ee61404fc60a4c1b1d902f *src/Makevars.win +f9b4d71515d099f022db176b5b636e2a *src/Makevars +c0d6b9f9604ac277e8851d4d1ed72d62 *src/Makevars.win 956a59f45ec296041fbbce2e46bb4105 *src/entrypoint.c -3e7f4fed13e7fb8b5d2832e414f4d054 *src/rust/Cargo.toml +9e3cb1bb6a2ff314e1e7ce0bb7ebea28 *src/rust/Cargo.toml d4c7febd30951f7fbd584476dbb2dd70 *src/rust/cargo_vendor_config.toml 0e5139792fee79cb1cd93d115cd5cbe6 *src/rust/src/lib.rs 667d4e574e3a8e6604b454ef3546faf0 *src/rust/vendor.sh 5eb3ad1ac90541c210d22ff9cbef3136 *src/rust/vendor.tar.xz 5422880bb8056e9761b2ae6d74bc83d5 *vignettes/RSI_graph.png -dce3d4e0903a092592ce7daf32c86a71 *vignettes/STARSmanual.ltx +ea7073b5cdd538c754278b25660fff60 *vignettes/STARSmanual.ltx 30c4e8965319f7a6651d9d8d6f848658 *vignettes/bibliography.bib diff --git a/NAMESPACE b/NAMESPACE index f18cd1d..2660da9 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -10,9 +10,8 @@ import(dplyr) importFrom(ggplot2,aes) importFrom(ggplot2,geom_col) importFrom(ggplot2,ggplot) -importFrom(magrittr,"%>%") importFrom(stats,acf) importFrom(stats,pnorm) importFrom(stats,qt) -importFrom(tibble,as.tibble) +importFrom(tibble,as_tibble) useDynLib(rshift, .registration = TRUE) diff --git a/R/Hellinger_trans.R b/R/Hellinger_trans.R index 77a191c..48fc7cf 100644 --- a/R/Hellinger_trans.R +++ b/R/Hellinger_trans.R @@ -7,16 +7,13 @@ #' @param site The column containing the site of each sample. #' @return The `data` dataframe with an added 'hellinger_trans_vals' column. #' @import dplyr -#' @importFrom magrittr %>% #' @export Hellinger_trans <- function(data, col, site){ #creates an empty table with the original table's columns, plus the hellinger values #i'm aware this is incredibly hacky, but i couldn't find a better way - results <- data %>% - cbind(hellinger_trans_vals = c(1:nrow(data))) %>% - filter(col == "bad programming") + results <- filter(cbind(data, hellinger_trans_vals = c(1:nrow(data))), col == "hack") #finds values for each site unique_sites <- unique(data[[site]]) for(s in unique_sites){ diff --git a/R/Lanzante.R b/R/Lanzante.R index bc2f572..98b763d 100644 --- a/R/Lanzante.R +++ b/R/Lanzante.R @@ -12,9 +12,8 @@ #' Lanzante(lake_data, "DCA1", "Age") #' Lanzante(lake_data, "DCA1", "Age", p=0.10, merge=TRUE) #' @import dplyr -#' @importFrom magrittr %>% #' @importFrom stats pnorm -#' @importFrom tibble as.tibble +#' @importFrom tibble as_tibble #' @export Lanzante <- function(data, col, time, p =0.05, merge = FALSE){ @@ -65,21 +64,18 @@ Lanzante <- function(data, col, time, p =0.05, merge = FALSE){ #creates vectors for shift years and their corresponding p-values if(pnorm(z) <= p){ p_vals <- c(p_vals, pnorm(z)) - shift_at <- slice(db, n_1) %>% - select(all_of(time)) + shift_at <- select(slice(db, n_1), all_of(time)) shift_years <- c(shift_years, as.numeric(shift_at)) - db <- db %>% - slice(-c(n_1)) + db <- slice(db, -c(n_1)) } else { break } } #creates results table - results <- as.tibble(cbind(shift_years, p_vals)) + results <- as_tibble(cbind(shift_years, p_vals)) - timename <- data %>% - select(all_of(time)) + timename <- select(data, all_of(time)) timename <- colnames(timename) names(results)[1] <- timename diff --git a/R/RSI_graph.R b/R/RSI_graph.R index c553f23..b376238 100644 --- a/R/RSI_graph.R +++ b/R/RSI_graph.R @@ -13,9 +13,6 @@ #' #' @export RSI_graph <- function(data, col, time, rsi){ - - - #while Rodionov() requires quotes, this doesn't work if you put quotes around col or time p1 <- ggplot(data) + geom_col(aes(x = .data[[time]], y = .data[[col]])) p2 <- ggplot(data) + geom_col(aes(x = .data[[time]], y = .data[[rsi]])) grid::pushViewport(grid::viewport(layout = grid::grid.layout(2, 1))) diff --git a/R/absolute_to_percentage.R b/R/absolute_to_percentage.R index 713b518..11a0b06 100644 --- a/R/absolute_to_percentage.R +++ b/R/absolute_to_percentage.R @@ -5,15 +5,12 @@ #' @param site The column containing the site of each sample. #' @return The `data` dataframe with an added 'percentage' column. #' @import dplyr -#' @importFrom magrittr %>% #' @export absolute_to_percentage <- function(data, col, site){ - #creates an empty table with the original table's columns, plus the hellinger values + #creates an empty table with the original table's columns, plus the percentage values #i'm aware this is incredibly hacky, but i couldn't find a better way - results <- data %>% - cbind(percentage = c(1:nrow(data))) %>% - filter(col == "bad programming") + results <- filter(cbind(data, hellinger_trans_vals = c(1:nrow(data))), col == "hack") #finds values for each site unique_sites <- unique(data[[site]]) for(s in unique_sites){ diff --git a/inst/doc/STARSmanual.ltx b/inst/doc/STARSmanual.ltx index d38f6e6..104aa3e 100644 --- a/inst/doc/STARSmanual.ltx +++ b/inst/doc/STARSmanual.ltx @@ -7,7 +7,7 @@ \usepackage{graphicx} \usepackage{caption} -\title{\texttt{rshift} STARS manual - regime shift analysis for paleoecological data\\v2.2.1} +\title{\texttt{rshift} STARS manual - regime shift analysis for paleoecological data\\v2.2.2} \author{A. H. Room, F. Franco-Gaviria, D. H. Urrego} diff --git a/inst/doc/STARSmanual.pdf b/inst/doc/STARSmanual.pdf index 70e3586..fa640d3 100644 Binary files a/inst/doc/STARSmanual.pdf and b/inst/doc/STARSmanual.pdf differ diff --git a/src/Makevars b/src/Makevars index a5ba75f..9c03bd9 100644 --- a/src/Makevars +++ b/src/Makevars @@ -2,6 +2,8 @@ LIBDIR = rust/target/release STATLIB = $(LIBDIR)/librshift.a PKG_CFLAGS = -pthread PKG_LIBS = -L$(LIBDIR) -lrshift -lresolv -pthread +CARGOTMP=$(PWD)/.cargo +export CARGO_HOME=$(CARGOTMP) #all: clean @@ -9,10 +11,14 @@ $(SHLIB): $(STATLIB) $(STATLIB): $(TAR) --extract --xz -f ./rust/vendor.tar.xz -C . && \ - mkdir -p ./.cargo && \ - cp ./rust/cargo_vendor_config.toml ./.cargo/config.toml; \ + mkdir -p $(CARGO_HOME) && \ + cp ./rust/cargo_vendor_config.toml $(CARGO_HOME)/config.toml; \ + # To comply with CRAN policy the versions of cargo and rustc + # need to be inlcuded in the installation log + echo `cargo --version` && echo `rustc --version` PATH="${PATH}:${HOME}/.cargo/bin" cargo build -j 2 --release --offline --manifest-path=rust/Cargo.toml rm -Rf $(LIBDIR)/build || true + rm -Rf $(CARGO_HOME) || true clean: rm -Rf $(SHLIB) $(STATLIB) $(OBJECTS) rust/target diff --git a/src/Makevars.win b/src/Makevars.win index 788e13d..7ae8f09 100644 --- a/src/Makevars.win +++ b/src/Makevars.win @@ -10,9 +10,13 @@ $(SHLIB): $(STATLIB) $(STATLIB): $(TAR) --extract --xz -f ./rust/vendor.tar.xz -C . && \ mkdir -p ./.cargo && \ - cp ./rust/cargo_vendor_config.toml ./.cargo/config.toml; \ + cp ./rust/cargo_vendor_config.toml ./.cargo/config.toml; + # To comply with CRAN policy the versions of cargo and rustc + # need to be inlcuded in the installation log + echo `cargo --version` && echo `rustc --version` PATH="$(USERPROFILE)\.cargo\bin:$(PATH)" cargo build --target=$(TARGET) -j 2 --offline --release --manifest-path=rust/Cargo.toml rm -Rf $(LIBDIR)/build || true + rm -Rf ./.cargo || true C_clean: rm -Rf $(SHLIB) $(STATLIB) $(OBJECTS) diff --git a/src/rust/Cargo.toml b/src/rust/Cargo.toml index 1e1ddef..43a5ff6 100644 --- a/src/rust/Cargo.toml +++ b/src/rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = 'rshift' -version = '2.2.1' +version = '2.2.2' edition = '2021' [lib] diff --git a/vignettes/STARSmanual.ltx b/vignettes/STARSmanual.ltx index d38f6e6..104aa3e 100644 --- a/vignettes/STARSmanual.ltx +++ b/vignettes/STARSmanual.ltx @@ -7,7 +7,7 @@ \usepackage{graphicx} \usepackage{caption} -\title{\texttt{rshift} STARS manual - regime shift analysis for paleoecological data\\v2.2.1} +\title{\texttt{rshift} STARS manual - regime shift analysis for paleoecological data\\v2.2.2} \author{A. H. Room, F. Franco-Gaviria, D. H. Urrego}