diff --git a/.Rbuildignore b/.Rbuildignore index 6c2c110..252df49 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -9,3 +9,5 @@ ^LICENSE.md$ ^CONTRIBUTING.md$ ^CRAN-RELEASE$ +^packrat/ +^\.Rprofile$ diff --git a/.gitignore b/.gitignore index 09a72cb..e6df00c 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,6 @@ .Rhistory .RData inst/doc +packrat/lib*/ +packrat +.Rprofile diff --git a/DESCRIPTION b/DESCRIPTION index 365d05f..5ddb495 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -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 diff --git a/R/drop_na_rows.R b/R/drop_na_rows.R index 0856f20..6b1804d 100644 --- a/R/drop_na_rows.R +++ b/R/drop_na_rows.R @@ -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( @@ -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. diff --git a/R/extract_subpopulations.R b/R/extract_subpopulations.R index 40424f3..9b7ea12 100644 --- a/R/extract_subpopulations.R +++ b/R/extract_subpopulations.R @@ -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( diff --git a/docs/404.html b/docs/404.html index 9a95554..3a19e6e 100644 --- a/docs/404.html +++ b/docs/404.html @@ -145,7 +145,7 @@
vignettes/cytominer-pipeline.Rmd
cytominer-pipeline.Rmd
ext_metadata <- readr::read_csv(system.file("extdata", "metadata.csv", package = "cytominer")) %>% - dplyr::rename(g_well = Well)