export: Export a reconstruction of class tabs in various formats

View source: R/export.R

exportR Documentation

Export a reconstruction of class tabs in various formats

Description

export data

Usage

export(x, filename, overwrite = FALSE)

Arguments

x

tabs. Object of class tabs, after running the reconstruct-function.

filename

character. Path where files will be exported. Default as directory tree. Use .qs2, .rds, .zip to save as qs2, rds or zipped directory tree.

overwrite

boolean. Whether to overwrite the output when filename is specified.

Value

No return value, called for side effects

Author(s)

Johannes De Groeve

Examples


# load data samples
sporades <- sporades()
topo <- sporades$topo
labs <- sporades$labs
correction <- sporades$correction
curve <- sporades$curve

# subset first and last period 
curve <- curve[[c(1,dim(curve)[3])]]

# reconstruct
rec <- reconstruct(topo=topo,
                   region=labs,
                   curve=curve,
                   correction=correction,
                   reclabs='name'
                   )

# metadata
md <- metadata(rec)
                   
                   
# export     
dir <- tempdir() # export to temporary directory 
export(rec, paste0(dir,'/sporades.qs2'),overwrite=TRUE) # qs2 (faster and less storage than rds) 
export(rec, paste0(dir,'/sporades.rds'), overwrite=TRUE) # rds / rdata 
export(rec, paste0(dir,'/sporades'), overwrite=TRUE)  # datasets organized in directory  
#export(rec, paste0(dir,'/sporades.zip')) # zipped datasets 
            
                   
# import
rec <- import(filename=paste0(dir,'/sporades.qs2'))
rec <- import(filename=paste0(dir,'/sporades.rds'))
rec <- import(filename=paste0(dir,'/sporades'))
    
# explore 

## tabs class object
if (interactive()){
explore(rec) # comparison present reference and topo-based
explore(rec, timelapse=3) # paleo reconstruction 
}

## from exported object 
if (interactive()){
explore(paste0(dir,'/sporades.qs2'))
explore(paste0(dir,'/sporades.qs2'), timelapse=1)
}

# get area 
area <- get_area(rec) # using object class tabs 
area <- get_area(rec$recvect) # using recvect 

area <- get_area(paste0(dir,'/sporades.qs2')) # using exported object
unlink(dir)



tabs documentation built on April 4, 2025, 2:37 a.m.