Reputation: 325
Having a very strange error when trying to use a package downloaded from Cran (epicalc). Some functions from this package work fine, but when I try to call one specific function (followup.plot), I get the following error:
Error in get(search()[2]) : object 'package:epicalc' not found Calls: followup.plot -> get
Any ideas what this means and how to fix it? Thanks!
Upvotes: 0
Views: 349
Reputation: 115515
This appears to be a result of some rather "interesting" code within followup.plot
if (missing(xlab)) {
xlab <- as.character(substitute(time))
if (any(class(get(search()[2])) == "data.frame")) {
if (any(attr(get(search()[2]), "names") == as.character(substitute(xlab)))) {
if (!is.null(attr(get(search()[2]), "var.labels")[attr(get(search()[2]),
"names") == as.character(substitute(xlab))])) {
if (attr(get(search()[2]), "var.labels")[attr(get(search()[2]),
"names") == as.character(substitute(xlab))] !=
"") {
xlab <- attr(get(search()[2]), "var.labels")[attr(get(search()[2]),
"names") == as.character(substitute(xlab))]
}
}
}
}
}
if (missing(ylab)) {
ylab <- as.character(substitute(outcome))
if (any(class(get(search()[2])) == "data.frame")) {
if (any(attr(get(search()[2]), "names") == as.character(substitute(ylab)))) {
if (!is.null(attr(get(search()[2]), "var.labels")[attr(get(search()[2]),
"names") == as.character(substitute(ylab))])) {
if (attr(get(search()[2]), "var.labels")[attr(get(search()[2]),
"names") == as.character(substitute(ylab))] !=
"") {
ylab <- attr(get(search()[2]), "var.labels")[attr(get(search()[2]),
"names") == as.character(substitute(ylab))]
}
}
}
}
}
which assumes you have attach
ed or use
d the source of your variables.
This is highly bizarre behaviour to assume (IMHO)
Upvotes: 1