'R: filter issue - Error in `filter()`: ! Problem while computing `..1 = between(data$column, 400, 1800)`
I have a data frame and am looking to get a subset based on conditions related to another column. This seems to work for some variable, but somehow for one particular one, I am getting the following error message:
Error in `filter()`:
! Problem while computing `..1 = between(Unitranche$Yield, 400, 1800)`.
Caused by error in `Unitranche$Yield`:
! $ operator is invalid for atomic vectors
Run `rlang::last_error()` to see where the error occurred.
The code is as follows:
X = filter(data, X == 1)
Y = filter(data, Y == 1)
Z = filter(data), Z == 1)
no problem until here, but then:
X = filter(X, between(X$a,400,1500))
Y = filter(Y, between(Y$a,400,1800))
Z = filter(Z, a >= 800)
The error pops up for Y, although Y is created/filtered exactly like the X and Z.
Not sure how to replicate this error with sample data; but just in case Y is 278 observations of 5 variables.
Thank you!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
