| To: | Steve Su <s.su@qut.edu.au> |
|---|---|
| Subject: | Re: apply functions on several objects all at once. (having strange |
| From: | Sundar Dorai-Raj <sundar.dorai-raj@pdf.com> |
| Date: | Wed, 16 Apr 2003 07:21:19 -0500 |
| Cc: | s-news@lists.biostat.wustl.edu |
| Organization: | PDF Solutions, Inc. |
| References: | <000e01c30402$590ac6b0$2032b583@busaccb337f> |
| User-agent: | Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2) Gecko/20021120 Netscape/7.01 |
Steve Su wrote: Dear All, Is it possible to apply a function on several objects all at once? I have a list of objects with names like Apple.field.1 Apple.field.2 to Apple.field.100 each of the Apple.field.1 is a matrix with 10 columns and 200 rows. Is it possible to do a one line statement to find the colMeans for each of the objects? Thank you for your attention. I am using S+ 6 on Windows 2000.
<unusually long signature snipped>
How about
sapply(lapply(paste("Apple.field",1:100,sep="."),get),colMeans)
This should return a 10 x 100 matrix with each column representing the
colMeans.
Sundar |
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Multiple graphs, Monti, Gustavo |
|---|---|
| Next by Date: | Re: Strange behaviour in background colour in S+6 for Windows, Sundar Dorai-Raj |
| Previous by Thread: | apply functions on several objects all at once. (having strange difficulties to post this message thru), Steve Su |
| Next by Thread: | Multiple graphs, Monti, Gustavo |
| Indexes: | [Date] [Thread] [Top] [All Lists] |