I am having 2 R sessions now working on one vector in each of the session with slight difference inside, say:
session1: temp1 <- c(1:10)
session2: temp2 <- c(2:11)
I want to copy the temp1 from session1 into session2 and do a %in%, but I don’t want use print(temp1) in session1, ctrl-c it, manually modify the output and then ctrl-v it in session2.
I have seen someone using a generic function that create an output in the R session, then I ctrl-c the output directly and ctrl-v it in another R session and the object is already there. But I can’t remember the function.
Thanks.
You will have to pass the data from one session to another. That means you need to (efficiently) serialize the data.
The easiest, by far, will be a
save()followed by aload(). If you want to be fancy, you can use sockets instead of files — seehelp(connections)for details