Re: [R] Question about user define function

From: Allan Engelhardt <>
Date: Wed, 16 Jun 2010 16:41:41 +0100

On 15/06/10 21:39, GL wrote:
> Have the following function that is called by the statement below. Trying to
> return the two dataframes, but instead get one large list including both
> tables.
> ReadInputDataFrames<- function() {
> dbs.this= read.delim("this.txt", header = TRUE, sep = "\t", quote="\"",
> dec=".")
> dbs.that= read.delim("that.txt", header = TRUE, sep = "\t", quote="\"",
> dec=".")
> c(this= dbs.this,patdb = dbs.that)

If you really want to return "two dataframes", then

return(list(this = dbs.this, that = dbs.that))

More likely, you want to return all the data in one dataframe. If they have the same structure (columns and column names) then you want

return(rbind(dbs.this, dbs,that))

If you want something else, provide an example.

Hope this helps a little.

Allan mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Wed 16 Jun 2010 - 15:44:09 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 16 Jun 2010 - 16:00:31 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive