Reputation: 441
Using openxlsx
package in R. When I run this:
> openxlsx_getOp("dateFormat")
I get the expected value of [1] "yyyy-mm-dd"
. However, this code:
> op.openxlsx$openxlsx.dateFormat
returns [1] "mm/dd/yyyy"
.
Why are these different?
EDIT:
Sorry. I called options("openxlsx.dateFormat" = "yyyy-mm-dd")
at the top of my source file. Looks like this is important to specify.
Upvotes: 0
Views: 234
Reputation: 700
From ?op.openxlsx
:
‘openxlsx_getOp()’ retrieves the ‘"openxlsx"’ options found in ‘op.openxlsx’. If none are set (currently ‘NULL’) retrieves the default option from ‘op.openxlsx’. This will also check that the intended option is a standard option (listed in ‘op.openxlsx’) and will provide a warning otherwise.
So I suspect it's set to "yyyy-mm-dd" in your environment, hence the discrepancy.
To double check, you can try running R --vanilla
on your machine (or the equivalent under Windows) and see if it has reverted back to the default mm/dd/yyyy
Upvotes: 2