I’m trying to remove the characters in even rows of a specific column.
My dataset looks like this:
| name | value |
|---|---|
| apple | 3 |
| apple | (0,1) |
| banana | 6 |
| banana | (-2,6) |
| cherry | 3 |
| cherry | (4,6) |
And this is what I’m expecting:
| name | value |
|---|---|
| apple | 3 |
| (0,1) | |
| banana | 6 |
| (-2,6) | |
| cherry | 3 |
| (4,6) |
Thank you!
>Solution :
You may try:
df$name[!c(TRUE, FALSE)] <- ""
This will assign empty string to even rows of the name column.