Export/import 'cim_default' data

Dear mixOmics members,

I am working a lot with block.splsda and cim/cimDiablo functions, and I would like to know how to export/import results of class ‘cim_default’.

Indeed, I start by running ‘cim’, and I store the results in my RStudio global environment
my_result ← cim(…)
As written in the environment, my_result is “Large cim_default”.
I would like to export it and then import it in the RStudio environment from another computer, because this other computer is not powerful enough to run ‘cim’ with my data.

Do you have any idea about how to export/import this data of class ‘cim_default’, for instance by using save/load functions or anything else ? (I’m not really good with this kind of stuff, I rarely use other functions than read.csv and write.csv when I try to import/export data).

Best regards,
Emile

Hi Emilie,
You can simply use the save.image() and load() functions

save.image(“C:/Users/User1/Desktop/XXXXX.RData”)
load(“C:/Users/User1/Desktop/XXXXX.RData”)

  • Christopher
1 Like

Thank you Christopher,

Your answer is not really the one I expected, as I am still unable to save only my cim/cimDiablo results (I get several errors by doing for instance: save.image(cim(pls(X,Y)), file = “my_result.RData”) ).

However, it helped me understand that in my case, the best thing to do is probably to save and load all my R workspace when I move from one of my computers to the other! :slight_smile: I can’t imagine how much time I have lost launching the same code on both computers when I just had to load the .RData from the first one :sweat_smile:
Do you know if this is an usual way to work? Or is it more usual to launch the code on any new computer instead of just loading the .RData file, in case the code would work well on the first computer but not on the second because of R or packages versions differences between the two computers?
(sorry, it is not really related to mixOmics anymore, but it can maybe interest some mixOmics users)

Best regards,
Emile

Hi @emile.mardoc,

Please note that this is not a mixOmics related issue, but rather a general R/Rstudio problem for which you can inquire on general R programming forums (Stackoverflow etc.).

Also, the following code:

Will fails as save.image saves the entire environment. You can read on ?saveRDS and ?readRDS or ?save and ?load.

Best,

Al

Hi Al,

You are right, I firstly thought I had a mixOmics issue while saving mixOmics objects, but it finally appears that I have same issues with other objects too… For now, the idea of saving entirely my environment instead of only specific results is fine to me and works well :slight_smile:

I thank you and apologize for asking for help in the wrong place.

Best regards,
Emile

PS: I am still waiting for news concerning the code I sent you few months ago (new versions of cimDiablo where data is not only normalized but denoised too, thanks to block.splsda or block.spls), let me know when you have a look at it :slight_smile:

Thanks @emile.mardoc,

It is definitely on our list, just a matter of time. Hopefully very soon :slight_smile:

Best,

Al

1 Like