R/process_aic.R

Defines functions process_aic

Documented in process_aic

#' Function to process AIC and LL values
#' 
#' Function to process AIC and LL values
#' 
#' @param filename Name of file
#' @param dir Path to directory
#' @export

process_aic <- function(filename, dir = "/Volumes/udrive/"){
browser()    
  #load coefficients
  load(paste0(dir, filename))

  #Add coefficient variable column
  # coefs <- lapply(coefs, FUN = function(xx) {
  #   xx$coef <- row.names(xx)
  #   return(xx)
  # })

  # #melt the lists
  # coefs1 <- melt(coefs, id.vars = c('coefs', 'p_values', 'significance', 'coef'))
  # coefs1 <- plyr::rename(coefs1, c("L1" = "port"))
  # coefs1 <- plyr::rename(coefs1, c('coefs' = 'value'))  

  # #Parse filename and add details in to coefs1
  # filename_args <- unlist(strsplit(filename, split = "_"))
  # coefs1$price_multiplier <- gsub("coefs", "", filename_args[1])
  # coefs1$year <- gsub("focyr", "", filename_args[4])
  # coefs1$hdist <- gsub("hdist", "", filename_args[8])
  # coefs1$spp <- gsub("qspecies", "", filename_args[10])
  # coefs1$spp <- gsub('.Rdata', "", coefs1$spp)  
  # return(coefs1)
}

#Test function
# process_coefficients(filename = udrive_files[grep('coefs5_', udrive_files)][1])
peterkuriyama/ch4 documentation built on June 18, 2021, 9:59 a.m.