I have been having trouble passing a default argument to
base::as.Date.character and think it is due to some funkiness in the
function definition.
base::as.Date.character is defined as
function (x, format = "", ...) {
# stuff deleted
res <- if (missing(format))
charToDate(x)
else strptime(x, format, tz = "GMT")
as.Date(res)
}
which gives unexpected behaviour when passing a default value of "" for
format. I think the check "if(missing(format))" should really be
"if(format=="")".
Defining the wrapper:
as.Date.character <- function(x, format='', ...) {
if(format=='') base::as.Date.character(x, ...)
else base::as.Date.character(x, format=format, ...)
}
provides (what I think is) the expected behaviour.
... is this the right list for this post?
Cheers,
Simon Knapp
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel