Description Usage Arguments Value Author(s) References See Also Examples
convert saved data sets' names in to a vector based on the order of numbers, which will be called by batch.read() function
1 | convert.filenames(folder)
|
folder |
the folder that stored all the model outputs, not a detailed filename |
return a vector for each member is a path pointed to a filename (a model output), which can be called by batch.read() function
Youhua Chen <yhchen@zoology.ubc.ca>
Chen YH (2012) coexist: an R package for performing species coexistence modeling and analysis under asymmetric dispersal and fluctuating source-sink dynamics. http://code.google.com/p/coexist.
read.data
,
batch.read
,
read.patchdata
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (folder)
{
files <- list.files(path = folder, full.names = TRUE)
newf <- vector()
fnum <- length(files)
length(newf) <- fnum
dataorder <- rep(0, 1, fnum)
for (i in 1:fnum) {
pos.end <- unlist(gregexpr("00yh", files[i]))[1] - 1
pos.start <- unlist(gregexpr(paste(folder, "/out", sep = ""),
files[i]))[1] + 15
dataorder[i] <- as.numeric(substr(files[i], pos.start,
pos.end))
}
for (i in 1:fnum) {
newf[dataorder[i]] <- files[i]
}
newf <- newf[!is.na(newf)]
return(newf)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.