1

I have a dataframe that looks something like the following.

KEYCODE= c("A","B","C","D")
values = list(c("12,3"),c("2"),c("2,7"),c("16"))

df = data.frame(KEYCODE=KEYCODE, values=cbind(values))

Now, I want to create a third column that will create values of 0 when the values field do not have anything between 7 to 18, else it will crate a value of 1. For instance, My new df with the new column

Unfortunately, the elements in the values field are strings.

Thank in advance.

mraveek
  • 35
  • 4
  • Does this answer your question? [How to determine whether a Pandas Column contains a particular value](https://stackoverflow.com/questions/21319929/how-to-determine-whether-a-pandas-column-contains-a-particular-value) – Zain Ul Abidin Oct 22 '21 at 06:23
  • I am looking for something in R. Not in python. Thanks. – mraveek Oct 23 '21 at 15:55

0 Answers0