s-news
[Top] [All Lists]

iterationsinlooping

To: s-news@lists.biostat.wustl.edu
Subject: iterationsinlooping
From: Gerald E Bove Jr <gebove@geog.buffalo.edu>
Date: Tue, 21 Oct 2003 10:47:14 -0400 (EDT)
sorry have been asked for an example of last post concerning iteration.
I am trying to compress data in a particular column of a matrix based on
the values in 2 of the other columns.  I would generally think of doing
this in maybe 3 loops? in something like C, seems it can be done with 
much less code in splus.
ex.
for (i in length(bl[,2])) (idea here is just to read the records) 
if (bl[,2]==bl[,2] && (bl[,3]==bl[,3]) (next part will be if same then
total cases in bl[,4].
I have created a small matrix to test this and the biggest hangup at the
moment is trying to loop through by columns or rows for anything other
than the first case.


<Prev in Thread] Current Thread [Next in Thread>