0

I have a data frame that looks like below, we'll call statesA (but with all 50 states). I have a separate data frame that has specific states in one column (37 states), we'll call statesB (no ozone column). How can I remove all information in the rows from statesA to contain only the states from statesB? I want to keep the ozone number though for the 37 states.

`    state           ozone
     <chr>           <dbl>
50  Alabama     0.04537190      
1   Alaska      0.02505039      
12  Arizona     0.05191860      
23  Arkansas    0.03815530      
34  California  0.03625556      
45  Colorado    0.04462810      
47  Connecticut 0.04976119      
48  Delaware    0.04170330      
49  Florida     0.04038279      
2   Georgia     0.04970213`

I was referred to another question and tried to do a right outer join but only received 25 of the needed 37 rows. statesC = merge(x = statesA, y = statesB, by = "state", all.y = TRUE)

What am I doing wrong?

jc2389
  • 1
  • 1

0 Answers0