Reputation: 1315
I've been running into this from time to time but for the first time I have simple reproducible example. The fact that the example involves lubridate is, I believe, coincidental. In R --vanilla session
library(lubridate)
ymd("2001-02-02")
# [1] "2001-02-02 UTC"
# so far so good
debug(ymd)
ymd("2001-02-02")
# debugging in: ymd("2001-02-02")
# Error in ymd("2001-02-02") : could not find function ".parse_xxx"
There is nothing wrong with ymd, I was trying to learn some things. But when you are actually debugging and this happens, it's very annoying. Debugger bug or am I missing something?
Version info
> R.version
_
platform x86_64-apple-darwin13.4.0
arch x86_64
os darwin13.4.0
system x86_64, darwin13.4.0
status
major 3
minor 1.2
year 2014
month 10
day 31
svn rev 66913
language R
version.string R version 3.1.2 (2014-10-31)
nickname Pumpkin Helmet
And session infor per @Joshua Urlich comment
> sessionInfo()
R version 3.1.2 (2014-10-31)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] lubridate_1.3.3
loaded via a namespace (and not attached):
[1] digest_0.6.4 memoise_0.2.1 plyr_1.8.1 Rcpp_0.11.3 stringr_0.6.2
Thanks
Upvotes: 5
Views: 3685
Reputation: 176648
Looks like it might have to do with the functions not being defined using {}
. The current implementation is:
ymd <- function(..., quiet = FALSE, tz = "UTC", locale = Sys.getlocale("LC_TIME"), truncated = 0)
.parse_xxx(..., orders = "ymd", quiet = quiet, tz = tz, locale = locale, truncated = truncated)
Your debug
attempt works if I unpack the source, and change the implementation to:
ymd <- function(..., quiet = FALSE, tz = "UTC", locale = Sys.getlocale("LC_TIME"), truncated = 0)
{ .parse_xxx(..., orders = "ymd", quiet = quiet, tz = tz, locale = locale, truncated = truncated)}
I was able to replicate the issue before making the above change. After making it, I get:
> require(lubridate); debug(ymd); ymd("2015-01-01")
Loading required package: lubridate
debugging in: ymd("2015-01-01")
debug: {
.parse_xxx(..., orders = "ymd", quiet = quiet, tz = tz, locale = locale,
truncated = truncated)
}
Browse[2]>
debug: .parse_xxx(..., orders = "ymd", quiet = quiet, tz = tz, locale = locale,
truncated = truncated)
Browse[2]>
exiting from: ymd("2015-01-01")
[1] "2015-01-01 UTC"
Upvotes: 5
Reputation: 52637
Not a solution or explanation but a potential work around:
trace(ymd, browser)
Then:
> ymd("2001-02-02")
Tracing ymd("2001-02-02") on entry
Called from: eval(expr, envir, enclos)
Browse[1]> n
debug: .parse_xxx(..., orders = "ymd", quiet = quiet, tz = tz, locale = locale,
truncated = truncated)
Browse[2]>
I am able to recreate your error on Win7 R3.1.2 / RStudio. I was hoping to recreate the problem with trace
to try to poke around, but any trace
of the function destroys the problem...
Upvotes: 3