How can I convert this to month?

后端 未结 1 882
感情败类
感情败类 2021-01-29 16:20
6/9/2013 1:15
7/9/2013 1:15

I have a series of data in a column of this format.

I am trying to convert it into a month and store it in a differ

相关标签:
1条回答
  • 2021-01-29 16:46

    How about

    x <- c("6/9/2013 1:15","7/9/2013 1:15")
    strftime(as.Date(x, format="%m/%d/%Y %H:%M"), "%B")
    # [1] "June" "July"
    

    First convert to a proper date via as.Date() then use the formatting options in strftime to get the month name.

    0 讨论(0)
提交回复
热议问题