Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I add to an existing lazy database in R without having to recreate everything?

I created a database "mydb" that when run with lazyLoad("mydb") import in the workspace the (big) data.frames X and Y. I created "mydb" putting X and Y in an environment e and using the command tools:::makeLazyLoadDB(e,"mydb")

Now I created a third data.frame Z (quite big as well).

How can I add it to "mydb" without having to recreate the lazy objects for X and Y as well?

like image 977
lucacerone Avatar asked Feb 05 '14 18:02

lucacerone


1 Answers

You need to save your workspace and try adding Dataframe Z into environment and again run tools:::makeLazyLoadDB(e,"mydb") , please find example below

e=new.env(parent=emptyenv()); e$x=10; e$y=20; tools:::makeLazyLoadDB(e,"mydb"); save.image(); lazyLoad("mydb"); e$z=40; tools:::makeLazyLoadDB(e,"mydb"); save.image(); lazyLoad("mydb"); 

You can see your three Data frames x,y,z.

like image 139
Prateek Kale Avatar answered Oct 19 '22 02:10

Prateek Kale