[R] For Loop
Ista Zahn
|@t@z@hn @end|ng |rom gm@||@com
Sun Sep 23 14:53:51 CEST 2018
On Sat, Sep 22, 2018 at 9:06 PM Wensui Liu <liuwensui using gmail.com> wrote:
>
> or this one:
>
> (Vectorize(function(i) log(c1[i + 1] / c1[i])) (1:len))
Oh dear god no.
>
> On Sat, Sep 22, 2018 at 4:16 PM rsherry8 <rsherry8 using comcast.net> wrote:
> >
> >
> > It is my impression that good R programmers make very little use of the
> > for statement. Please consider the following
> > R statement:
> > for( i in 1:(len-1) ) s[i] = log(c1[i+1]/c1[i], base = exp(1) )
> > One problem I have found with this statement is that s must exist before
> > the statement is run. Can it be written without using a for
> > loop? Would that be better?
> >
> > Thanks,
> > Bob
> >
> > ______________________________________________
> > R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list