Cleaning of a database

Hi everybody!

I have a problem with the cleaning of a database. What I want is to keep only the rows where in column B the word starts with "b". My actual code is:


db_class <- data.frame(A=c(2,3,3,2,1),B=c("ax","ac","bs","br","cv"),C=c(14,15,17,12,14))

row_numbers <- c(db_class %>% rowwise() %>% mutate(Pos = which((db_class$B) == starts_with("b")[1]))
db_class_clean <- db_class[row_numbers,]

I tried to write this code but it doesn't work..


(db_class <- data.frame(A=c(2,3,3,2,1),

(db_class_clean <- db_class %>% 

you may benefit from studying this useful book. (it covers the use of dplyr::filter and many other useful manipulations)

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.