Utility

0th

Percentile

Useful utility functions for file/directory exploration and manipulation.

Wrappers for dirname, file.choose, readLines. file.create, file.path to be called directly for listing directories, creating files, showing the files in a directory, and listing the content of files in a directory. fileCreate gives the functionality of file.choose(new=TRUE). filesList combines file.choose, dirname, and list.files to show the files in a directory, fileScan extends this and then returns the first few lines of each readable file

Keywords
~kwd1 , ~kwd2
Usage
fileScan(f = NULL, nlines = 3, max = NULL, from = 1, filter = NULL)
filesList(f=NULL)
filesInfo(f=NULL,max=NULL)
fileCreate(newName="new.file")
Arguments
f

File path to use as base path (will use file.choose() if missing. If f is a directory, will list the files in that directory, if f is a file, will find the directory for that file and then list all of those files.)

nlines

How many lines to display

max

maximum number of files to display

from

First file (number) to display

filter

Just display files with "filter" in the name

newName

The name of the file to be created.

Details

Just a collection of simple wrappers to powerful core R functions. Allows the user more direct control of what directory to list, to create a file, or to display the content of files. The functions called include file.choose, file.path, file.info,file.create, dirname, and dir.exists. All of these are very powerful functions, but not easy to call interactively.

Note

Work arounds for core-R functions for interactive file manipulation

See Also

read.file to read in data from a file or read.clipboard from the clipboard. dfOrder to sort data.frames.

Aliases
  • fileScan
  • fileCreate
  • filesList
  • filesInfo
  • Utility
Examples
# NOT RUN {
#all of these require interactive input and thus are not given as examples
#fileCreate("my.new.file.txt")
#filesList()   #choose the items in the directory where a file is displayed
#fileScan() #show the content of the files in a director 
#or, if you have a file in mind
# f <- file.choose()  #go find it
#filesList(f)
#fileScan(f)

# }
Documentation reproduced from package psych, version 1.8.12, License: GPL (>= 2)

Community examples

Looks like there are no examples yet.