I have a character vector (called plots in the example) with the names of different treatments, all controls contain the letter "c" while all other treatments contain the letter "r". I would like to set all the controls to 1 and all the other treatments to 0.

I am a complete beginner in programming and I am working with an old code, where they did this with the code below but it doesn't work. I think the `str_match()` function in R works slightly differently and can't be used to solve this, any ideas how I could do this?

```r
trt = map_int(plots,StrMatch,str1="c")

```

Thanks!