0

I'm trying to inner join two datasets, rate and state.regions. R gives me an error message:

cannot join on columns 'StateCode' x 'abb': index out of bounds.

I have no idea how to fix it. Is there anybody can help with this problem? Thanks!

stateRates <- rate %>%
filter(IndividualRate<9000 & BusinessYear==2016) %>%
group_by(StateCode) %>%
summarise(MedianIndividualRate = median(IndividualRate),
value = median(IndividualRate)) %>%
inner_join(state.regions, by=c("StateCode"="abb"))
Jaap
  • 81,064
  • 34
  • 182
  • 193
Emily
  • 3
  • 1
  • 1
    Welcome to StackOverflow! Please read the info about [how to ask a good question](http://stackoverflow.com/help/how-to-ask) and how to give a [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example/5963610). This will make it much easier for others to help you. – Jaap Apr 15 '16 at 21:13
  • That's the kind of error you get if one of the variables doesn't exist, so make sure `abb` is in your second dataset exactly as you've written it. – aosmith Apr 15 '16 at 21:18
  • I'm sure `abb` is in the state.regions dataset.@aosmith – Emily Apr 16 '16 at 00:00

0 Answers0