Since dates correspond to a numeric value and a starting date, you indeed need the day. If you really need your data to be in Date format, you can just fix the day to the first of each month manually by pasting it to the date:
month <- "2009-03"
as.Date(paste(month,"-01",sep=""))
Related Contents:
- Replacing NAs with latest non-NA value
- Convert date-time string to class Date
- Find the day of a week
- Changing date format in R
- Convert integer to class Date
- Extract month and year from a zoo::yearmon object
- as.Date with dates in format m/d/y in R
- How to subtract/add days from/to a date?
- as.Date returning NA while converting from ‘ddmmmyyyy’
- R: How to handle times without dates?
- How to subtract years?
- convert character to date *quickly* in R [duplicate]
- How to make a great R reproducible example
- How do I make a list of data frames?
- The difference between bracket [ ] and double bracket [[ ]] for accessing the elements of a list or dataframe
- Select rows from a data frame based on values in a vector
- Why is `[` better than `subset`?
- Evaluate expression given as a string
- Pass a data.frame column name to a function
- How to debug “contrasts can be applied only to factors with 2 or more levels” error?
- strptime, as.POSIXct and as.Date return unexpected NA
- Change R default library path using .libPaths in Rprofile.site fails to work
- Determine path of the executing script
- Paste multiple columns together
- Using R to download zipped data file, extract, and import data
- Reorder levels of a factor without changing order of values
- Extracting specific columns from a data frame
- Looping over a Date or POSIXct object results in a numeric iterator
- R memory management / cannot allocate vector of size n Mb
- Why does summarize or mutate not work with group_by when I load `plyr` after `dplyr`?
- Installing older version of R package
- Numeric comparison difficulty in R
- Group by multiple columns in dplyr, using string vector input
- Why do R objects not print in a function or a “for” loop?
- How to get a vertical geom_vline to an x-axis of class date?
- How to plot a function curve in R
- Adaptive moving average – top performance in R
- How to find all functions in an R package?
- Re-ordering factor levels in data frame [duplicate]
- How to order data by value within ggplot facets
- Dealing with TRUE, FALSE, NA and NaN
- Is there a more elegant way to convert two-digit years to four-digit years with lubridate?
- R round to nearest .5 or .1
- Error in if/while (condition) { : argument is of length zero
- General suggestions for debugging in R
- Set default CRAN mirror permanent in R
- Format for ordinal dates (day of month with suffixes -st, -nd, -rd, -th)
- Convert yyyymmdd string to Date class in R
- Order x axis day values in ggplot2
- Read SAS sas7bdat data into R