Closed stemangiola closed 1 year ago
Hi,
I guess you are trying to share the ID of an R object through the filesystem. Is it correct? If so, I think there is a simple way to do it, you do not have to explicitly know the ID of the shared object. All you need to do is to save the object to a file like a regular object, only the ID of the shared object will be saved.
In R session A
library(SharedObject)
x <- share(1:10)
file <- tempfile()
saveRDS(x, file)
In R session B (assume you still have R session A running, otherwise the data of the shared object might be deleted)
library(SharedObject)
# Replace this path with your path
x <- readRDS("C:\\Users\\jiewang\\AppData\\Local\\Temp\\RtmpSmudfO\\file135c1ed7a2e")
x
output in R session B
> x
[1] 1 2 3 4 5 6 7 8 9 10
Does this solve your problem? Feel free to let me know if you have more questions
Jiefei
@susansjy22 in this way we don't have to save the whole file and load it back into Targets
Hello, thanks for this package.
I would like to use
SharedObject
with Targets. In order to do that, I would like toA
x <- share(1)
x$dataId
as fileB
x
from memory asloadSharedObjectFromDataId(dataId)
Is this possible?