[R] Loading file to use with qda()

Uwe Ligges ligges at statistik.uni-dortmund.de
Sat Nov 15 15:42:23 CET 2003


Kwang Kim wrote:

> z <- qda(train, cl)
> save(z, file = "qda.dat")
> load("qda.dat")
> predict(qda.dat, test)$class
> 
> I'm trying to save z where z <-qda(train, cl) and load z for later use in predict(z, test)$class.
> I think I successfully saved z by save(z, file = "qda.dat") but when I tried to load by load("qda.dat") and
> call predict(qda.dat, test)$class, it gives me error 'object qda.dat is not found'.
> 
> Does anybody have an idea?

You saved an object called z in a file called qda.dat. After loading the
file qda.dat, the object called z is in your workspace, so you can use:

predict(z, test)$class

Maybe you called z in the former session also qda.dat (like the file),
but you saved only the object called z ...

Uwe Ligges




More information about the R-help mailing list