79118978

Date: 2024-10-23 17:07:41
Score: 1
Natty:
Report link

With the help of @NirGraham, it seems you have to/should explicitly define the namespace of the data being referenced. In the above example, the following function definition fixed the issue:

fn_docalc <- function(x){
tmp <- myPkgName::measurements
tmp$value <- tmp$value * x
tmp
}

Further, my actual use case was using the get() function instead of directly referencing the variable. The equivalent in this case would be tmp <- get("measurements"). The fix to that was to include the pos argument like: tmp <- get("measurements", pos = "package:myPkgName")

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @NirGraham
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: Joe