Q:

how I can make a vector by using 2 columns in data set

I have these two columns in my data.frame :
df1 <- structure(list(Mode = c("car", "walk", "passenger", "car", "bus"
), Licence = c(1, 1, 0, 1, 1)), row.names = c(NA, -5L), class = "data.frame")

df1
#        Mode Licence
# 1       car       1
# 2      walk       1
# 3 passenger       0
# 4       car       1
# 5       bus       1

I want to make an indicator vector b, that is 1 if the mode of that person is not car an have a driver licence and 0 otherwise. in the above example I need d to be:
df2 <- structure(list(Mode = c("car", "walk", "passenger", "car", "bus"
), Licence = c(1, 1, 0, 1, 1), b = c(0, 1, 0, 0, 1)), row.names = c(NA, 
                                                                    -5L), class = "data.frame")
df2
#        Mode Licence b
# 1       car       1 0
# 2      walk       1 1
# 3 passenger       0 0
# 4       car       1 0
# 5       bus       1 1

A:

Another solution using logical operations and implicit conversion between numeric and logical:
df1$b <- with(df1, Mode!="car" & Licence)*1

Note: 0 is equivalent to FALSE and everything else is equivalent to TRUE, so if the possible values are just 0 and 1, we can shorten Licence == 1 to just Licence. The *1 part at he end converts truth values to 0's and 1's again.

