I have a .cvs file which consists of 4 columns and 120 rows. I'm attempting to go through every row and where ever i see a "1" in the third column (which here is called "Dam") , i want to save that row in a matrix called "Dam.one"
Here's my code so far:
DamType = c( "Dam.one", "Dam.two", "Dam.three", "NoDam.one", "NoDam.two", "NoDam.three")
for (i in 1:120) {
if (mercury.raw[i,]["Dam"] == 1) {
if (mercury.raw[i,]["Type"] == 1){
DamType["Dam.one"] <- mercury.raw[i,]
}}}
I don't know what is wrong with it. Any help is appreciated.
Aucun commentaire:
Enregistrer un commentaire