findPrefix: Find a Prefix Based on Names of Existing Files

Description Usage Arguments Details Value Author(s) Examples

View source: R/projectFuns.r

Description

Find the prefixes or suffixes of files with a given suffix or prefix in a directory.

Usage

1
2
findPrefix(suffix,path=".")
findSuffix(prefix,path=".")

Arguments

suffix

character vector of suffixes

prefix

character vector of prefixes

path

directory to look for files in

Details

The function findPrefix locates all files in a directory that end with one of the provided suffixes; where as findSuffix locates all files that start with the given prefixes.

Value

A character vector of all the prefixes or sufixes of files in the working directory that matched to one of the given suffixes.

Author(s)

Anisa Egeli, Vancouver Island University, Nanaimo BC

Examples

1
2
3
4
5
6
7
8
local(envir=.PBSmodEnv,expr={
  edir = system.file("examples", package="PBSmodelling")
  print(findPrefix(suffix=c(".txt", ".r"),path=edir)); cat("\n")

  #or use R's dir for similar functionality
  print(dir(pattern="txt$",path=edir)); cat("\n")
  print(dir(pattern="^[a-h]",path=edir)); cat("\n")
})

PBSmodelling documentation built on May 19, 2017, 5:05 p.m.

Search within the PBSmodelling package
Search all R packages, documentation and source code