Greetings R experts,

I'm having some difficulty recovering lda objects that I've saved within sublists using the save.image() function. I am running a script that exports a variety of different information as a list, included within that list is an lda object. I then take that list and create a list of that with all the different replications I've run. Unfortunately I've been having difficulty accessing my lda data when I attempt to get it back after closing and reopening R. Here's an example that would give me the error I'm running into:

> library(MASS)
> ldaobject<-lda(Species~.,data=iris)
> someotherresults<-c(1:5)
> list1<-list(someotherresults,ldaobject)
> list2<-list(list1,list1,list1)

> plot(list2[[1]][[2]])#plots the ldaobject
> save.image('ldalists.Rdata')

###Now if I close my R buffer and reopen it I get:

> load('ldalists.Rdata')
> plot(list2[[1]][[2]])
Error in xy.coords(x, y, xlabel, ylabel, log) :
  'x' is a list, but does not have components 'x' and 'y'

### And my lda obects appear to have changed and look like:
> list2[[1]][[2]]
$prior
    setosa versicolor  virginica
 0.3333333  0.3333333  0.3333333

$counts
    setosa versicolor  virginica
        50         50         50

$means
           Sepal.Length Sepal.Width Petal.Length Petal.Width
setosa            5.006       3.428        1.462       0.246
versicolor        5.936       2.770        4.260       1.326
virginica         6.588       2.974        5.552       2.026

$scaling
                    LD1         LD2
Sepal.Length  0.8293776  0.02410215
Sepal.Width   1.5344731  2.16452123
Petal.Length -2.2012117 -0.93192121
Petal.Width  -2.8104603  2.83918785

$lev
[1] "setosa"     "versicolor" "virginica"

$svd
[1] 48.642644  4.579983

$N
[1] 150

$call
lda(formula = Species ~ ., data = iris)

$terms
Species ~ Sepal.Length + Sepal.Width + Petal.Length + Petal.Width
attr(,"variables")
list(Species, Sepal.Length, Sepal.Width, Petal.Length, Petal.Width)
attr(,"factors")
             Sepal.Length Sepal.Width Petal.Length Petal.Width
Species                 0           0            0           0
Sepal.Length            1           0            0           0
Sepal.Width             0           1            0           0
Petal.Length            0           0            1           0
Petal.Width             0           0            0           1
attr(,"term.labels")
[1] "Sepal.Length" "Sepal.Width"  "Petal.Length" "Petal.Width"
attr(,"order")
[1] 1 1 1 1
attr(,"intercept")
[1] 1
attr(,"response")
[1] 1
attr(,".Environment")
<environment: R_GlobalEnv>
attr(,"predvars")
list(Species, Sepal.Length, Sepal.Width, Petal.Length, Petal.Width)
attr(,"dataClasses")
     Species Sepal.Length  Sepal.Width Petal.Length  Petal.Width
    "factor"    "numeric"    "numeric"    "numeric"    "numeric"

$xlevels
named list()

attr(,"class")
[1] "lda"


If anyone can help me out with a way to circumvent this problem or to recover my data that would be an immense help!

Thanks again!
-Dan



	[[alternative HTML version deleted]]

