mercredi 1 novembre 2017

How to print a row that contains specific values of a column?

Im trying to make a loop and search a value in a column and then display the all the row where is that value, i want to make it from 1950 to 2016

I have been trying this:

for (p in 1:nrow(Em)){
if (Em[p,"year"]==1950)
   print(Em[p,])} #it is not showing me just the row that matches
 else if (Em[p,"year"]==1951){
    print(Em[p,])}

Aucun commentaire:

Enregistrer un commentaire