EcoNumData: Create, manipulate, save and load EcoNumData objects

Description Usage Arguments Value Author(s) See Also Examples

Description

EcoNumData objects are data frames with metadata that are saved in a specific way in both local and remote EcoNumData repositories. They are basic building blocks for a simplified, file-based LIMS (Laboratory Information Management System) as it is using at UMONS EcoNum.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
new_econum_data(
  x,
  metadata = list(project = "", sample = "", sample_date =
    get_opt_econum("def_sample_date"), author = "", date = Sys.time(), comment = NULL,
    topic = NULL),
  class = NULL
)

## S3 method for class 'EcoNumData'
print(x, ...)

## S3 method for class 'EcoNumData'
summary(object, ...)

## S3 method for class 'summary.EcoNumData'
print(x, ...)

validate(object, ...)

## S3 method for class 'EcoNumData'
validate(object, file = NULL, ...)

repos_save(object, envir = .GlobalEnv, local = TRUE, remote = TRUE, ...)

## S3 method for class 'EcoNumData'
repos_save(object, envir = .GlobalEnv, local = TRUE, remote = TRUE, ...)

repos_load(file, backup_existing = FALSE, ...)

Arguments

x

Some data.

metadata

A list of various metadata, with, as a minimum: 'project', 'sample', 'sample_date' and 'author'.

class

The (optional) class of the EcoNumData object to create (it will subclass both EcoNumData and data.frame).

...

Further arguments to pass to the function.

object

Any object, but for EcoNumData methods, it must be an EcoNumData object.

file

The file path to where the object is stored in either the local or the remote repository.

envir

An environment where to assign the EcoNumData object (.GlobalEnv by default).

local

Logical (TRUE by default). Should we save the object in the local repository, defined by get_opt_econum("local_repos").

remote

Logical (TRUE by default). Should we save the object in the remote repository, defined by get_opt_econum("remote_repos").

backup_existing

Logical (FALSE by default). Should we backup an object of the same name as the one that is loaded (it will become <obj>2)?

Value

For new_econum_data(), the object that is just created. It is a data.frame with a 'metadata' attribute, as a minimum, and it inherits from both EcoNumData and data.frame.

For validate(), the object is returned possibly corrected by using a series of validation rules (and warnings are usually issued if something is changed).

For repos_save(), a vector of three named character strings, with 'object' being the name of the object containing the item in the global workspace, 'local_file' being the path to the .RData file in the local repository (or NA if it was not saved there) and 'remote_file' being the path to the .Rdata file as saved in the remote repository (or NA if it was not saved there). This is returned invisibly.

For repos_load(), the name of the object that is reloaded is returned invisibly.

Author(s)

Philippe Grosjean Philippe.Grosjean@umons.ac.be

See Also

options_econum(), time_to_fingerprint()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
## Not run: 
# Save some generic EcoNumData
res <- repos_save(new_ecomum_data(data.frame(x = 1, y = 2)), remote = FALSE)
# The data is in .GlobalEnv
EcoNumData
summary(EcoNumData)

# Can be erased and reloaded from the repository later on
rm(EcoNumData)
get(repos_load(res["local_file"]))

# Delete the object from memory
rm(EcoNumData)
# ... and from the disk
unlink(res["local_file"])
# If the project subdirectory is empty, remove it
local_dir <- dirname(res["local_file"])
if (length(dir(local_dir)) == 0) unlink(local_dir, recursive = TRUE)
rm(local_dir)

## End(Not run)

EcoNum/econum documentation built on May 9, 2020, 3:57 a.m.