[R] For Loop

Bert Gunter bgunter@4567 @end|ng |rom gm@||@com
Sat Sep 22 23:42:30 CEST 2018


Please, please spend some time with an R tutorial or two before you post
here. This list can help, but I think we assume that you have already made
an effort to learn basic R on your own. Your question is about as basic as
it gets, so it appears to me that you have not done this. There are many
many R tutorials out there. Some suggestions, by no means comprehensive,
can be found here:

Others will no doubt respond, but you can answer it yourself after only a
few minutes with most R tutorials.


On Sat, Sep 22, 2018 at 2: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.

	[[alternative HTML version deleted]]

More information about the R-help mailing list