diff --git a/CRAN-SUBMISSION b/CRAN-SUBMISSION
new file mode 100644
index 0000000..081f24d
--- /dev/null
+++ b/CRAN-SUBMISSION
@@ -0,0 +1,3 @@
+Version: 0.4.3
+Date: 2023-05-23 19:41:51 UTC
+SHA: 34d8dc8370dc882ca653f25e3833056f5d6907a3
diff --git a/DESCRIPTION b/DESCRIPTION
index 854f6de..a237cbb 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,8 +1,8 @@
Package: matsindf
Type: Package
Title: Matrices in Data Frames
-Version: 0.4.2
-Date: 2023-05-04
+Version: 0.4.3
+Date: 2023-05-23
Authors@R: c(person("Matthew", "Heun", role = c("aut", "cre"),
comment = c(ORCID = "0000-0002-7438-214X"),
email = "matthew.heun@me.com"))
@@ -19,6 +19,7 @@ Depends: R (>= 2.10)
Imports:
assertthat,
dplyr,
+ lifecycle,
magrittr,
matsbyname,
purrr,
diff --git a/NEWS.md b/NEWS.md
index eb8e591..67197d7 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -3,7 +3,18 @@ title: "Release notes for `matsindf`"
output: html_document
---
-# matsindf 0.4.2 (2023-05-04)
+
+# matsindf 0.4.3 (2023-05-23)
+
+* Deprecated `matrix.class` argument.
+ It will be removed soon.
+* Renamed `matrix.class` argument to `matrix_class`.
+* New tests for deprecations.
+ * Now at 376 tests, all passing.
+ * Test coverage remains at 100 %.
+
+
+# matsindf 0.4.2 (2023-05-04) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.7896799.svg)](https://doi.org/10.5281/zenodo.7896799)
* Move to latest version of GitHub test coverage workflow.
* This version not released to CRAN.
diff --git a/R/collapse.R b/R/collapse.R
index f35e4d6..35f05f0 100644
--- a/R/collapse.R
+++ b/R/collapse.R
@@ -57,8 +57,12 @@
#' @param coltypes An optional string identifying the column in `.DF` containing the type of values in columns of the matrices to be created
#' Default is `if ("coltypes" %in% names(.DF)) "rowtypes" else NULL`,
#' so that failure to set the coltypes argument will give `NULL`, as appropriate.
-#' @param matrix.class The type of matrix to be created, one of "matrix" or "Matrix".
-#' Default is "matrix".
+#' @param matrix.class `r lifecycle::badge("deprecated")` Use `matrix_class` instead.
+#' @param matrix_class One of "matrix" or "Matrix".
+#' "matrix" creates a `base::matrix` object with the `matrix()` function.
+#' "Matrix" creates a `Matrix::Matrix` object using the `matsbyname::Matrix()` function.
+#' This could be a sparse matrix.
+#' Default is "matrix".
#'
#' @return A data frame with matrices in the `matvals` column.
#'
@@ -96,8 +100,17 @@
collapse_to_matrices <- function(.DF, matnames = "matnames", matvals = "matvals", rownames = "rownames", colnames = "colnames",
rowtypes = if ("rowtypes" %in% names(.DF)) "rowtypes" else NULL,
coltypes = if ("coltypes" %in% names(.DF)) "coltypes" else NULL,
- matrix.class = c("matrix", "Matrix")) {
- matrix.class <- match.arg(matrix.class)
+ matrix.class = lifecycle::deprecated(),
+ matrix_class = c("matrix", "Matrix")) {
+ if (lifecycle::is_present(matrix.class)) {
+ lifecycle::deprecate_warn(when = "0.4.3",
+ what = "create_matrix_byname(matrix.class)",
+ with = "create_matrix_byname(matrix_class)")
+ matrix_class <- matrix.class
+ }
+
+ matrix_class <- match.arg(matrix_class)
+
# Ensure that none of rownames, colnames, or values is a group variable.
# These can't be in the group variables.
# If they were, we wouldn't be able to summarise them into the matrices.
@@ -130,7 +143,7 @@ collapse_to_matrices <- function(.DF, matnames = "matnames", matvals = "matvals"
# Convert .DF to matrices
"{matvals}" := rowcolval_to_mat(.data, rownames = rownames, colnames = colnames, matvals = matvals,
rowtypes = rowtypes, coltypes = coltypes,
- matrix.class = matrix.class)
+ matrix_class = matrix_class)
) %>%
dplyr::select(!!!dplyr::group_vars(.DF), !!matvals) %>%
data.frame(check.names = FALSE)
diff --git a/R/utilities.R b/R/utilities.R
index a0e99ab..eb08930 100644
--- a/R/utilities.R
+++ b/R/utilities.R
@@ -101,7 +101,11 @@ mat_to_rowcolval <- function(.matrix, matvals = "matvals",
#' @param rowtypes An optional string identifying the types of information found in rows of the matrix to be constructed. Default is "rowtypes".
#' @param coltypes An optional string identifying the types of information found in columns of the matrix to be constructed. Default is "coltypes".
#' @param fill The value for missing entries in the resulting matrix. default is `0`.
-#' @param matrix.class The type of matrix to be created, one of "matrix" or "Matrix".
+#' @param matrix.class `r lifecycle::badge("deprecated")` Use `matrix_class` instead.
+#' @param matrix_class One of "matrix" or "Matrix".
+#' "matrix" creates a `base::matrix` object with the `matrix()` function.
+#' "Matrix" creates a `Matrix::Matrix` object using the `matsbyname::Matrix()` function.
+#' This could be a sparse matrix.
#' Default is "matrix".
#'
#' @return A matrix with named rows and columns and, optionally, row and column types.
@@ -142,8 +146,18 @@ mat_to_rowcolval <- function(.matrix, matvals = "matvals",
rowcolval_to_mat <- function(.DF, matvals = "matvals",
rownames = "rownames", colnames = "colnames",
rowtypes = "rowtypes", coltypes = "coltypes",
- fill = 0, matrix.class = c("matrix", "Matrix")){
- matrix.class <- match.arg(matrix.class)
+ fill = 0,
+ matrix.class = lifecycle::deprecated(),
+ matrix_class = c("matrix", "Matrix")) {
+ if (lifecycle::is_present(matrix.class)) {
+ lifecycle::deprecate_warn(when = "0.4.3",
+ what = "create_matrix_byname(matrix.class)",
+ with = "create_matrix_byname(matrix_class)")
+ matrix_class <- matrix.class
+ }
+
+ matrix_class <- match.arg(matrix_class)
+
if (!is.null(rowtypes)) {
# If rowtype is supplied and is not NA, check if it is one of the columns of .DF
if (rowtypes %in% colnames(.DF)) {
@@ -206,7 +220,7 @@ rowcolval_to_mat <- function(.DF, matvals = "matvals",
tibble::column_to_rownames(var = rownames) %>%
as.matrix() %>%
matsbyname::setrowtype(rowtype = rowtypes) %>% matsbyname::setcoltype(coltype = coltypes)
- if (matrix.class == "Matrix") {
+ if (matrix_class == "Matrix") {
out <- matsbyname::Matrix(out)
}
return(out)
diff --git a/cran-comments.md b/cran-comments.md
index 66eba9a..ea13feb 100644
--- a/cran-comments.md
+++ b/cran-comments.md
@@ -1,73 +1,77 @@
## Context
-`matsindf` v0.4.1 includes a rewrite of `matsindf_apply()`
-to make it easier to debug and maintain.
+`matsindf` v0.4.3 includes a rewrite of `matsindf_apply()`,
+making it easier to debug and maintain.
Better error messages are now available, too.
+Finally, the latest version of the GitHub test coverage workflow
+is now being used.
See `NEWS.md` for details.
## Test environments (12 in total) and R CMD check results
-* local: macOS X 13.3.1 (Ventura), R4.3.0
+* local: macOS X 13.3.1(a) (Ventura), R4.3.0
* errors: 0
* warnings: 0
* notes: 0
* GitHub Actions:
* macOS-latest (release)
- * ERRORs: 0
- * WARNINGs: 0
- * NOTEs: 0
+ * errors: 0
+ * warnings: 0
+ * notes: 0
* ubuntu-latest (devel)
- * ERRORs: 0
- * WARNINGs: 0
- * NOTEs: 0
+ * errors: 0
+ * warnings: 0
+ * notes: 0
* ubuntu-latest (release)
- * ERRORs: 0
- * WARNINGs: 0
- * NOTEs: 0
+ * errors: 0
+ * warnings: 0
+ * notes: 0
* ubuntu-latest (oldrel-1)
- * ERRORs: 0
- * WARNINGs: 0
- * NOTEs: 0
+ * errors: 0
+ * warnings: 0
+ * notes: 0
* windows-latest (release)
- * ERRORs: 0
- * WARNINGs: 0
- * NOTEs: 0
+ * errors: 0
+ * warnings: 0
+ * notes: 0
* Windows (on win-builder):
* `devtools::check_win_release()`, R version 4.3.0 (2023-04-21 ucrt)
- * ERRORs: 0
- * WARNINGs: 0
- * NOTEs: 0
+ * errors: 0
+ * warnings: 0
+ * notes: 0
* `devtools::check_win_oldrelease()`, R version 4.2.3 (2023-03-15 ucrt)
- * ERRORs: 0
- * WARNINGs: 0
- * NOTEs: 0
- * `devtools::check_win_devel()` R Under development (unstable) (2023-04-25 r84327 ucrt)
- * ERRORs: 0
- * WARNINGs: 0
- * NOTEs: 0
+ * errors: 0
+ * warnings: 0
+ * notes: 0
+ * `devtools::check_win_devel()` R Under development (unstable) (2023-05-19 r84451 ucrt)
+ * errors: 0
+ * warnings: 0
+ * notes: 0
* rhub:
* `devtools::check_rhub()`
* Windows Server 2022, R-devel, 64 bit
- * ERRORs: 0
- * WARNINGs: 0
- * NOTEs: 1
+ * errors: 0
+ * warnings: 0
+ * notes: 2
+ - checking for non-standard things in the check directory ... NOTE
+ - Found the following files/directories:
+ - ''NULL''
- checking for detritus in the temp directory ... NOTE
- Found the following files/directories:
- 'lastMiKTeXException'
- - This note appears to be a minor problem with the cleanup process, not caused by the `matsindf` package itself.
- * `devtools::check_rhub()`
+ - These notes appear to be minor problems with the cleanup process, not caused by the `matsindf` package itself.
* Ubuntu Linux 20.04.1 LTS, R-release, GCC
- * ERRORs: 0
- * WARNINGs: 0
- * NOTEs: 1
+ * errors: 0
+ * warnings: 0
+ * notes: 1
- checking HTML version of manual ... NOTE
- Skipping checking HTML validation: no command 'tidy' found
- This NOTE appears to be an anomaly, as it occurs only on rhub.
* Fedora Linux, R-devel, clang, gfortran
- * ERRORs: 0
- * WARNINGs: 0
- * NOTEs: 1
+ * errors: 0
+ * warnings: 0
+ * notes: 1
- checking HTML version of manual ... NOTE
- Skipping checking HTML validation: no command 'tidy' found
- This NOTE appears to be an anomaly, as it occurs only on rhub.
@@ -79,4 +83,3 @@ We checked 1 reverse dependencies, comparing R CMD check results across CRAN and
* We saw 0 new problems
* We failed to check 0 packages
-
diff --git a/docs/404.html b/docs/404.html
index a3cc14e..e0ecf06 100644
--- a/docs/404.html
+++ b/docs/404.html
@@ -24,7 +24,7 @@
matsindf
- 0.4.2
+ 0.4.3