R/calculate_cell_growth.R

Defines functions calculate_cell_growth

Documented in calculate_cell_growth

#' Get growth rate from cell numbers and time
#'
#' @param cell_no,timepoints
#' @keywords Cells
#' @export
#' @examples
#' calculate_cell_growth()

calculate_cell_growth <- function(cell_no,timepoints){
  # This function is to calculate growth rate from cell numbers and hours
  if(length(cell_no) != length(timepoints)){
    print('No of cells and timepoints dont match, try again stupid...')
    slope <- c()
  } else {
    GROWTH <- timepoints # This is for the beauty of the output solely....
    log_vals <- log(cell_no)
    slope <- coef(lm(log_vals ~ GROWTH))[2]
  }
  return(slope)
}
siggitrausti/siggitRausti documentation built on Sept. 9, 2020, 3:36 p.m.