What is the equivalent of Stata function inlist() in R?
问题 Stata's inlist allows us to refer to the real or string values of a variable. I was wondering whether R has such a function. Examples: I want to choose eight states from the variable state (you can think this as column state in any dataframe where state takes 50 string values (states of United States)). inlist(state,"NC","AZ","TX","NY","MA","CA","NJ") I want to choose nine values of age from the variable age (you can think this as column age in any dataframe where age takes numerical values