mercredi 2 novembre 2016

Creating variable in R with ifelse , missing condition

i have a data wich has this form

origin(total) =25078

france (22059)=non employed (14903) employed(7156)

africa (3019)=non employed(2392) employed(627)

I am trying to create 2 variable for employment situation of african origin people and french native peope i have a variable origin: data$origin<- ifelse( data$aforigin == 1, 1,0), after tabulatin i get this: 0 1 22059 3019 i want create employment status by origin: for french employement i use this:

data$fremp<- ifelse(data$frorig == 1 & data$origin == 0 & data$emploi == 1 & data$aforigin == 0,1 , 0) then i get this: 17922 7156, but the 17922 it's including the 2392 of non working african and i don't know how to keep only the 14903 in the variable i think there is a missing condition but i can't figure it out, thanks for the help

Aucun commentaire:

Enregistrer un commentaire