Skip to content

Commit

Permalink
Removed non-ASCII characters as per message from CRAN
Browse files Browse the repository at this point in the history
  • Loading branch information
jonesor committed Oct 15, 2024
1 parent eb6cc60 commit b316aca
Show file tree
Hide file tree
Showing 17 changed files with 93 additions and 27 deletions.
2 changes: 1 addition & 1 deletion R/cdb_check_species.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#'
#' @author Danny Buss <dlb50@@cam.ac.uk>
#' @author Owen R. Jones <jones@@biology.sdu.dk>
#' @author Rob Salguero-Gómez <rob.salguero@@zoo.ox.ac.uk>
#' @author Rob Salguero-Gomez <rob.salguero@@zoo.ox.ac.uk>
#' @author Patrick Barks <patrick.barks@@gmail.com>
#'
#' @family data checking
Expand Down
2 changes: 1 addition & 1 deletion R/cdb_metadata.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#'
#' @return Tibble with all metadata columns of \code{cdb}
#'
#' @author Gesa Römer <gesa.roemer@@gmail.com>
#' @author Gesa Romer <gesa.roemer@@gmail.com>
#'
#' @family data acquisition
#'
Expand Down
2 changes: 1 addition & 1 deletion R/mpm_elementwise_apply.R
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,4 @@ mpm_elementwise_apply <- function(x, fun, na_handling = "stop", ...) {
matC = summaryC,
matrixClass = x[[1]]@matrixClass
)
}
}
2 changes: 1 addition & 1 deletion R/mpm_median.R
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,4 @@ mpm_median <- function(x, na.rm = FALSE) {
matC = medianC,
matrixClass = x[[1]]@matrixClass
)
}
}
4 changes: 2 additions & 2 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ knitr::opts_chunk$set(
| Project | Main branch | Devel branch |
|---------|:------------|:--------------|
| [![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0.html) | [![R-CMD-check](https://github.com/jonesor/Rcompadre/actions/workflows/main_check.yaml/badge.svg)](https://github.com/jonesor/Rcompadre/actions/workflows/main_check.yaml) | [![R-CMD-check](https://github.com/jonesor/Rcompadre/actions/workflows/devel_build_check.yaml/badge.svg)](https://github.com/jonesor/Rcompadre/actions/workflows/devel_build_check.yaml) |
| [![Project Status: Active The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active) | [![codecov](https://codecov.io/gh/jonesor/Rcompadre/branch/main/graph/badge.svg?token=S9G2a5K9k9)](https://app.codecov.io/gh/jonesor/Rcompadre) | |
| [![Project Status: Active - The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active) | [![codecov](https://codecov.io/gh/jonesor/Rcompadre/branch/main/graph/badge.svg?token=S9G2a5K9k9)](https://app.codecov.io/gh/jonesor/Rcompadre) | |
| ![](http://cranlogs.r-pkg.org/badges/grand-total/Rcompadre) |[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/Rcompadre)](https://cran.r-project.org/package=Rcompadre)|
| ![](http://cranlogs.r-pkg.org/badges/Rcompadre)| | |

Expand Down Expand Up @@ -136,7 +136,7 @@ See the Changelog for more details.

## Citation

Jones, Owen R., Patrick Barks, Iain M. Stott, Tamora D. James, Sam C. Levin, William K. Petry, Pol Capdevila, et al. 2022. Rcompadre and Rage -- Two R Packages to Facilitate the Use of the COMPADRE and COMADRE Databases and Calculation of Life History Traits from Matrix Population Models. _Methods in Ecology and Evolution_. doi: [10.1111/2041-210X.13792](https://doi.org/10.1111/2041-210X.13792).
Jones, Owen R., Patrick Barks, Iain M. Stott, Tamora D. James, Sam C. Levin, William K. Petry, Pol Capdevila, et al. 2022. "Rcompadre and Rage -- Two R Packages to Facilitate the Use of the COMPADRE and COMADRE Databases and Calculation of Life History Traits from Matrix Population Models." _Methods in Ecology and Evolution_. doi: [10.1111/2041-210X.13792](https://doi.org/10.1111/2041-210X.13792).

## Contributions

Expand Down
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
| Project | Main branch | Devel branch |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0.html) | [![R-CMD-check](https://github.com/jonesor/Rcompadre/actions/workflows/main_check.yaml/badge.svg)](https://github.com/jonesor/Rcompadre/actions/workflows/main_check.yaml) | [![R-CMD-check](https://github.com/jonesor/Rcompadre/actions/workflows/devel_build_check.yaml/badge.svg)](https://github.com/jonesor/Rcompadre/actions/workflows/devel_build_check.yaml) |
| [![Project Status: Active The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active) | [![codecov](https://codecov.io/gh/jonesor/Rcompadre/branch/main/graph/badge.svg?token=S9G2a5K9k9)](https://app.codecov.io/gh/jonesor/Rcompadre) | |
| [![Project Status: Active - The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active) | [![codecov](https://codecov.io/gh/jonesor/Rcompadre/branch/main/graph/badge.svg?token=S9G2a5K9k9)](https://app.codecov.io/gh/jonesor/Rcompadre) | |
| ![](http://cranlogs.r-pkg.org/badges/grand-total/Rcompadre) | [![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/Rcompadre)](https://cran.r-project.org/package=Rcompadre) | |
| ![](http://cranlogs.r-pkg.org/badges/Rcompadre) | | |

Expand Down Expand Up @@ -91,18 +91,18 @@ filter(compadre, SpeciesAccepted == "Echinacea angustifolia")

#### Example analysis: calculating population growth rates

First well use the function `cdb_flag()` to add columns to the database
First we'll use the function `cdb_flag()` to add columns to the database
flagging potential issues with the projection matrices, such as missing
values, or matrices that dont meet assumptions like ergodicity,
values, or matrices that don't meet assumptions like ergodicity,
irreducibility, or primitivity.

``` r
compadre_flags <- cdb_flag(compadre)
```

Well only be able to calculate population growth rates from matrices
that dont contain missing values, and we only want to use matrices that
meet the assumption of ergodicity, so well subset the database
We'll only be able to calculate population growth rates from matrices
that don't contain missing values, and we only want to use matrices that
meet the assumption of ergodicity, so we'll subset the database
accordingly.

``` r
Expand All @@ -112,7 +112,7 @@ compadre_sub <- subset(
)
```

Finally, well use the `eigs()` function from the
Finally, we'll use the `eigs()` function from the
[popdemo](https://CRAN.R-project.org/package=popdemo) package to
calculate the population growth rate for every matrix in `compadre_sub`.

Expand Down Expand Up @@ -142,10 +142,10 @@ See the Changelog for more details.
## Citation

Jones, Owen R., Patrick Barks, Iain M. Stott, Tamora D. James, Sam C.
Levin, William K. Petry, Pol Capdevila, et al. 2022. Rcompadre and Rage
Two R Packages to Facilitate the Use of the COMPADRE and COMADRE
Levin, William K. Petry, Pol Capdevila, et al. 2022. "Rcompadre and Rage
- Two R Packages to Facilitate the Use of the COMPADRE and COMADRE
Databases and Calculation of Life History Traits from Matrix Population
Models. *Methods in Ecology and Evolution*. doi:
Models." *Methods in Ecology and Evolution*. doi:
[10.1111/2041-210X.13792](https://doi.org/10.1111/2041-210X.13792).

## Contributions
Expand All @@ -161,7 +161,7 @@ There are numerous ways of contributing.
issue](https://github.com/jonesor/Rcompadre/issues).

2. You can copy or fork the repository, make your own code edits and
then send us a pull request. [Heres how to do
then send us a pull request. [Here's how to do
that](https://jarv.is/notes/how-to-pull-request-fork-github/).

3. You can get to know us and join as a collaborator on the main
Expand Down
2 changes: 1 addition & 1 deletion cran-comments.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@
❯ checking HTML version of manual ... NOTE
Skipping checking HTML validation: no command 'tidy' found

0 errors ✔ | 0 warnings ✔ | 1 note ✖
0 errors ✔ | 0 warnings ✔ | 1 note ✖
66 changes: 66 additions & 0 deletions data-raw/ConvertASCII.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
library(Rcompadre)

#COMPADRE -----
# Create a copy of Compadre to store the corrected version
Compadre2 <- Compadre

# Loop through all columns in Compadre
for (col_name in names(Compadre)) {
# Check if the column is of character type (since non-ASCII makes sense only for character columns)
if (is.character(Compadre[[col_name]])) {
# Find non-ASCII characters in the current column
nonASCII <- tools::showNonASCII(Compadre[[col_name]])

# If there are non-ASCII characters, replace them with ASCII equivalents
if (length(nonASCII) > 0) {
Compadre2[[col_name]] <- stringi::stri_trans_general(Compadre[[col_name]], "latin-ascii")
}
}
}

#COMADRE -----
# Create a copy of Comadre to store the corrected version
Comadre2 <- Comadre

# Loop through all columns in Comadre
for (col_name in names(Comadre)) {
# Check if the column is of character type (since non-ASCII makes sense only for character columns)
if (is.character(Comadre[[col_name]])) {
# Find non-ASCII characters in the current column
nonASCII <- tools::showNonASCII(Comadre[[col_name]])

# If there are non-ASCII characters, replace them with ASCII equivalents
if (length(nonASCII) > 0) {
Comadre2[[col_name]] <- stringi::stri_trans_general(Comadre[[col_name]], "latin-ascii")
}
}
}

#COMPADRE LEGACY -----
# Create a copy of Comadre to store the corrected version
CompadreLegacy2 <- CompadreLegacy

# Loop through all columns in Comadre
for (col_name in names(CompadreLegacy)) {
# Check if the column is of character type (since non-ASCII makes sense only for character columns)
if (is.character(CompadreLegacy[[col_name]])) {
# Find non-ASCII characters in the current column
nonASCII <- tools::showNonASCII(CompadreLegacy[[col_name]])

# If there are non-ASCII characters, replace them with ASCII equivalents
if (length(nonASCII) > 0) {
CompadreLegacy2[[col_name]] <- stringi::stri_trans_general(CompadreLegacy[[col_name]], "latin-ascii")
}
}
}


Compadre <- Compadre2
Comadre <- Comadre2
CompadreLegacy <- CompadreLegacy2

usethis::use_data(Comadre,
Compadre,
CompadreLegacy,
overwrite = TRUE
)
Binary file modified data/Comadre.rda
Binary file not shown.
Binary file modified data/Compadre.rda
Binary file not shown.
Binary file modified data/CompadreLegacy.rda
Binary file not shown.
2 changes: 1 addition & 1 deletion man/Rcompadre-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/cdb_check_species.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/cdb_metadata.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions vignettes/a01_GettingStarted.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,6 @@ hist(lambdaVals, main = "Lambda values")

Caswell, H. (2001). Matrix Population Models: Construction, Analysis, and Interpretation. 2nd edition. Sinauer Associates, Sunderland, MA. ISBN-10: 0878930965

Salguero‐Gómez, R. , Jones, O. R., Archer, C. R., Buckley, Y. M., CheCastaldo, J. , Caswell, H. , Hodgson, D. , Scheuerlein, A. , Conde, D. A., Brinks, E. , Buhr, H. , Farack, C. , Gottschalk, F. , Hartmann, A. , Henning, A. , Hoppe, G. , Römer, G. , Runge, J. , Ruoff, T. , Wille, J. , Zeh, S. , Davison, R. , Vieregg, D. , Baudisch, A. , Altwegg, R. , Colchero, F. , Dong, M. , Kroon, H. , Lebreton, J. , Metcalf, C. J., Neel, M. M., Parker, I. M., Takada, T. , Valverde, T. , Vélez‐Espino, L. A., Wardle, G. M., Franco, M. and Vaupel, J. W. (2015), The COMPADRE Plant Matrix Database: an open online repository for plant demography. J Ecol, 103: 202-218. <\doi:10.1111/1365-2745.12334>
Salguero-Gomez, R. , Jones, O. R., Archer, C. R., Buckley, Y. M., Che-Castaldo, J. , Caswell, H. , Hodgson, D. , Scheuerlein, A. , Conde, D. A., Brinks, E. , Buhr, H. , Farack, C. , Gottschalk, F. , Hartmann, A. , Henning, A. , Hoppe, G. , Romer, G. , Runge, J. , Ruoff, T. , Wille, J. , Zeh, S. , Davison, R. , Vieregg, D. , Baudisch, A. , Altwegg, R. , Colchero, F. , Dong, M. , Kroon, H. , Lebreton, J. , Metcalf, C. J., Neel, M. M., Parker, I. M., Takada, T. , Valverde, T. , Velez-Espino, L. A., Wardle, G. M., Franco, M. and Vaupel, J. W. (2015), The COMPADRE Plant Matrix Database: an open online repository for plant demography. J Ecol, 103: 202-218. <\doi:10.1111/1365-2745.12334>

Salguero‐Gómez, R. , Jones, O. R., Archer, C. R., Bein, C. , Buhr, H. , Farack, C. , Gottschalk, F. , Hartmann, A. , Henning, A. , Hoppe, G. , Römer, G. , Ruoff, T. , Sommer, V. , Wille, J. , Voigt, J. , Zeh, S. , Vieregg, D. , Buckley, Y. M., CheCastaldo, J. , Hodgson, D. , Scheuerlein, A. , Caswell, H. and Vaupel, J. W. (2016), COMADRE: a global data base of animal demography. J Anim Ecol, 85: 371-384. <\doi:10.1111/1365-2656.12482>
Salguero-Gomez, R. , Jones, O. R., Archer, C. R., Bein, C. , Buhr, H. , Farack, C. , Gottschalk, F. , Hartmann, A. , Henning, A. , Hoppe, G. , Romer, G. , Ruoff, T. , Sommer, V. , Wille, J. , Voigt, J. , Zeh, S. , Vieregg, D. , Buckley, Y. M., Che-Castaldo, J. , Hodgson, D. , Scheuerlein, A. , Caswell, H. and Vaupel, J. W. (2016), COMADRE: a global data base of animal demography. J Anim Ecol, 85: 371-384. <\doi:10.1111/1365-2656.12482>
2 changes: 1 addition & 1 deletion vignettes/a03_VectorisingRcompadre.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ knitr::opts_chunk$set(dev = "png", dev.args = list(type = "cairo-png"))

COM(P)ADRE databases contain thousands of matrix population models. If we want to derive traits from a large set of these matrices, we'll need to use either loops or vectorisation.

Vectorising means applying a function to each element of a vector. Here vector is defined broadly it could be a sequence of character strings, a column of a `data.frame`, a `list` of matrices, etc. Vectorised code generally runs faster than loops, and many R users find that vectorised code is easier to write and understand.
Vectorising means applying a function to each element of a vector. Here vector is defined broadly - it could be a sequence of character strings, a column of a `data.frame`, a `list` of matrices, etc. Vectorised code generally runs faster than loops, and many R users find that vectorised code is easier to write and understand.

## Preliminaries

Expand Down
Loading

0 comments on commit b316aca

Please sign in to comment.