{file} R# Documentation

file


require(R);

#' File Manipulation
imports "file" from "REnv";

File Manipulation

These functions provide a low-level interface to the computer's file system.



.NET clr function exports
fileSha1

Generate SHA1 checksum of a file

getRelativePath

Gets the relative pathname relative to a directory.

file.size

Extract File Information

Utility function to extract information about files on the user's file systems.

file.path

Construct Path to File Construct the path to a file from components in a platform-independent way.

file.info

Extract File Information Utility function to extract information about files on the user's file systems.

file.copy

file.copy works in a similar way to file.append but with the arguments in the natural order for copying. Copying to existing destination files is skipped unless overwrite = TRUE. The to argument can specify a single existing directory. If copy.mode = TRUE file read/write/execute permissions are copied where possible, restricted by ‘umask’. (On Windows this applies only to files. ) Other security attributes such as ACLs are not copied. On a POSIX filesystem the targets of symbolic links will be copied rather than the links themselves, and hard links are copied separately. Using copy.date = TRUE may or may not copy the timestamp exactly (for example, fractional seconds may be omitted), but is more likely to do so as from R 3.4.0.

file.ext

Get file extension name

dir.copy

copy file contents in one dir to another dir

dir.open

Open an interface to a specific local filesystem location

normalizePath

Express File Paths in Canonical Form Convert file paths to canonical form for the platform, to display them in a user-understandable form and so that relative and absolute paths can be compared.

R.home

Return the R Home Directory Return the R home directory, or the full path to a component of the R installation. The R home directory is the top-level directory of the R installation being run.

The R home directory Is often referred To As R_HOME, And Is the value Of an environment variable Of that name In an R session. It can be found outside an R session by R RHOME.

dirname

dirname returns the part of the path up to but excluding the last path separator, or "." if there is no path separator.

list.files

List the Files in a Directory/Folder

list.dirs

List the Files in a Directory/Folder

file_ext

File Utilities

basename

removes all of the path up to and including the last path separator (if any).

normalizeFileName

removes all of the invalid character for the windows file name

file.exists

file.exists returns a logical vector indicating whether the files named by its argument exist. (Here ‘exists’ is in the sense of the system's stat call: a file will be reported as existing only if you have the permissions needed by stat. Existence can also be checked by file.access, which might use different permissions and so obtain a different result. Note that the existence of a file does not imply that it is readable: for that use file.access.) What constitutes a ‘file’ is system-dependent, but should include directories. (However, directory names must not include a trailing backslash or slash on Windows.) Note that if the file is a symbolic link on a Unix-alike, the result indicates if the link points to an actual file, not just if the link exists. Lastly, note the different function exists which checks for existence of R objects.

file.allocate
dir.create

dir.create creates the last element of the path, unless recursive = TRUE. Trailing path separators are discarded. On Windows drives are allowed in the path specification and unless the path is rooted, it will be interpreted relative to the current directory on that drive. mode is ignored on Windows. One of the idiosyncrasies of Windows Is that directory creation may report success but create a directory with a different name, for example dir.create("G.S.") creates '"G.S"’. This is undocumented, and what are the precise circumstances is unknown (and might depend on the version of Windows). Also avoid directory names with a trailing space.

dir.exists

dir.exists returns a logical vector of TRUE or FALSE values (without names).

readLines

Read Text Lines from a Connection Read some or all text lines from a connection.

readText

Reads all characters from the current position to the end of the given stream.

writeLines

Write Lines to a Connection

Write text lines to a connection.

getwd

getwd returns an absolute filepath representing the current working directory of the R process;

setwd

setwd(dir) is used to set the working directory to dir.

save.list

Save a R# object list in json file format

read.list

read list from a given json file

file

Functions to create, open and close connections, i.e., "generalized files", such as possibly compressed files, URLs, pipes, etc.

readBin

ransfer Binary Data To and From Connections

Read binary data from or write binary data to a connection or raw vector.

writeBin
close

close connections, i.e., “generalized files”, such as possibly compressed files, URLs, pipes, etc.

open.zip

open a zip file

open.gzip

decompression of a gzip file and get the deflate file data stream.

buffer

create a new buffer object

tempfile

Create Names for Temporary Files

tempfile returns a vector of character strings which can be used as names for temporary files.

tempdir

Create Names For Temporary Files

file.rename

File renames

file.remove

Delete files or directories

file.remove attempts to remove the files named in its argument. On most Unix platforms ‘file’ includes empty directories, symbolic links, fifos and sockets. On Windows, ‘file’ means a regular file and not, say, an empty directory.

Delete files or directories

erase

delete all contents in target directory

is.sysdir
dataUri

read file as data URI string

bytes

create a in-memory byte stream object


[Document Index]