use levels to create a 2 level factor in r code example Example: show factor levels in r #in R levels(x)