[R] Question about user define function
Allan Engelhardt
allane at cybaea.com
Wed Jun 16 17:41:41 CEST 2010
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
More information about the R-help
mailing list