If I use a module file with attach=TRUE, then changes in the module file don't get reflected if I re-run use. Example:
No foo function:
> foo(3)
Error in foo(3) : could not find function "foo"
This file defines one function:
> system("cat mod.Rmod")
foo <- function(x) {
sqrt(x)
}
Use it and try it:
> use("mod.Rmod",attach=TRUE)
> foo(3)
[1] 1.732051
Now edit the file to return x squared, use it again and get an update message:
> system("cat mod.Rmod")
foo <- function(x) {
x*x
}
> use("mod.Rmod",attach=TRUE)
Replacing attached import/use on search path for: modules:mod.Rmod.
but foo still does square-root:
detach and re-use and I get the new behaviour:
> detach(2)
> foo
Error: object 'foo' not found
> use("mod.Rmod",attach=TRUE)
> foo(3)
[1] 9
>
Is this expected or documented? Using reInit=TRUE doesn't change the above either.
I'm currently using R 3.6.3 and modules: 0.8.0
Thanks
If I
usea module file withattach=TRUE, then changes in the module file don't get reflected if I re-runuse. Example:No
foofunction:This file defines one function:
Use it and try it:
Now edit the file to return x squared,
useit again and get an update message:but
foostill does square-root:detach and re-
useand I get the new behaviour:Is this expected or documented? Using
reInit=TRUEdoesn't change the above either.I'm currently using R 3.6.3 and modules: 0.8.0
Thanks