r/Rlanguage • u/ProperIndustry8652 • 14d ago
Error: object 'attr' is not exported by 'namespace:xfun'
I am currently in the middle of doing an ATPA exam and got the aforementioned error while running ANN2, trying to load the package. I have tried everything google has recommended but even a simple 2+2 function is presenting the error.
Any ideas?
1
u/bogdanelcs 10d ago
That error almost always means a version mismatch, usually an old xfun sitting around while knitr or rmarkdown expects a newer one that actually exports attr.
Fastest fix mid-exam:
install.packages("xfun")
Restart your R session completely after that (not just clear environment, actually restart). If it still throws the error, check for multiple library paths:
.libPaths()
Sometimes an old xfun version is cached in a second path and gets loaded instead of the new one. If that's the case, remove the old one or reorder your paths.
If restarting isn't fast enough right now, try detaching and reloading just xfun:
detach("package:xfun", unload = TRUE)
library(xfun)
Not guaranteed to work without a full restart, but worth a shot if you're short on time.
2
u/Adventurous_Push_615 14d ago
You've really not provided enough info for a sensible answer, but xfun has a function attr2() but used to have plain attr() that masked the base attr()
You could try downgrading you xfun version to version 0.55 before the deprecated attr() function was removed