If I am sub-setting using logical statements, is there a way of combining without using logical operators? i.e. is there a more effective way of doing the following:
train$TOD[train$Hour == 23 | train$Hour == 0 | train$Hour == 1 | train$Hour == 2]
If I am sub-setting using logical statements, is there a way of combining without using logical operators? i.e. is there a more effective way of doing the following:
train$TOD[train$Hour == 23 | train$Hour == 0 | train$Hour == 1 | train$Hour == 2]
With a reproducible example it could be great but I think that this code is what you are looking for:
train[train$Hour %in% c(0, 1, 2, 23), ]