I have a dataset (x) that contains an ID column. I need to add a new dataframe column ("Var"). Var rows needs to be conditionally filled with values (0 or 1) if ID matches a list. Var rows that are not matched to a list can be left empty or with NA.

It is important for my analysis that the order of the rows is not disrupted in any way.

```r
x <- data.frame("ID" = 1:10)
list0 <- c(1,8,9)
list1 <- c(2,4,5,7,10)

```

The desired output is 

```
data.frame("ID"= 1:10, "Var" = c(0,1,"NA",1,1,"NA",1,0,0,1))

```