useRs,
I'm getting limited success in trying to apply increment in a loop.
The following defined function creates a +1 increment
incr <- function(x){
eval.parent(substitute(x <- x + 1))
print(x) }
How do I apply it in a loop on my test dataset, x1, so that the procedure
becomes
x1[c(1:2)]
x1[c(2:3)]
x1[c(3:4)]
where x1 =
m <- matrix(1:3,3,3)
x1 <- list(m, m+1, m+2, m+3, m+4)
Thanks.
Muhammad
--
Muhammad Rahiz | Doctoral Student in Regional Climate Modeling
Climate Research Laboratory, School of Geography & the Environment
Oxford University Centre for the Environment
South Parks Road, Oxford, OX1 3QY, United Kingdom
Tel: +44 (0)1865-285194 Mobile: +44 (0)7854-625974
Email: muhammad.ra...@ouce.ox.ac.uk
______________________________________________
R-help@r-project.org 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.