Re: [R] Is there an variant of apply() that does not return anything?

2009-11-19 Thread Marc Schwartz
On Nov 19, 2009, at 4:31 PM, Peng Yu wrote: On Thu, Nov 19, 2009 at 4:27 PM, Marc Schwartz wrote: On Nov 20, 2009, at 10:21 AM, Peng Yu wrote: There are a few version of apply() (e.g., lapply(), sapply()). I'm wondering if there is one that does not return anything but just silently apply a

Re: [R] Is there an variant of apply() that does not return anything?

2009-11-19 Thread Gabor Grothendieck
On Thu, Nov 19, 2009 at 5:31 PM, Peng Yu wrote: > Is there a way to get the name of the list in the loop body? This was just discussed! See this thread: https://stat.ethz.ch/pipermail/r-help/2009-November/218919.html __ R-help@r-project.org mailing

Re: [R] Is there an variant of apply() that does not return anything?

2009-11-19 Thread Peng Yu
I want to use both the name and the content. Although, I could do the following thing. for(x in names(List)) { do some thing with x do some thing with List[[x]] } However, I'd prefer something like the following if R offers such functionality. But it seems not. for(x in List) { do somethin

Re: [R] Is there an variant of apply() that does not return anything?

2009-11-19 Thread Peng Yu
On Thu, Nov 19, 2009 at 4:27 PM, Marc Schwartz wrote: > On Nov 20, 2009, at 10:21 AM, Peng Yu wrote: > >> There are a few version of apply() (e.g., lapply(), sapply()). I'm >> wondering if there is one that does not return anything but just >> silently apply a function to the list argument. >> >>

Re: [R] Is there an variant of apply() that does not return anything?

2009-11-19 Thread jim holtman
invisible(apply(...)) On Thu, Nov 19, 2009 at 5:21 PM, Peng Yu wrote: > There are a few version of apply() (e.g., lapply(), sapply()). I'm > wondering if there is one that does not return anything but just > silently apply a function to the list argument. > > For example, the plot function is app

Re: [R] Is there an variant of apply() that does not return anything?

2009-11-19 Thread Charlie Sharpsteen
On Thu, Nov 19, 2009 at 2:21 PM, Peng Yu wrote: > There are a few version of apply() (e.g., lapply(), sapply()). I'm > wondering if there is one that does not return anything but just > silently apply a function to the list argument. > > For example, the plot function is applied to each element in

Re: [R] Is there an variant of apply() that does not return anything?

2009-11-19 Thread Marc Schwartz
On Nov 20, 2009, at 10:21 AM, Peng Yu wrote: There are a few version of apply() (e.g., lapply(), sapply()). I'm wondering if there is one that does not return anything but just silently apply a function to the list argument. For example, the plot function is applied to each element in 'alist'.

[R] Is there an variant of apply() that does not return anything?

2009-11-19 Thread Peng Yu
There are a few version of apply() (e.g., lapply(), sapply()). I'm wondering if there is one that does not return anything but just silently apply a function to the list argument. For example, the plot function is applied to each element in 'alist'. It is redundant to return anything from apply.