R/plot_histogram_imputed.R

Defines functions plot_histogram_imputed

Documented in plot_histogram_imputed

#' Plot_histogram
#'
#' @param data_to_be_imputed
#'
#' @return
#' @export
#'
#' @examples
plot_histogram_imputed <- function(data_to_be_imputed,
                                   bins = 30,
                                   combined = FALSE){

    colnames(data_to_be_imputed) <- c('Protein.ID',
                                      'Label',
                                      'Log2 Intensity',
                                      'Imputed')

    p <-  ggplot(data_to_be_imputed, aes( x = `Log2 Intensity`,
                                             fill = Imputed))+
                    geom_histogram(alpha = 0.4,
                                   bins = bins,
                                   position = 'identity')+
                    theme_bw()+
                    ylab('Frequency')+
                    xlab('Log 2  Intensity')+
                    theme(legend.position = 'bottom')+
                    scale_fill_manual(values = c('#246526','red'))

    if (combined == FALSE) {

        p <- p + facet_wrap(.~ Label)
    }
    return(p)
}
BioAlvaro/MQanalyser documentation built on March 18, 2022, 4:32 a.m.