mirror of
https://github.com/agdamsbo/FreesearchR.git
synced 2026-06-19 04:27:30 +02:00
new completeness filter, analyses have been split, correlation plot included.
This commit is contained in:
parent
f728bb1e8e
commit
b268b90aae
17 changed files with 10547 additions and 2479 deletions
17
R/helpers.R
17
R/helpers.R
|
|
@ -249,3 +249,20 @@ remove_na_attr <- function(data,attr="label"){
|
|||
|
||||
dplyr::bind_cols(out)
|
||||
}
|
||||
|
||||
#' Removes columns with completenes below cutoff
|
||||
#'
|
||||
#' @param data data frame
|
||||
#' @param cutoff numeric
|
||||
#'
|
||||
#' @returns data frame
|
||||
#' @export
|
||||
#'
|
||||
#' @examples
|
||||
#'data.frame(a=1:10,b=NA, c=c(2,NA)) |> remove_empty_cols(cutoff=.5)
|
||||
remove_empty_cols <- function(data,cutoff=.7){
|
||||
filter <- apply(X = data,MARGIN = 2,FUN = \(.x){
|
||||
sum(as.numeric(!is.na(.x)))/length(.x)
|
||||
}) >= cutoff
|
||||
data[filter]
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue