# Stitch together results from multi run into one file for Tun Mustapha Park Fishery model # #Supplementary file for: # Christopher J. Brown, Crow White, Maria Beger, Hedley S. Grantham, Benjamin S. Halpern, Carissa J. Klein, Peter J. Mumby, Vivitskaia J.D. Tulloch, Mary Ruckelshaus and Hugh P. Possingham. Fisheries and biodiversity benefits of using static versus dynamic models for designing marine reserve networks. Ecosphere # # CJ Brown 13 Jan 2014 setwd('mydir/Mod_TMP/results') runname = 'base' cnm = 'constargvals' ftypes = c('naivesave','statsave','dynsave') scnrnames = c('bhigh_long','bhigh_short','bopt_long','bopt_short') ntypes = length(ftypes) nscnrs = length(scnrnames) CTV = read.csv(paste(cnm,'_',scnrnames[1],'.csv',sep=''), header = F) colname = rep(NA, nscnrs*ntypes) colname[1] = cnm ressave = matrix(NA, nrow = nrow(CTV), ncol = 1+nscnrs*ntypes) ressave[,1] = CTV[[1]] k = 1 for (i in 1:nscnrs){ for (j in 1:ntypes){ k = k+1 thisfl = paste(ftypes[j],'_',scnrnames[i],'.csv',sep='') dat <- read.csv(thisfl, header = F) ressave[,k] = dat[,1] colname[k] = paste(ftypes[j],'_',scnrnames[i], sep='') } } colnames(ressave) = colname write.csv(ressave, paste('results_', runname, '.csv', sep =''),row.names=F)