Hi Everybody

I need to "transport" some data and results to use another application
(Sweave via LyX - where debugging is very difficult) in order to build a
report.

Is it possible to store a collection of variables of different types (like
named integers, matricies, data frames and two lists) all in one list and
save it and then simply load it again later and "unpack" the variables.

Thanks is advance
Christiaan

Please see the sample code below.

# Create variables of different types

x=expand.grid(1:4,letters[1:4])

y=matrix(1:1000,ncol=20)

z=list(a=1,b=2:20,c=matrix(1:50,ncol=5))

result.one=1

names(result.one)="first result"

result.two=2

names(result.one)="second result"


# Put them all in list

allvars=list(x,y,z,result.one,result.two)

names(allvars)=c("x","y","z","result.one","result.two")

ls()

[1] "allvars"    "result.one" "result.two" "x"          "y"          "z"

# Save it

save(allvars,file="allvars.Rda")
# Now remove it with rm(allvars) and load it again :

load("allvars.Rda")

What I need here is the magic function that will 'unpack" the list and give
the same results to ls()
ls()

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
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