Yes, there is a one-liner for that using function cut
:
cut(Sys.Date(), "month")
[1] 2012-11-01
Levels: 2012-11-01
More Related Contents:
- How to prevent ifelse() from turning Date objects into numeric objects
- How to convert Excel date format to proper date in R
- How to flatten / merge overlapping time periods
- Split date-time column into Date and time variables
- efficiently generate a random sample of times and dates between two dates
- Checking if Date is Between two Dates in R
- Convert decimal day to HH:MM
- Round a POSIX date (POSIXct) with base R functionality
- strptime, as.POSIXct and as.Date return unexpected NA
- Transform year/week to date object
- Get the difference between dates in terms of weeks, months, quarters, and years
- How to change multiple Date formats in same column?
- How to get a vertical geom_vline to an x-axis of class date?
- Add a month to a Date [duplicate]
- How to subtract/add days from/to a date?
- Split time series data into time intervals (say an hour) and then plot the count
- Formatting dates with scale_x_date in ggplot2
- Convert a numeric month to a month abbreviation
- R – converting date and time fields to POSIXct with HHMMSS format
- Convert string to date, format: “dd.mm.yyyy”
- How can I fix corrupted dates in R?
- Convert yyyymmdd string to Date class in R
- Converting a character string into a date in R
- Handling dates when we switch to daylight savings time and back
- Create end of the month date from a date variable
- Converting numeric time to datetime POSIXct format in R
- R: convert date from character to datetime [duplicate]
- How to convert a date from a character string?
- change a column from birth date to age in r
- Convert two-digit years to four-digit years with correct century