library(ggplot2)
## create ggfigdone database in a temporary directory
db_dir1 = file.path(tempdir(), "db1")
db_dir2 = file.path(tempdir(), "db2")
fo1 = fd_init(db_dir1, rm_exist = TRUE)
fo2 = fd_init(db_dir2, rm_exist = TRUE)
## Draw a ggplot figure
g = ggplot(mtcars, aes(x=wt, y=mpg)) + geom_point()
## Add the figure to the database
fd_add(g = g, name = "fig1", fdObj = fo1)
fd_add(g = g + theme_classic(), name = "fig2", fdObj = fo2)
## Merge the databases
fo_merge = fd_merge(from = fo1, to = fo2, replace = "updated_date")
## Show the updated ggfigdone database
print(fo_merge)
##
Run the code above in your browser using DataLab