Learn R Programming

ursa (version 3.11.1)

envi_files: ENVI File Manipulation

Description

Management of ENVI files similar to functions of OS file manager.

Usage

envi_exists(pattern = ".+", path = ".", all.files = FALSE, full.names = TRUE,
           recursive = FALSE, ignore.case = TRUE, exact = FALSE)
envi_list(pattern = ".+", path = ".", all.files = FALSE, full.names = recursive,
          recursive = FALSE, ignore.case = TRUE, exact = FALSE)
envi_remove(pattern = ".+", path = ".", all.files = FALSE, full.names = recursive,
            recursive = FALSE, ignore.case = TRUE, verbose = FALSE)
envi_copy(src, dst, overwrite = TRUE)
envi_rename(src, dst, overwrite = TRUE)

ursa_exists(fname)

Value

envi_exists() returns integer number of found ENVI files.

envi_list() returns character vector of found ENVI files.

envi_remove() returns character vector of deleted ENVI files.

envi_copy() returns 0L.

envi_rename() returns value of file.rename, which is applied to objects in file system.

ursa_exists() returs TRUE if any *.tif, *.tiff, *.bin, *.hfa file is found.

Arguments

pattern

Either filename (like basename function) or mask in format of regular expressions or full path name.

path

Either path name (like dirname function) or ignored if pattern describes full path.

all.files

A logical value. If FALSE, only the names of visible files are returned. If TRUE, all file names will be returned. Similar to all.files argument in list.files function

full.names

A logical value. If TRUE, the directory path is prepended to the file names to give a relative file path. If FALSE, the file names (rather than paths) are returned. Similar to full.names argument in list.files function

recursive

Logical. Should the listing recurse into directories? Similar to recursive argument in list.files function

ignore.case

Logical. Should pattern-matching be case-insensitive? Similar to ignore.case argument in list.files function

exact

Logical. Attempt to cancel regular expressions.

verbose

Logical. TRUE provides some additional information on console.

src

Strings of length 1 or more. Name or directory name or path of source ENVI files.

dst

Strings of length 1 or more. Name or directory name path of destination ENVI files. Length is assuming to be equal to length of src

overwrite

Logical. TRUE overwrites destinations ENVI files. FALSE does nothing if destinaton ENVI file exists.

fname

Character. Full file name or file pattern with file path.

Author

Nikita Platonov platonov@sevin.ru

Details

Functions do not view content of any files. The major identifier of ENVI files in file system is ENVI header (*.hdr) file. Binary file is searching along 1) original *.envi, *.bin, *.img, *.dat extensions, 2) externally packing *.gz. *.bz2, *.xz extensions, or 3) packed by this package *.envigz, *.bingz extensions. Functions envi_copy() and envi_rename() keeps original extension of ENVI binary file; use file.rename to rename ENVI binary file.

Examples

Run this code
session_grid(NULL)
wd <- setwd(tempdir())
a1 <- create_envi("tmp1.envi")
a2 <- create_envi("tmp2.")
close(a1,a2)
envi_list()
envi_copy("tmp1","tmp3")
envi_copy("tmp2","tmp4")
envi_list()
envi_rename("tmp3","tmp5")
envi_list()
envi_exists("nofilewithsuchname")
envi_exists("tmp[34]")
envi_remove(".+")
envi_list()
setwd(wd)

Run the code above in your browser using DataLab