[R] setting off-diagonals to zero
emorway
emorway at usgs.gov
Thu Jan 24 01:58:34 CET 2013
I'm not following. Printing SEQ to the screen at the intermediate steps
using the following modified R code suggests that 'i' is fine and is not
getting reset to 1 as you suggest? My understanding, or rather my desired
output if someone else is able to weight-in, is that the values in the
second line of output (731 732 733 etc.) should not be appearing in the 3rd
line of output. The third line of output should be missing 731 thru 736.
Any suggestions on how to modify the R code are certainly welcome.
Suggested revisions will be substituted back into the third FOR loop in my
original post on this thread to prevent the main- and near-main-diagonal
terms from being set equal to zero.
for (i in 731:732) {
SEQ <- (i - 5):(i + 5)
print(SEQ)
SEQ <- SEQ[SEQ > 730 & SEQ < 1096]
print(SEQ)
print((731:1095)[-SEQ])
}
# [1] 726 727 728 729 730 731 732 733 734 735 736
# [1] 731 732 733 734 735 736
# [1] 731 732 733 734 735 736 737 738 739 740 741 742 743 744
745 746 747 748 749 750 751 752 753 754 755 756...
--
View this message in context: http://r.789695.n4.nabble.com/setting-off-diagonals-to-zero-tp4656407p4656461.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list