I have a dataset with concentrations. Some of them are labeled with a "<" symbol. I want to copy the column with the concentration but only the variables with "<" symbol in it. all others should be changed to "NA".
my code looks like this: raw_data$new_column <- ifelse(grepl("<", raw_data$Messwert, Value, "NA"))
obviously Value doesnt work. But i cant figure it out, I`m new to programming and would appreciate your help a lot. How should i solve this Problem?
my data set should look like this:
| ID | Concentration | new_column |
|---|---|---|
| 1 | 0.134 | NA |
| 2 | <0.01 | <0.01 |
| 3 | 0.32 | NA |
| 4 | <0.0005 | <0.0005 |
| 5 | 0.75 | NA |
Thank you very much.