#' Extracts row names and filters based on columns
#'
#' @param data data
#' @param transpose should data frame be transposed
#' @param save should vector be saved
#' @param name name to be saved as
#' @param destination where to save
#' @param return should vector be returned
#'
#' @return
#' @export
#'
#'
extractRownames <- function(data, transpose, save = T, name, destination = "dat", return = F) {
if(!hasArg(data)) {
data <- getData()
}
data <- transposeData(data, transpose = transpose)
rownames <- rep(T, nrow(data))
message(paste(sum(rownames), "row names in total."))
more <- T
while(more) {
column <- whatToDo("Which column should be used for filtering?", colnames(data))
lower <- ok("Is this a lower limit?")
threshold <- getNumber("Threshold: ")
if(lower) {
rownames <- combineAND(rownames, data[, column] > threshold)
}
else {
rownames <- combineAND(rownames, data[, column] < threshold)
}
message(paste(sum(rownames), "row names after filtering."))
more <- ok("Another filtering step?")
}
if(save) {
saveThis(rownames(data)[rownames], name = name, destination = destination)
}
if(return) {
rownames(data)[rownames]
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.