| To: | splus list <s-news@wubios.wustl.edu> |
|---|---|
| Subject: | SUM:Use of diag() with lapply |
| From: | Alastair Dempster <demp2979@mach1.wlu.ca> |
| Date: | Wed, 25 Apr 2001 12:52:46 -0400 |
| Organization: | Wilfrid Laurier University |
My thanks to Bill Dunlap, Prof. Ripley and Andy Liaw.
Bill Dunlap's response was that "lapply's 2nd argument must be a
function, not a call to a function
or fancier expression". His code was:
new.a <- lapply(a, function(ai){ diag(ai)<-0 ; ai })
Prof. Ripley's answers were the same.
lapply(a, function(x) {diag(x) <- 0; x})
Andy Liaw suggested
lapply(a, function(x) {
diag(x)<-0;return(x)})
This speed of response on this list is amazing!
Alastair Dempster
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Use of diag() with lapply, Alastair Dempster |
|---|---|
| Next by Date: | Re: confidence intervals for proportions (LONG), Chris Evans |
| Previous by Thread: | Use of diag() with lapply, Alastair Dempster |
| Next by Thread: | Re: confidence intervals for proportions (LONG), Chris Evans |
| Indexes: | [Date] [Thread] [Top] [All Lists] |