Dear All,
I have seldom needed to use loops in R, but now I need to code a loop
with a stride different from one.
In the R manual I downloaded I have the example:
> xc <- split(x, ind)
> yc <- split(y, ind)
> for (i in 1:length(yc)) {
    plot(xc[[i]], yc[[i]]);
    abline(lsfit(xc[[i]], yc[[i]]))
  }
but in my case I'd like to add a condition so that i varies by 4 from
one go to the following one. I cannot figure out the right syntax, can
anyone help here?
Another thing (which could possibly solve my problem): I had a look at
integrate command in R.
It seems to require an object defined as a function to carry out the
integration.
What if I simply have a list of data values? How can I coerce them
into a function recognized by R? Furthermore, are there R routines to
carry out the integration on a non-equally spaced 1D grid?
Best Regards

Lorenzo

______________________________________________
R-help@stat.math.ethz.ch mailing list
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.

Reply via email to