Skip to content
Advertisement

select the last 30 days of POSIXct dates in R

Probably simple, but this is my first time working with POSIXct date format.

I have a table of orders (that i got from a syl database) and I would like to select all rows of the last 30 days. so today’s date minus 30 days. my date is of the type POSIXct.

Now, I know how to do this selection in sql, but need to do this in R. Any suggestions?

It is not a requirement to keep the POSIXct format, one could also transform into another time format if this makes the selection easier.

Side note: the R-code will later on be embedded into a MS SQL environment.

Advertisement

Answer

Created on 2022-06-30 by the reprex package (v2.0.1)

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement