0

I've been trying to create two different subsets for white native british and 2nd generation Indians and Pakistanis in the understanding society date frame but havent been able to, I already made a UKborn subsets that works just fine, however I cant figure out how to do these two subsets

here's what I have so far

British <- subset(df, ukborn>0 & ukborn < 5)

df1 <- within(British, {
  White_native <- British$racel_dv == 1 & British$racel_dv == 2 & British$racel_dv == 4
  Second_Generation <- British$racel_dv == 9 & British$racel_dv ==10
})
Bernhard
  • 4,272
  • 1
  • 13
  • 23
  • 1
    It is hard to make sense of this without having a sample of `df` and knowing more about the coding (what do these numbers mean). However `British$racel_dv == 1 & British$racel_dv == 2` will always be `FALSE`. Did you mean `|` instead of `&`? – Bernhard Dec 07 '22 at 12:41
  • For the racel_dv 1,2 and 4 means white and 9 and 10 mean Indian or Pakistani – monkegobrrrrrr Dec 07 '22 at 13:16
  • 1
    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. So what exactly is wrong with what you have? It's not clear to me what your specific question is here. – MrFlick Dec 07 '22 at 16:39

0 Answers0