On May 21, 2010, at 2:18 PM, Robert U wrote:

Dear R-users,

I'm trying to make the following loop: for (x in 0 : 10) and i would like x to be decimals rather than integers, giving a x range of e.g. 0.0 0.1 0.2 0.3 ... 9.9, 10. Would anyone know how to do that ?

with regards,

Had you not been aware of the seq function, as mentioned by others, you could also have used:

for (i in 1:100/10) {
            hey[i] <-  diddle(dee[i])
                    }

Because ":" has higher precedence, you would not need to enclose the sequence in parens. This precedence rule is sometimes the source of confusion and I believe there is a FAQ item based on that source of confusion.
--

David Winsemius, MD
West Hartford, CT

______________________________________________
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.

Reply via email to