For example, if I want to keep only those rows of the data mtcars
where the variable qsec
contains this decimal .50
, following the solutions given here, I use:
mtcars_stringed<-mtcars%>%filter(str_detect(qsec, ".50"))
mtcars_stringed<-mtcars[mtcars$qsec %like% ".50", ]
mtcars_stringed <- mtcars[grep(".50", mtcars$qsec), ]
View(mtcars_stringed)
Surprisingly, all these strategies fail, by returning null, while in fact mtcars$qsec
has values containing .50
such as 14.50, 15.50,
Any alternative solution, or is there something I am missing? Thanks in advance.