sorry, i think reproducibile example is the "dataframe" that i have put.
so...
the dataframe is:
subj Gender act
101 Male 801-walking forward
101 Male 802-walking backward
205 Female 909 back-sitting
208 Male 914 right-recovery
if i write a code like:
dataframe$act <- str_replace_all(dataframe$act, "^8", "0")
dataframe becomes
subj Gender act
101 Male 001-walking forward
101 Male 002-walking backward
205 Female 009 back-sitting
208 Male 014 right-recovery
only the first number ( 8 or 9) is replaced with 0
dataframe$act<- case_when(dataframe$act== "^8" ~ "0", dataframe$act=="^9" ~ "1")
the columns dataframe$act becomes all NA..