R: The GenericDataFileSet class

GenericDataFileSet {R.filesets} | R Documentation

## The GenericDataFileSet class

### Description

Package: R.filesets
Class GenericDataFileSet

`Object`
`~~|`
`~~+--``FullNameInterface`
`~~~~~~~|`
`~~~~~~~+--``GenericDataFileSet`

Directly known subclasses:
ChecksumFileSet, GenericTabularFileSet, RDataFileSet, RdsFileSet, TabularTextFileSet

public static class GenericDataFileSet
extends FullNameInterface

A GenericDataFileSet object represents a set of `GenericDataFile`s.

### Usage

    GenericDataFileSet(files=NULL, tags="*", depth=NULL, ...,
      .onUnknownArgs=c("error", "warning", "ignore"))

### Arguments

`files` | A `list` of `GenericDataFile`:s or a `GenericDataFileSet`.
`tags` | A `character` `vector` of tags to be used for this file set. The string `"*"` indicates that it should be replaced by the tags part of the file set pathname.
`depth` | An non-negative `integer`.
`...` | Not used.
`.onUnknownArgs` | A `character` string specifying what should occur if there are unknown arguments in `...`.

### Fields and Methods

Methods:

| `anyDuplicated` | -
| `anyNA` | -
| `append` | -
| `appendFiles` | -
| `as.list` | -
| `byName` | -
| `byPath` | -
| `duplicated` | -
| `equals` | -
| `extract` | -
| `getChecksum` | -
| `getChecksumFileSet` | -
| `getDefaultFullName` | -
| `getFile` | -
| `getFileClass` | -
| `getFileSize` | -
| `getFullNames` | -
| `getNames` | -
| `getOneFile` | -
| `getPath` | -
| `getPathnames` | -
| `gunzip` | -
| `gzip` | -
| `hasFile` | -
| `indexOf` | -
| `is.na` | -
| `sortBy` | -
| `unique` | -
| `validate` | -

Methods inherited from FullNameInterface:
appendFullNameTranslator, appendFullNameTranslatorByNULL, appendFullNameTranslatorByTabularTextFile, appendFullNameTranslatorByTabularTextFileSet, appendFullNameTranslatorBycharacter, appendFullNameTranslatorBydata.frame, appendFullNameTranslatorByfunction, appendFullNameTranslatorBylist, clearFullNameTranslator, clearListOfFullNameTranslators, getDefaultFullName, getFullName, getFullNameTranslator, getListOfFullNameTranslators, getName, getTags, hasTag, hasTags, resetFullName, setFullName, setFullNameTranslator, setListOfFullNameTranslators, setName, setTags, updateFullName

Methods inherited from Object:
$, $<-, [[, [[<-, as.character, attach, attachLocally, clearCache, clearLookupCache, clone, detach, equals, extend, finalize, getEnvironment, getFieldModifier, getFieldModifiers, getFields, getInstantiationTime, getStaticInstance, hasField, hashCode, ll, load, names, objectSize, print, save

### Author(s)

Henrik Bengtsson

### Examples

    # Setup a file set
    path <- system.file(package="R.filesets")
    ds <- GenericDataFileSet$byPath(path)

    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    # Data set
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    cat("Path of data set:\n")
    print(getPath(ds))

    cat("Fullname of data set:\n")
    print(getFullName(ds))

    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    # Data files
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    cat("Pathnames:\n")
    print(getPathnames(ds))

    cat("Filenames:\n")
    print(sapply(ds, getFilename))

    cat("Extensions:\n")
    print(sapply(ds, getExtension))

    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    # Subsetting
    # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    n <- length(ds)
    ds2 <- extract(ds, 1:n)
    print(ds2)

    ds3 <- extract(ds, n:1)
    print(ds3)

    stopifnot(identical(rev(getPathnames(ds3)), getPathnames(ds2)))

    idxs <- c(1,2,NA,n,NA)
    ds4 <- extract(ds, idxs, onMissing="NA")
    print(ds4)
    print(getFullNames(ds4))
    print(getFiles(ds4))

    stopifnot(identical(is.na(idxs), unname(is.na(getPathnames(ds4)))))

[Package R.filesets version 2.11.0 Index]