Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201974

How do I exclude all values in a row where the first instance of this value occurs? (R Dplyr)

$
0
0

I have a dataset, df

Subject

Hi
hello
RE: Hello
RE: How is work
No
Ok
RE: What time are 
Hello RE: are you

I would like to exclude all rows where the first word is RE:

Subject

Hi
hello
No
Ok
Hello RE: are you

Here is the dput:

 structure(list(Subject = structure(c(2L, 1L, 5L, 6L, 3L, 4L, 
 7L), .Label = c("hello", "HI", "No", "ok", "RE: Hello", "RE:   How     is work", 
 "RE: What time are"), class = "factor")), class = "data.frame",       row.names = c(NA, 
 -7L))

I have tried this:

   df %>% 
   filter(Subject!= %RE:)

I do not know how to formulate the code so that it will exclude only if is the first instance within the row.


Viewing all articles
Browse latest Browse all 201974

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>