What is the '|
' symbol in R, how is it different from '||
' (logical OR) and when should it be used?
I'm trying to create a subset of a data.table
and I write midwest = DT[State == "WI" || State == "MI" || State == "IL" || State == "MN"]
it produces a table with just columns and no rows, but when I write midwest = DT[State == "WI" | State == "MI" | State == "IL" | State == "MN"]
I get the subset I'm looking for with it's rows filled.