cached_ext: cached_ext - cached objects file extension

Description Usage Arguments Details Examples

View source: R/cached_ext.R

Description

A character object representing the extension of a cached object.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
cached_ext(x = character())

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

as_cached_ext(x, exts)

## S3 method for class 'character'
as_cached_ext(x, exts = NULL)

## S3 method for class 'cached_path'
as_cached_ext(x, exts = backends_exts())

## S3 method for class 'cached_file'
as_cached_ext(x, exts = backends_exts())

Arguments

x

object to make a cached_ext object from usually a string or character

...

additional arguments

exts

character; vector of allowed extensions.

Details

The cached_extension of an object is a file extension if it is one of the registered file extensions. For a generic extension object, see ext().

The extension of a cached object is not limited to everything following the final period in an cached object. (This is usually the case.)

A cached_ext is character vector representing one or more extensions of cached objects

as_cached_ext tries to converts unknown types of x to cached_path before coercing to a cached_ext.

as_cached_ext returns the registered backend extensions for x for cached_path and cached_file arguments.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
  # cached_ext()
  cached_ext("rds")
  cached_ext(1)

  as_cached_ext('iris.rds')
  as_cached_ext('cache/iris.rds')

  as_cached_ext( cached_file('iris.rds') )
  as_cached_ext( cached_path('cache/iris.rds') )

  path <- cached_path( c("cache/iris.rds", "cached/mtcars.fst") )
  as_cached_ext(path)

  files <- cached_path( c("iris.rds", "mtcars.fst") )
  as_cached_ext(files)

decisionpatterns/cache documentation built on June 15, 2020, 9:35 p.m.