fileMDB: An MDB (Modeled DataBase) based on files: fileMDB

View source: R/fileMDB.R

$.chMDBR Documentation

An MDB (Modeled DataBase) based on files: fileMDB

Description

An MDB (Modeled DataBase) based on files: fileMDB

Rename tables of a fileMDB object

Usage

## S3 method for class 'chMDB'
x$i

fileMDB(
  dataFiles,
  dbInfo,
  dataModel,
  readParameters = DEFAULT_READ_PARAMS,
  collectionMembers = NULL,
  check = TRUE,
  n_max = 10,
  verbose = FALSE
)

## S3 replacement method for class 'fileMDB'
names(x) <- value

## S3 method for class 'fileMDB'
rename(.data, ...)

## S3 method for class 'fileMDB'
x[i]

## S3 method for class 'fileMDB'
x[[i]]

## S3 method for class 'fileMDB'
x$i

Arguments

x

a fileMDB object

i

the index or the name of the tables to take

dataFiles

a named vector of path to data files with all(names(dataFiles) %in% names(dataModel))

dbInfo

a list with DB information: "name" (only mandatory field), "title", "description", "url", "version", "maintainer".

dataModel

a ReDaMoR::RelDataModel object

readParameters

a list of parameters for reading the data file. (e.g. list(delim='\t', quoted_na=FALSE,))

collectionMembers

the members of collections as provided to the collection_members<- function (default: NULL ==> no member).

check

logical: if TRUE (default) the data are confronted to the data model

n_max

maximum number of records to read for checks purpose (default: 10). See also ReDaMoR::confront_data().

verbose

if TRUE display the data confrontation report (default: FALSE)

value

new table names

.data

a fileMDB object

...

Use new_name = old_name to rename selected tables

Value

A fileMDB object

See Also

  • MDB methods: db_info, data_model, data_tables, collection_members, count_records, dims, filter_with_tables, as_fileMDB

  • Additional general documentation is related to MDB.

  • filter.fileMDB, slice.fileMDB

Examples

hpof <- read_fileMDB(
   path=system.file("examples/HPO-subset", package="ReDaMoR"),
   dataModel=system.file("examples/HPO-model.json", package="ReDaMoR"),
   dbInfo=list(
      "name"="HPO",
      "title"="Data extracted from the HPO database",
      "description"=paste(
         "This is a very small subset of the HPO!",
         "Visit the reference URL for more information"
      ),
      "url"="http://human-phenotype-ontology.github.io/"
   )
)
count_records(hpof)

## The following commands take time on fileMDB object
## Not run: 

select(hpof, HPO_hp:HPO_diseases)
toTake <- "HPO_altId"
select(hpof, all_of(toTake))

hpoSlice <- slice(hpof, HPO_diseases=1:10)
count_records(hpoSlice)

if("stringr" %in% installed.packages()[,"Package"]){
   epilHP <- filter(
      hpof,
      HPO_diseases=stringr::str_detect(
         label, stringr::regex("epilepsy", ignore_case=TRUE)
      )
   )
   count_records(epilHP)
   label <- "Rolandic epilepsy"
   cn <- sym("label")
   reHP <- filter(
      hpof,
      HPO_diseases=!!cn==!!label
   )
}


## End(Not run)

TKCat documentation built on Feb. 16, 2023, 10:51 p.m.