I am currently trying to convert a list of written dates to objects of type "Date". My dates are in the following format: 1 January 1800
. The function i tried to write to convert this to a date object is as.Date("1 January 1800", "%d %B %Y")
. Now here comes the weird thing. For the monhts April, September, November and December this code works. For all other months however it doesn't. I am very confused as to why this is happening and would like to get your insights on this problem.
Code with results for all months:
> as.Date("1 January 1872", "%d %B %Y")
[1] NA
> as.Date("1 February 1872", "%d %B %Y")
[1] NA
> as.Date("1 March 1872", "%d %B %Y")
[1] NA
> as.Date("1 April 1872", "%d %B %Y")
[1] "1872-04-01"
> as.Date("1 May 1872", "%d %B %Y")
[1] NA
> as.Date("1 June 1872", "%d %B %Y")
[1] NA
> as.Date("1 July 1872", "%d %B %Y")
[1] NA
> as.Date("1 August 1872", "%d %B %Y")
[1] NA
> as.Date("1 September 1872", "%d %B %Y")
[1] "1872-09-01"
> as.Date("1 October 1872", "%d %B %Y")
[1] NA
> as.Date("1 November 1872", "%d %B %Y")
[1] "1872-11-01"
> as.Date("1 December 1872", "%d %B %Y")
[1] "1872-12-01"