Why my code failed about %in%?

Q4.1$location[Q4.1$firstthree %in% c(601, 787, 334, 853,847,287,981,846,984,498,618,341,337,973, 972,830,977,339,432,902,982,342,560,926,809,357,875,565,297,808,554,770,852,553,024,029,045)] <- "Not in Wisconsin"

Notice that this code works except when my zipcodes start from number 0. 024,029,045 returns 3 missing values. I don't know why.

Because your problem is with leading zeros I assume you are matching character vector to numeric. Probably easiest to change your character vector numeric also before testing against the numbers

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.