my question regards making multiple decisions like
|. I imported a rather big dataset from an excel sheet (9211 obs., 482 variables). Now, I only want to keep the rows, which have an "1" in one of the first columns (this indicates an Error in the Data and I want to know, how many there are).
What I did was, in short, something like
Data <- read.csv2("Data.csv", header =FALSE) Data_fail <- subset(Data, (V3 == 1 | V4 == 1 | V5 == 1 | V6 == 1 | V7 == 1), select=c(V1:V60))
In my actual code I'm not only considering V3 to V7 but V3 to V60, repeating the |-decision until V60, which is a lot to write. Is there any way to make it easier? Like
(V3|:V60) == 1, or
V3 == 1 | V4 == 1 | ... | V60 == 1?