If you use the lubridate package, this is very easy.
See the help file for month() within lubridate for more examples.
library(lubridate)
x <- now()
month(x)
month(x, label = TRUE)
month(x, label = TRUE, abbr = FALSE)
as.character(month(x, label = TRUE, abbr = FALSE))
When you run the above your
Try:
format(as.Date("05/07/2014", "%m/%d/%Y"), "%m")
#[1] "05"
#or
strptime("05/07/2014", "%m/%d/%Y")$mon+1
#[1] 5
A.K.
How to extract a Month from Date object?
almost 13 peoples visited my Question with out replying in New to R , i have
task yaar
don't mind plz could you HELP ME
How t
2 matches
Mail list logo