Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to subset in R deleting specific date range?

I need to subset all the rows that aren’t included between certain date range.

I know that if I want to subset between dates, I can use this code:

data <- subset(data, DATE1 >= "2021-06-08" & DATE2 <= "2021-07-07")

But how can I subset all the rows that aren’t in this date range?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Use !

data <- subset(data, !(DATE1 >= "2021-06-08" & DATE2 <= "2021-07-07"))
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading