| To: | <s-news@lists.biostat.wustl.edu> |
|---|---|
| Subject: | Re: R to S conversion of lexical scoping function |
| From: | "Joshua Betcher" <jb7gv@virginia.edu> |
| Date: | Fri, 10 May 2002 10:36:21 -0400 |
Bill Dunlap Wrote:
Using sys.parent() might be the easiest way here. However another way
is
to use substitute():
fc <- substitute(function(y)f.fc(x,y), list(f.fc=f))
The function this creates looks odd, e.g, for f<-function(x,y)x/y, fc is
fc <- function(y) (function(x, y) x/y)(x, y)
but fc calls the value of f, not f itself.
Another answer, which is less general, Josh Betcher found to be:
fc <- function(x=NULL,y=NULL,f) f(x,y)
apply(exprs(object), 1, fc, f = f, x = object@phenoData@pData[[covlab]])
Thanks for everyones help,
Josh
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | percentile smoother, Zeynep Kalaylioglu |
|---|---|
| Next by Date: | Write.table, Park, Kyong H Mr. SBCCOM |
| Previous by Thread: | R to S conversion of lexical scoping function, Joshua Betcher |
| Next by Thread: | Dr. Frank Harrell, Jr. presenting two S-PLUS courses in D.C., kkelly |
| Indexes: | [Date] [Thread] [Top] [All Lists] |