I have a behaviout that makes no sense to me, could someone explain the following bahaviour
I have created 2 packages A,B
A
depends on data.table
and defines the function readFile
B
depends on A
and defines the function useFile
useFile <- function(path){
DT <- readFile(path)
print(class(DT))
return(DT[x == 'a'])
}
When I do
library(A)
library(B)
useFile(myFile)
I see that DT is a data.table
from the print
statement but it crashes saying that object x not found
(of course the data.table has a x column)
Now when I also make B
depends on data.table
it works fine !
Can someone explain the behaviour, I would assume that all the data.table
ness should be there when library(A)
is called !!
PS: I know I should supply reproducible but we are taking 2 packages here, if there is no obvious answer I will upload 2 packages online