Learn R Programming

coexist (version 1.0)

batch.read: batch read different file data based on the order 1,2,3,4,5,6... in a folder

Description

batch version of read.data() function, can read all the files in a folder

Usage

batch.read(path, index = NULL, spnum = 2, islandnum = 10)

Arguments

path
a vector recording all the files in a folder, which can be generated by convert.filenames() function
index
local fielname/path for recording all the parameter combination index matrix generated from make.parcomb() function
spnum
species number in the model, default is 2
islandnum
patch number in the model,default is 10

Details

return a list of data, each list member represents a model output

References

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.

See Also

read.data, read.patchdata, make.parcomb

Examples

Run this code
##---- 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 (path = pathvector, index = NULL, spnum = 2, islandnum = 10) 
{
    num <- length(path)
    outlist <- list()
    length(outlist) <- num
    if (length(index) == 0) {
        for (i in 1:num) {
            outlist[[i]] <- read.patchdata(path = path[i], spnum = spnum, 
                islandnum = islandnum)
        }
    }
    if (length(index) != 0) {
        for (i in 1:num) {
            outlist[[i]] <- read.data(path = path[i], index = index, 
                spnum = spnum, islandnum = islandnum)
        }
    }
    return(outlist)
  }

Run the code above in your browser using DataLab