Hi!

In those cases, I use R.utils::saveObject() and loadObject().
You would have to save each object separately though:

saveObject(x1, file="file.Rbin")
y <- loadObject(file="file.Rbin")

HTH
Ivan

--
Dr. Ivan Calandra
TraCEr, laboratory for Traceology and Controlled Experiments
MONREPOS Archaeological Research Centre and
Museum for Human Behavioural Evolution
Schloss Monrepos
56567 Neuwied, Germany
+49 (0) 2631 9772-243
https://www.researchgate.net/profile/Ivan_Calandra

On 28/07/2018 14:36, K. Elo wrote:
Hi!

Maybe not the most elegant solution, but a workaround is to have a
function:

save2<-function(y, ...) { save(y,...)}
save2(x1,x2,file="test.RData")
The point is to include the variables to be "renamed" as parameters (in
my example: y). The function will use the parameter variable names when
saving the file.

HTH,
Kimmo

2018-07-28, 17:04 +0530, Christofer Bogaso wrote:
Hi,

Let say I have 2 objects as below

x1 = 1:3
x2 = 5:4

Now I want to save both x1 and x2 in some RData file, however x1 will
be
saved with a different name e.g. y

I tried below

save(y = x1, x2, file = "file.RData")

However still they are saved in their original names i.e. x1 and x2,
not y
and y2.

Is there any possibility that I can achieve above without explicitly
copying y = x1 before y is passed to save()

Thanks for any feedback.

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-gui
de.html
and provide commented, minimal, self-contained, reproducible code.
______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to