R/tidy.R

#' Get tidy version of the \code{\link{mutations}} dataset
#'
#' This function was created because saving the tidy version of the dataframe on
#' disk takes up too much room. It is easier to tidy the data during the
#' analysis.
#'
#' @return Tidy version of the \code{\link{mutations}} dataset
#'
#' @seealso \code{\link{tidy_cnvs}}
#'
#' @export
tidy_mutations <- function() {
  mutations %>%
    tidyr::gather(sample, mutation_status, -gene) %>%
    dplyr::select(sample, gene, mutation_status) %>%
    dplyr::mutate(mutation_status = as.integer(mutation_status))
}

#' Get tidy version of the \code{\link{cnvs}} dataset
#'
#' This function was created because saving the tidy version of the dataframe on
#' disk takes up too much room. It is easier to tidy the data during the
#' analysis.
#'
#' @return Tidy version of the \code{\link{cnvs}} dataset
#'
#' @seealso \code{\link{tidy_mutations}}
#'
#' @export
tidy_cnvs <- function() {
  cnvs %>%
    tidyr::gather(sample, cnv_status, -gene) %>%
    dplyr::select(sample, gene, cnv_status)
}
shunsambongi/sambcdata documentation built on May 24, 2019, 5:05 a.m.