Filter not recognizing one of my variables [reprex/datapasta available]

Hi, I am having issues filtering out certain unique IDs in my data due to them being outliers in assessment value.

A little background context, i am conducting analysis on assessment value for land and some of the assessments have been mis-classified. In my case for example, a mall was classified as a residential building.

When i tried filtering out the row via its unique ID "Roll Number" it gave me an error i have no idea how to fix. Specifically the error is: longer object length is not a multiple of shorter object length

Please see my reprex and datapasta below. Any help appreciated.

library(tidyverse)

dp_ap <- tibble::tribble(
  ~Neighbourhood.Area, ~Total.Assessed.Value, ~Property.Class.1, ~Location,  ~Roll.Number,
  "SOUTHDALE",                 10000,           "OTHER",        NA, "06003900000",
  "VARENNES",                     0,   "RESIDENTIAL 1",        NA, "08001666500",
  "DUFRESNE",                     0,   "RESIDENTIAL 1",        NA, "06030778000",
  "FAIRFIELD PARK",                     0,   "RESIDENTIAL 2",        NA, "03092988570",
  "FRAIPONT",                     0,   "RESIDENTIAL 1",        NA, "06093463615",
  "FORT RICHMOND",               2038000,   "RESIDENTIAL 2",        NA, "03043688200"
)

dp_ap <- dp_ap %>%
  filter(Property.Class.1 %in% c("RESIDENTIAL 1", "RESIDENTIAL 2", "RESIDENTIAL 3"),
         Total.Assessed.Value != 0,
         Roll.Number != c("03091187900", "03091187200", "03091187300", "12092819100", "07000859500", "7081185200", "8021213900", "3092988585", "12032758800", "7569134320", "10006776090", "06072082500", "12091132000")
  )
#> Warning in Roll.Number != c("03091187900", "03091187200", "03091187300", :
#> longer object length is not a multiple of shorter object length
#> Warning in (~Property.Class.1 %in% c("RESIDENTIAL 1", "RESIDENTIAL 2",
#> "RESIDENTIAL 3")) & : longer object length is not a multiple of shorter
#> object length
#> Error: Result must have length 6, not 13

Created on 2020-02-16 by the reprex package (v0.3.0)

Try the form:

! Roll.Number  %in% c("
2 Likes

Works! Thank you kindly!

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