R/prepend_sample_id_max_int_tib.R

#' Prepend a sample ID to a maximum intensity tibble
#'
#' @param tib An intensity tibble generated by 
#' penepma_get_max_total_intensity_z or
#' penepma_get_max_primary_intensity_z.
#'
#' @param sample_id String. A unique sample identifer
#'
#' @return a tibble. The sample_ID will be the first column
#' followed by Symbol, IZ, S0, S1, Int.mu, Int.se, Int.snr
#' 
#' @import dplyr
#' 
#' @export
#' 
prepend_sample_id_max_int_tib <- function(tib, sample_id){
  nr <- nrow(tib)
  sample_id <- rep(sample_id, nr)
  rv <- tibble::add_column(tib, Sample.ID=sample_id) %>%
    # reorder columns
    select(Sample.ID, Symbol, IZ, S0, S1, Int.mu, Int.se, Int.snr)
  return(rv)
}
jrminter/rpemepma documentation built on May 29, 2019, 11:43 a.m.