Skip to content

Commit

Permalink
dplyr 1.0.0 compatibility updates (#146)
Browse files Browse the repository at this point in the history
* Using packrat

* Roxygen update

* Update drop_na_rows implementation for data.frame

* src_sqlite is deprecated

* New expect_that behavior

* New expect that behavior

* rebuild docs

* rebuild docs

* styler

* remove names

* Coerce to data.frame
  • Loading branch information
shntnu authored May 9, 2020
1 parent c563f85 commit de4b433
Show file tree
Hide file tree
Showing 46 changed files with 171 additions and 93 deletions.
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@
^LICENSE.md$
^CONTRIBUTING.md$
^CRAN-RELEASE$
^packrat/
^\.Rprofile$
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
.Rhistory
.RData
inst/doc
packrat/lib*/
packrat
.Rprofile
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ Suggests:
VignetteBuilder: knitr
URL: https://github.com/cytomining/cytominer
BugReports: https://github.com/cytomining/cytominer/issues
RoxygenNote: 6.1.1
RoxygenNote: 7.1.0
17 changes: 9 additions & 8 deletions R/drop_na_rows.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
utils::globalVariables(c("key", "value", "rowname_temp", "coalesce"))
#' Drop rows that are \code{NA} in all variables.
utils::globalVariables(c("key", "value", "rowname_temp", "rowid", "coalesce"))
#' Drop rows that are \code{NA} in all specified variables.
#'
#' \code{drop_na_rows} drops rows that are \code{NA} in all variables.
#' \code{drop_na_rows} drops rows that are \code{NA} in all specified variables.
#'
#' @param population tbl with grouping (metadata) and observation variables.
#' @param variables character vector specifying observation variables.
#'
#' @return \code{population} without rows that have \code{NA} in all variables.
#' @return \code{population} without rows that have \code{NA} in all specified variables.
#'
#' @examples
#' population <- tibble::tibble(
Expand All @@ -26,11 +26,12 @@ utils::globalVariables(c("key", "value", "rowname_temp", "coalesce"))
drop_na_rows <- function(population, variables) {
if (is.data.frame(population)) {
population %>%
tibble::rownames_to_column(., var = "rowname_temp") %>%
tidyr::gather(key, value, variables) %>%
tibble::rowid_to_column() %>%
tidyr::pivot_longer(variables) %>%
dplyr::filter(!is.na(value)) %>%
tidyr::spread(key, value) %>%
dplyr::select(-rowname_temp)
tidyr::pivot_wider(names_from = "name", values_from = "value") %>%
dplyr::select(-rowid) %>%
dplyr::select(names(population))
} else {

# Coalesce() must have at least 2 arguments.
Expand Down
2 changes: 1 addition & 1 deletion R/extract_subpopulations.R
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ extract_subpopulations <-
as.matrix())[1, 2]
}

data %<>% dplyr::mutate(cluster_id = kmeans_output$cluster)
data %<>% dplyr::mutate(cluster_id = unname(kmeans_output$cluster))
data %<>%
dplyr::bind_cols(
purrr::map_df(
Expand Down
2 changes: 1 addition & 1 deletion docs/404.html

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

2 changes: 1 addition & 1 deletion docs/CONTRIBUTING.html

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

2 changes: 1 addition & 1 deletion docs/LICENSE-text.html

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

2 changes: 1 addition & 1 deletion docs/LICENSE.html

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

10 changes: 5 additions & 5 deletions docs/articles/cytominer-pipeline.html

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

2 changes: 1 addition & 1 deletion docs/articles/index.html

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

2 changes: 1 addition & 1 deletion docs/authors.html

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

2 changes: 1 addition & 1 deletion docs/index.html

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

2 changes: 1 addition & 1 deletion docs/news/index.html

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

4 changes: 2 additions & 2 deletions docs/pkgdown.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pandoc: 2.9.2.1
pkgdown: 1.5.1
pkgdown: 1.5.0
pkgdown_sha: ~
articles:
cytominer-pipeline: cytominer-pipeline.html
last_built: 2020-04-29T02:38Z
last_built: 2020-05-08T23:08Z

12 changes: 9 additions & 3 deletions docs/reference/aggregate.html

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

5 changes: 2 additions & 3 deletions docs/reference/correlation_threshold.html

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

2 changes: 1 addition & 1 deletion docs/reference/count_na_rows.html

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

2 changes: 1 addition & 1 deletion docs/reference/covariance.html

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

2 changes: 1 addition & 1 deletion docs/reference/drop_na_columns.html

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

14 changes: 7 additions & 7 deletions docs/reference/drop_na_rows.html

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

2 changes: 1 addition & 1 deletion docs/reference/extract_subpopulations.html

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

2 changes: 1 addition & 1 deletion docs/reference/generalized_log.html

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

2 changes: 1 addition & 1 deletion docs/reference/generate_component_matrix.html

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

4 changes: 2 additions & 2 deletions docs/reference/index.html

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

12 changes: 9 additions & 3 deletions docs/reference/normalize.html

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

Loading

0 comments on commit de4b433

Please sign in to comment.