[Rd] as.Date (and strptime?) does not recognize "  " as a blank

Spencer Graves @pencer@gr@ve@ @end|ng |rom prod@y@e@com
Sat Jun 25 08:37:52 CEST 2022


Hello, All:


	  When is a space not a space?


	  Consider the following:


 > (pblmDate <- textutils::HTMLdecode(" 2 Mar 2018"))
[1] " 2 Mar 2018"
 > as.Date(pblmDate, format='%e %b %Y')
[1] NA
 > as.Date(' 2 Mar 2018', format='%e %b %Y')
[1] "2018-03-02"


	  Is this a feature or a bug?


	  I can work around it, now that I know what it is, but it took me a 
few hours to diagnose.


	  Thanks,
	  Spencer Graves


p.s.  I got this from scraping a website with code that had worked for 
me roughly 20 months ago.  I suspect that in the interim, someone 
probably replaced ' 2 Mar 2018' with " 2 Mar 2018".



More information about the R-devel mailing list