[R] Question about user define function

David Winsemius dwinsemius at comcast.net
Tue Jun 15 22:54:29 CEST 2010


On Jun 15, 2010, at 4:39 PM, 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=".")

## Possible that you want to cbind() them rather than c() them

>  cbind(this= dbs.this,patdb = dbs.that)
>
> }

Which would require that they have the same number of columns and  
possibly that the column names match up.

?cbind


>
> Called by:
>
> c <- ReadInputDataFrames()
>
> Results:
>
> str(c) yields a list of 106 items $this.variabe1..53, $that 
> $variable1..53
>

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list