Dirk Calloway
Dirk Calloway

Reputation: 2619

as.yearmon in zoo not working correctly

I have a script on my desktop that works fine, but I had to migrate to Windows Server 2012 for work and now I'm getting a weird bug.

I'm trying to convert a mon-yr date format string to a zoo date using the as.yearmon() zoo function.

This works fine on Windows 7 for me but on Windows Server I get the result below:

>  x = c("Apr-13", "Aug-12", "Aug-13", "Dec-12", "Feb-13", "Jan-13", "Jul-13", "Jun-13", "Mar-13",     "May-13", "Nov-12", "Oct-12", "Sep-12")

> as.yearmon(x, "%b-%y")

[1] "Apr 2013" "Aug 2012" "Aug 2013" NA "Feb 2013" "Jan 2013" "Jul 2013" "Jun 2013"
[9] NA  NA  "Nov 2012" NA  "Sep 2012"

The NAs should not be there. I get dates on my desktop. Any ideas on where this could be coming from?

Upvotes: 0

Views: 4377

Answers (1)

Dirk Calloway
Dirk Calloway

Reputation: 2619

The problem was that the Regional Settings for the server were German even though the language was in English.

Used:

Control Panel> Region > Format

I changed this to English(US) and the function ran normally.

Upvotes: 1

Related Questions