[Rd] Fwd: R - C programm. calling load() from within C code

javier garcia - CEBAS rn001 at cebas.csic.es
Tue Apr 26 11:03:41 CEST 2005


Hi!

I've already asked in in R-help, but it seems that is more a topic for this
list.

This is the first time I'm trying to write a C program to be linked with R by
my own and I've got one (main) problem

1) I've got a stack of big matrixes, so to manage them I' using save() in the
 preparation process to save workspace (they are about 1000 matrixes and each

one occupies 4.2 MB in my hard disk):
> for ( i in 1:1000) {

	...
	save(temp, file=paste("temp_matrix",i,"R.sav",sep=""))
}


Later on, I would need to be able to use something like
load(paste("temp_matrix",i,"R.sav",sep=""))

to reload the corresponding matrix in each of the loops running within the C
code, and to be able to load this matrix, (called temp) into the C code.

I've tried to load the vector into the R workspace using load(a[i]) where a
is a vector with names of the maps, and also passing a list a in the call to
the C code, where each element of the list a[[i]] is the name of each map,
and tried to extract this names in the list to be used along with the
expresion, but nothing works.

With the html R-extensions help I've been able to load existing R objects in
run time into C, but I'm not able to use load() to put saved R object into
the R workspace and load them in C afterwards. Please, have anyone tried to
use this succesfully? Or you have any clue?


Thanks a lot for your help

Best regards,

Javier



More information about the R-devel mailing list