Skip to content
Prev 223338 / 398500 Next

Creating a maxtrix from "conditional prints"

Use rbind? Not the most optimal solution, but it should get the job done.

# not tested
Code example:

out <- c()
for (x in 1:10) {
for (y in 1:10) {
qui <- ifelse((mac[,1] == x) & (mac[,5] == y) |  (mac[,1] == y) & (mac[,5]
== x), 1, NA)
quo <- cbind(mac,qui)
qua <- subset(quo, qui ==1)
if(nrow(qua) == 2)
print(qua)
out <- rbind(out,qua)
}}
On Fri, Jun 4, 2010 at 9:08 PM, EM <evilmastea at gmail.com> wrote: