0

filter function is deleting my observations.

 bres_tidy <- bres %>%  
     separate(col = "INDUSTRY_NAME", into = c("INDUSTRY_CODE", "INDUSTRY_NAME"), sep = ":") %>%  
     pivot_wider(names_from = EMPLOYMENT_STATUS_NAME, values_from = OBS_VALUE) %>% 
     mutate (SELF_EMPLOYED = (Full_time_employees + Part_time_employees) - Employment) %>%
     filter(INDUSTRY_CODE == "C" | INDUSTRY_CODE == "F") %>%
     select(-INDUSTRY_CODE)

This is the problem code it all runs but specifically the line filter(INDUSTRY_CODE == "C" | INDUSTRY_CODE == "F") %>% deletes all my observations in the object, this is severely annoying, does anyone know why its happening?

freyberg
  • 367
  • 2
  • 9
luca
  • 1
  • 1
  • 6
    Would you mind providing some of your data? Otherwise it is difficult to reproduce your problem. Anyway, I would first check after the mutate with `head` or `view` what my data looks like and check if there are indeed any rows which contain these values. – freyberg May 05 '23 at 21:22
  • 3
    It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. – MrFlick May 05 '23 at 21:32

0 Answers0