I have a dataset:
yearID teamID lgID playerID salary
1985 BAL AL murraed02 1472819
1985 BAL AL lynnfr01 1090000
1985 BAL AL ripkeca01 800000
1985 BAL AL lacyle01 725000
1985 BAL AL flanami01 641667
1985 BAL AL boddimi01 625000
1985 BAL AL stewasa01 581250
I'd like to delete an entire row if the salary column value starts with '1'.
For instance, if the salary column value is 12240, I'd like to remove the row.
Here is a fun idea with math,
df[df$salary / 10^(nchar(df$salary)) >= 0.2,]
# yearID teamID lgID playerID salary
#3 1985 BAL AL ripkeca01 800000
#4 1985 BAL AL lacyle01 725000
#5 1985 BAL AL flanami01 641667
#6 1985 BAL AL boddimi01 625000
#7 1985 BAL AL stewasa01 581250
Try:
tibble(x = c(123, 4232, 312, 321)) %>%
filter(!grepl("^1", x))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With