s-news
[Top] [All Lists]

Re: functions with two results

To: "Dakin, Jonathan" <j.dakin@ic.ac.uk>
Subject: Re: functions with two results
From: John Fox <jfox@mcmaster.ca>
Date: Mon, 28 Oct 2002 12:09:20 -0500
Cc: s-news@lists.biostat.wustl.edu
In-reply-to: <2AD55759A5B6D611BBEE009027DE796119794B@icex2.cc.ic.ac.uk>
Dear Jonathan,

At 03:46 PM 10/28/2002 +0000, Dakin, Jonathan wrote:
Could anyone tell me the best way (or any way) to retrieve the output of a
user-defined function, when it generates two data frames ?

(The function splits one large dataset into inliers and outliers according
to a dataframe of values passed as a second parameter.)

I'm using splus 6.0 professional release 2 under W2K.

I think that the natural thing to do is to have your function return a list of the two data frames, list(inliers, outliers), which, when assigned to a variable, say result <- fun(x, p), then could be indexed as result$inliers, result$outliers, or as result[[1]], result[[2]].

Does that give you what you want?

John


____________________________
John Fox
Department of Sociology
McMaster University
email: jfox@mcmaster.ca
web: http://www.socsci.mcmaster.ca/jfox
____________________________


<Prev in Thread] Current Thread [Next in Thread>