How to pass extra argument to the function argument of do.call in R

r

Solution

do.call(rbind.data.frame, c(list(iris), list(iris), stringsAsFactors=FALSE))

would have been my answer, if it wasn't for the fact that `rbind` does not know what to do with `stringsAsFactors` (but `cbind.data.frame` would).

The output of `strsplit` is presumably a list of vectors, in which case `rbind` creates a matrix. You can specify `stringsAsFactors` when converting this matrix to a data.frame,

data.frame(do.call(rbind, list(1:10, letters[1:10])), stringsAsFactors=FALSE)

Problem

I'd like to pass argument (`stringsAsFactors=FALSE`) to `rbind` in `do.call`. But the following doesn't work: ``` data <- do.call(rbind, strsplit(readLines("/home/jianfezhang/adoption.txt"), split="\t#\t"), args=list(stringsAsFactors=FALSE)) ```

Original source