Ok so I cannot figure this out for the life of me, I want to filter my data based on a partial string match. here is my data, I am just showing the column i want to filter, but there are more rows in the overall set. I only want to show the rows that begin with "CAO" --this is easily achievable in the viewer
dataviewer image:
Basically I want the R "code" that would reproduce this exact result. I have tried using grepl like so
filter(longdata, grepl("^CAO",longdata[,1]))
I have tried using subset
subset(longdata,longdata[,1]=="^CAO")
I have tried subset with grepl and no matter what I do I cant figure it out. I am new to R so please try and explain it thoroughly.