I have a dataset (loadings from an efa) with three variables/factors (ML1, ML2, ML3) and I would like to extract the names of cases that have an absolute value of >= 0.3 for exactly one variable/factor.
This is what I worked out so far:
items <- row.names(loadings1[(abs(loadings1$ML1) >= 0.3 | abs(loadings1$ML2) >= 0.3 | abs(loadings1$ML3) >= 0.3) & sum(abs(loadings1$ML1) >= 0.3 , abs(loadings1$ML2) >= 0.3 , abs(loadings1$ML3) >= 0.3 ) == 1,])
It only returns an empty character and I know that it is not because there are no cases that match my criteria.
I also tried:
row.names(loadings1[abs(loadings1$ML1) >= 0.3 | abs(loadings1$ML2) >= 0.3 | abs(loadings1$ML3) >= 0.3 & sum(abs(loadings1$ML1) >= 0.3 , abs(loadings1$ML2) >= 0.3 , abs(loadings1$ML3) >= 0.3 ) == 1,])
The second attempt seemed to ignore the & condition entirely even though the different or conditions worked.
I also found this for help and didn't really see why it wouldn't work in my case.
Any ideas?