[Sciviews-commits] r543 - in pkg/SciViews: . R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Feb 10 19:28:05 CET 2014
Author: phgrosjean
Date: 2014-02-10 19:28:05 +0100 (Mon, 10 Feb 2014)
New Revision: 543
Added:
pkg/SciViews/man/as.intBase.Rd
pkg/SciViews/man/file.Rd
pkg/SciViews/man/regex.Rd
Modified:
pkg/SciViews/DESCRIPTION
pkg/SciViews/NAMESPACE
pkg/SciViews/NEWS
pkg/SciViews/R/character.R
pkg/SciViews/R/file.R
pkg/SciViews/man/SciViews-package.Rd
pkg/SciViews/man/character.Rd
Log:
More documentation of SciViews functions
Modified: pkg/SciViews/DESCRIPTION
===================================================================
--- pkg/SciViews/DESCRIPTION 2014-01-06 14:47:13 UTC (rev 542)
+++ pkg/SciViews/DESCRIPTION 2014-02-10 18:28:05 UTC (rev 543)
@@ -1,7 +1,7 @@
Package: SciViews
Type: Package
-Version: 0.9-11
-Date: 2013-08-28
+Version: 0.9-12
+Date: 2014-02-10
Title: SciViews GUI API - Main package
Authors at R: c(person("Philippe", "Grosjean", role = c("aut", "cre"),
email = "phgrosjean at sciviews.org"))
Modified: pkg/SciViews/NAMESPACE
===================================================================
--- pkg/SciViews/NAMESPACE 2014-01-06 14:47:13 UTC (rev 542)
+++ pkg/SciViews/NAMESPACE 2014-02-10 18:28:05 UTC (rev 543)
@@ -28,7 +28,7 @@
charUpper,
charWidth,
charWrap,
- p,
+ p0,
p_,
ct,
cta,
@@ -41,10 +41,10 @@
setEncoding,
as.integerBase,
as.intBase,
- rx,
- perl,
- is.rx,
- is.perl,
+ regex,
+ pcre,
+ is.regex,
+ is.pcre,
useBytes,
"useBytes<-",
filePath,
@@ -73,8 +73,10 @@
fileRemove,
fileRename,
fileShow,
- fileSymlink,
+ fileSymLink,
fileTemp,
+ fileTime,
+ fileUMask,
dirCreate,
dirList,
dirR,
@@ -279,8 +281,8 @@
S3method(print, s)
-S3method(print, rx)
-S3method(print, perl)
+S3method(print, regex)
+S3method(print, pcre)
S3method(vectorplot, default)
S3method(vectorplot, loadings)
Modified: pkg/SciViews/NEWS
===================================================================
--- pkg/SciViews/NEWS 2014-01-06 14:47:13 UTC (rev 542)
+++ pkg/SciViews/NEWS 2014-02-10 18:28:05 UTC (rev 543)
@@ -1,5 +1,14 @@
= SciViews News
+== SciViews version 0.9-12
+
+* p() is renamed p0() to avoid a clash with p() in the ascii package.
+
+* rx objects are renamed regex and perl objects are renamec pcre.
+
+* fileSymlink() is renamed fileSymLink() for correct camel case support.
+
+
== SciViews version 0.9-11
* path object is renamed filePath to avoid a clash with a path object in grid
Modified: pkg/SciViews/R/character.R
===================================================================
--- pkg/SciViews/R/character.R 2014-01-06 14:47:13 UTC (rev 542)
+++ pkg/SciViews/R/character.R 2014-02-10 18:28:05 UTC (rev 543)
@@ -4,31 +4,24 @@
## TODO: deal with zero length strings and NAs appropriately in all functions
## TODO: make.names, make.unique, regmatches, grepRaw and charToRaw
-## Count the number of characters
-## No: make an exception: after n (or nz) do not use uppercase!
-#nChar <- nchar
-#nzChar <- nzchar
+#### In regex.Rd ##################################################################
-## Format character strings
-charEscape <- .Recode(base::encodeString)
-charWrap <- base::strwrap
-# Add charPad => pad a string left/right or both or charPad/charPadL/charPadR?
-#+sprintf/gettextf?
-
## String find/replace using fixed pattern or regular expressions
-rx <- function (pattern, use.bytes = FALSE, globbing,
+regex <- function (pattern, use.bytes = FALSE, globbing,
trim.head = FALSE, trim.tail = TRUE)
{
- ## Construct an rx object containing a regular expression pattern
+ ## Construct a regex object containing a regular expression pattern
if (!missing(globbing)) pattern <- utils::glob2rx(globbing,
trim.head = trim.head, trim.tail = trim.tail)
pattern <- as.character(pattern)
- class(pattern) <- c("rx", "character")
+ class(pattern) <- c("regex", "character")
if (isTRUE(as.logical(use.bytes))) attr(pattern, "useBytes") <- TRUE
pattern
}
-print.rx <- function (x, ...)
+is.regex <- function (x) inherits(x, "regex")
+
+print.regex <- function (x, ...)
{
msg <- "Regular expression pattern"
if (useBytes(x)) {
@@ -38,17 +31,16 @@
print(as.character(x))
}
-is.rx <- function (x) inherits(x, "rx")
-perl <- function (pattern, use.bytes = FALSE)
+pcre <- function (pattern, use.bytes = FALSE)
{
pattern <- as.character(pattern)
- class(pattern) <- c("perl", "rx", "character")
+ class(pattern) <- c("pcre", "regex", "character")
if (isTRUE(as.logical(use.bytes))) attr(pattern, "useBytes") <- TRUE
pattern
}
-print.perl <- function (x, ...)
+print.pcre <- function (x, ...)
{
msg <- "Perl-compatible regular expression pattern"
if (useBytes(x)) {
@@ -58,8 +50,11 @@
print(as.character(x))
}
-is.perl <- function (x) inherits(x, "perl")
+is.pcre <- function (x) inherits(x, "pcre")
+
+
+
useBytes <- function (x) isTRUE(attr(x, "useBytes"))
`useBytes<-` <- function (x, value)
@@ -69,94 +64,33 @@
x
}
-charSearch <- function (x, pattern, ignore.case = FALSE,
-type = c("logical", "position", "value"), max.distance = 0, costs = NULL)
-{
- type <- pmatch(type)
- if (!is.rx(pattern)) { # Search fixed string
- res <- switch(type,
- logical = grepl(pattern, x, ignore.case = ignore.case,
- fixed = TRUE, useBytes = useBytes(pattern)),
- position = grep(pattern, x, ignore.case = ignore.case, value = FALSE,
- fixed = TRUE, useBytes = useBytes(pattern)),
- value = grep(pattern, x, ignore.case = ignore.case, value = TRUE,
- fixed = TRUE, useBytes = useBytes(pattern)),
- stop("Unknown type"))
- } else { # Search regular expression
- ## If max.distance > 0, use approximate search
- if (max.distance > 0) { # Use agrep()
- ## No perl expression currently accepted!
- if (is.perl(pattern))
- stop("Perl regular expression not allowed with max.distance > 0")
- res <- switch(type,
- logical = 1:length(x) %in% agrep(pattern, x,
- ignore.case = ignore.case, value = FALSE,
- max.distance = max.distance, costs = costs,
- useBytes = useBytes(pattern)),
- position = agrep(pattern, x, ignore.case = ignore.case,
- value = FALSE, max.distance = max.distance, costs = costs,
- useBytes = useBytes(pattern)),
- value = agrep(pattern, x, ignore.case = ignore.case,
- value = TRUE, max.distance = max.distance, costs = costs,
- useBytes = useBytes(pattern)),
- stop("Unknown type"))
- } else { # Use regular search (grep())
- res <- switch(type,
- logical = grepl(pattern, x, ignore.case = ignore.case,
- fixed = FALSE, perl = is.perl(pattern),
- useBytes = useBytes(pattern)),
- position = grep(pattern, x, ignore.case = ignore.case,
- value = FALSE, fixed = FALSE, perl = is.perl(pattern),
- useBytes = useBytes(pattern)),
- value = grep(pattern, x, ignore.case = ignore.case,
- value = TRUE, fixed = FALSE, perl = is.perl(pattern),
- useBytes = useBytes(pattern)),
- stop("Unknown type"))
- }
- }
- res
-}
-## Inconsistencies: regexpr(pattern, text, ...) and strsplit(x, xplit, ...)
-## Solved with the present versions!
-charFind <- function (x, pattern, ignore.case = FALSE)
- regexpr(pattern, text = x, ignore.case = ignore.case, fixed = !is.rx(pattern),
- perl = is.perl(pattern), useBytes = useBytes(pattern))
-
-charFindAll <- function (x, pattern, ignore.case = FALSE)
- gregexpr(pattern, text = x, ignore.case = ignore.case, fixed = !is.rx(pattern),
- perl = is.perl(pattern), useBytes = useBytes(pattern))
+#### In character.Rd ###########################################################
+## Conversion to character string... + creation and test, shorter versions
+char <- .Recode(base::character)
+as.char <- base::as.character
+is.char <- base::is.character
-charSub <- function (x, pattern, replacement, ignore.case = FALSE)
- sub(pattern, replacement, x, ignore.case = ignore.case, fixed = !is.rx(pattern),
- perl = is.perl(pattern), useBytes = useBytes(pattern))
-
-charSubAll <- function (x, pattern, replacement, ignore.case = FALSE)
- gsub(pattern, replacement, x, ignore.case = ignore.case, fixed = !is.rx(pattern),
- perl = is.perl(pattern), useBytes = useBytes(x))
+## Count the number of characters
+## No: make an exception: after n (or nz) do not use uppercase!
+#nChar <- nchar
+#nzChar <- nzchar
-## Substrings
-charSplit <- function (x, pattern)
- strsplit(x, split = pattern, fixed = !is.rx(pattern),
- perl = is.perl(pattern), useBytes = useBytes(pattern))
-
-charSubstr <- .Recode(base::substr)
-`charSubstr<-` <- .Recode(base::`substr<-`)
-charTrunc <- .Recode(base::strtrim) ## This indeed truncs strings!!!
-
## paste() is rather long name, in comparison with, e.g., c().
## Also the default argument of sep = " " is irritating and is not consistent
## with stop() or warning() for instance, that use sep = "".
## Thus, we define:
if (exists("paste0", envir = baseenv())) { # Starting from R 2.15.0
- p <- .Recode(base::paste0)
+ p0 <- .Recode(base::paste0)
} else {
- p <- function (..., collapse = NULL)
+ p0 <- function (..., collapse = NULL)
paste(..., sep = "", collapse = collapse)
}
p_ <- .Recode(base::paste)
+## TODO: `%+%` for pasting two strings together?!
+
## The same is true for cat() with sep = " "... and the default behaviour of
## not ending with line feed is more confusing that useful => change this
## behaviour by adding a end = "\n" argument.
@@ -181,14 +115,19 @@
cat(..., end, file = file, sep = sep, fill = fill, labels = labels,
append = TRUE)
-
+## Change case and translate
+charTrans <- function (x, old, new) chartr(old = old, new = new, x = x)
+charFold <- base::casefold
+charLower <- .Recode(base::tolower)
+charUpper <- .Recode(base::toupper)
+
charTrim <- function (x, all.spaces = FALSE) # Trim both sides
{
pat <- (if (isTRUE(all.spaces)) "[[:space:]]+" else "[[:blank:]]+")
## Trim left first
- x <- charSub(p("^", pat), "", x)
+ x <- charSub(p0("^", pat), "", x)
## ... then trim right
- charSub(p(pat, "$"), "", x)
+ charSub(p0(pat, "$"), "", x)
}
charTrimL <- function (x, all.spaces = FALSE) # Trim left-side only
@@ -197,44 +136,117 @@
charTrimR <- function (x, all.spaces = FALSE) # Trim right-side only
charSub(if (isTRUE(all.spaces)) "[[:space:]]+$" else "[[:blank:]]+$", "", x)
+charTrunc <- .Recode(base::strtrim) ## This indeed truncs strings!!!
-## Change case and translate
-charTrans <- function (x, old, new) chartr(old = old, new = new, x = x)
-charFold <- base::casefold
-charLower <- .Recode(base::tolower)
-charUpper <- .Recode(base::toupper)
+charSubstr <- .Recode(base::substr)
+`charSubstr<-` <- .Recode(base::`substr<-`)
-## Character encoding
-encodingToNative <- base::enc2native
-encodingToUTF8 <- base::enc2utf8
-encoding <- .Recode(base::Encoding)
-## R CMD check got fooled because it does not find setEncoding... We give it too
-`encoding<-` <- setEncoding <- .Recode(base::`Encoding<-`)
+## Substrings
+charSplit <- function (x, pattern)
+ strsplit(x, split = pattern, fixed = !is.regex(pattern),
+ perl = is.pcre(pattern), useBytes = useBytes(pattern))
-## Measure size of a string (package graphics)
-charHeight <- .Recode(graphics::strheight)
-charWidth <- .Recode(graphics::strwidth)
+## Inconsistencies: regexpr(pattern, text, ...) and strsplit(x, xplit, ...)
+## Solved with the present versions!
+charSub <- function (x, pattern, replacement, ignore.case = FALSE)
+ sub(pattern, replacement, x, ignore.case = ignore.case, fixed = !is.regex(pattern),
+ perl = is.pcre(pattern), useBytes = useBytes(pattern))
+
+charSubAll <- function (x, pattern, replacement, ignore.case = FALSE)
+ gsub(pattern, replacement, x, ignore.case = ignore.case, fixed = !is.regex(pattern),
+ perl = is.pcre(pattern), useBytes = useBytes(x))
+charFind <- function (x, pattern, ignore.case = FALSE)
+ regexpr(pattern, text = x, ignore.case = ignore.case, fixed = !is.regex(pattern),
+ perl = is.pcre(pattern), useBytes = useBytes(pattern))
+
+charFindAll <- function (x, pattern, ignore.case = FALSE)
+ gregexpr(pattern, text = x, ignore.case = ignore.case, fixed = !is.regex(pattern),
+ perl = is.pcre(pattern), useBytes = useBytes(pattern))
+
+charSearch <- function (x, pattern, ignore.case = FALSE,
+type = c("logical", "position", "value"), max.distance = 0, costs = NULL)
+{
+ type <- pmatch(type)
+ if (!is.regex(pattern)) { # Search fixed string
+ res <- switch(type,
+ logical = grepl(pattern, x, ignore.case = ignore.case,
+ fixed = TRUE, useBytes = useBytes(pattern)),
+ position = grep(pattern, x, ignore.case = ignore.case, value = FALSE,
+ fixed = TRUE, useBytes = useBytes(pattern)),
+ value = grep(pattern, x, ignore.case = ignore.case, value = TRUE,
+ fixed = TRUE, useBytes = useBytes(pattern)),
+ stop("Unknown type"))
+ } else { # Search regular expression
+ ## If max.distance > 0, use approximate search
+ if (max.distance > 0) { # Use agrep()
+ ## No pcre expression currently accepted!
+ if (is.pcre(pattern))
+ stop("Perl regular expression not allowed with max.distance > 0")
+ res <- switch(type,
+ logical = 1:length(x) %in% agrep(pattern, x,
+ ignore.case = ignore.case, value = FALSE,
+ max.distance = max.distance, costs = costs,
+ useBytes = useBytes(pattern)),
+ position = agrep(pattern, x, ignore.case = ignore.case,
+ value = FALSE, max.distance = max.distance, costs = costs,
+ useBytes = useBytes(pattern)),
+ value = agrep(pattern, x, ignore.case = ignore.case,
+ value = TRUE, max.distance = max.distance, costs = costs,
+ useBytes = useBytes(pattern)),
+ stop("Unknown type"))
+ } else { # Use regular search (grep())
+ res <- switch(type,
+ logical = grepl(pattern, x, ignore.case = ignore.case,
+ fixed = FALSE, perl = is.pcre(pattern),
+ useBytes = useBytes(pattern)),
+ position = grep(pattern, x, ignore.case = ignore.case,
+ value = FALSE, fixed = FALSE, perl = is.pcre(pattern),
+ useBytes = useBytes(pattern)),
+ value = grep(pattern, x, ignore.case = ignore.case,
+ value = TRUE, fixed = FALSE, perl = is.pcre(pattern),
+ useBytes = useBytes(pattern)),
+ stop("Unknown type"))
+ }
+ }
+ res
+}
+
## Match, expand or abbreviate character strings to a list of items
+charMatch <- .Recode(base::charmatch)
+## There is a faster version in data.table! named chmatch, but is does not
+## exactly the same since it expects characters and do no partial matching!
+
+charPMatch <- .Recode(base::pmatch)
+
+charExpand <- function (x, target, nomatch = NA_character_)
+ char.expand(input = x, target = target, nomatch = nomatch)
+
charAbbrev <- function (x, min.length = 4, dot = FALSE, strict = FALSE,
method = c("left.kept", "both.sides"))
abbreviate(names.arg = x, minlength = min.length, dot = dot, strict = strict,
method = method)
-charExpand <- function (x, target, nomatch = NA_character_)
- char.expand(input = x, target = target, nomatch = nomatch)
-charMatch <- .Recode(base::charmatch)
-## There is a faster version in data.table! named chmatch, but is does not
-## exactly the same since it expects characters and do no partial matching!
+## Format character strings
+charEscape <- .Recode(base::encodeString)
+charWrap <- base::strwrap
+# Add charPad => pad a string left/right or both or charPad/charPadL/charPadR?
+#+sprintf/gettextf?
-charPMatch <- .Recode(base::pmatch)
+## Measure size of a string (package graphics)
+charHeight <- .Recode(graphics::strheight)
+charWidth <- .Recode(graphics::strwidth)
-## Conversion to character string... + creation and test, shorter versions
-char <- .Recode(base::character)
-as.char <- base::as.character
-is.char <- base::is.character
+## Character encoding
+encodingToNative <- base::enc2native
+encodingToUTF8 <- base::enc2utf8
+encoding <- .Recode(base::Encoding)
+## R CMD check got fooled because it does not find setEncoding... We give it too
+`encoding<-` <- setEncoding <- .Recode(base::`Encoding<-`)
+#### In as.intBase.Rd file #####################################################
+
# To avoid using strtoi(), we prefer as.integerBase (because as.integer cannot
# be converted into a generic function, because it is a primitive!)
as.intBase <- as.integerBase <- .Recode(base::strtoi)
Modified: pkg/SciViews/R/file.R
===================================================================
--- pkg/SciViews/R/file.R 2014-01-06 14:47:13 UTC (rev 542)
+++ pkg/SciViews/R/file.R 2014-02-10 18:28:05 UTC (rev 543)
@@ -1,6 +1,6 @@
## Essentially a series of base R function that manipulate files and directories
## and that are renamed/rationalized for facility
-## TODO: Sys.setFileTime => fileTime, Sys.umask
+## TODO: is the object name correctly choosen? or filepath? or fpath?
## A replacement for file.path
filePath <- function (..., fsep = .Platform$file.sep)
@@ -116,13 +116,16 @@
fileExists <- .Recode(get("file.exists", envir = baseenv()))
fileInfo <- .Recode(get("file.info", envir = baseenv()))
fileChmod <- .Recode(get("Sys.chmod", envir = baseenv()))
+fileUMask <- .Recode(get("Sys.umask", envir = baseenv()))
+fileTime <- function (filePath, time)
+ Sys.setFileTime(path = filePath, time = time)
fileRemove <- .Recode(get("file.remove", envir = baseenv()))
## This is "stronger" than fileRemove()!
fileDelete <- function (filePath, recursive = FALSE, force = FALSE)
return(unlink(x = filePath, recursive = recursive, force = force))
fileLink <- .Recode(get("file.link", envir = baseenv()))
-fileSymlink <- .Recode(get("file.symlink", envir = baseenv()))
+fileSymLink <- .Recode(get("file.symlink", envir = baseenv()))
fileReadLink <- function (filePath)
return(structure(Sys.readlink(paths = filePath),
class = c("filePath", "character")))
Modified: pkg/SciViews/man/SciViews-package.Rd
===================================================================
--- pkg/SciViews/man/SciViews-package.Rd 2014-01-06 14:47:13 UTC (rev 542)
+++ pkg/SciViews/man/SciViews-package.Rd 2014-02-10 18:28:05 UTC (rev 543)
@@ -13,8 +13,8 @@
\tabular{ll}{
Package: \tab SciViews\cr
Type: \tab Package\cr
- Version: \tab 0.9-11\cr
- Date: \tab 2013-08-28\cr
+ Version: \tab 0.9-12\cr
+ Date: \tab 2014-02-10\cr
License: \tab GPL (>= 2)\cr
LazyLoad: \tab yes\cr
}
Added: pkg/SciViews/man/as.intBase.Rd
===================================================================
--- pkg/SciViews/man/as.intBase.Rd (rev 0)
+++ pkg/SciViews/man/as.intBase.Rd 2014-02-10 18:28:05 UTC (rev 543)
@@ -0,0 +1,44 @@
+\name{as.intBase}
+\alias{as.integerBase}
+\alias{as.intBase}
+
+\title{Convert strings to integers}
+
+\description{
+ Convert strings to integers according to the given base using the C function
+ \code{strtol}, or choose a suitable base following the C rules.
+}
+
+\usage{
+as.integerBase(x, base = 0L)
+as.intBase(x, base = 0L)
+}
+
+\arguments{
+ \item{x}{ a character vector, or something coercible to this by \code{as.character}. }
+ \item{base}{ an integer which is between 2 and 36 inclusive, or zero (default). }
+}
+
+\details{
+ TODO...
+}
+
+\value{
+ TODO...
+}
+
+\author{
+ This is a wrapper for \code{strtoi()} function in base package.
+}
+
+\seealso{ \code{\link[base]{strtoi}} }
+
+\examples{
+as.intBase(c("0xff", "077", "123"))
+as.intBase(c("ffff", "FFFF"), 16L)
+as.intBase(c("177", "377"), 8L)
+}
+
+\keyword{character}
+
+\concept{ convert character into integer }
Property changes on: pkg/SciViews/man/as.intBase.Rd
___________________________________________________________________
Added: svn:executable
+ *
Modified: pkg/SciViews/man/character.Rd
===================================================================
--- pkg/SciViews/man/character.Rd 2014-01-06 14:47:13 UTC (rev 542)
+++ pkg/SciViews/man/character.Rd 2014-02-10 18:28:05 UTC (rev 543)
@@ -2,28 +2,28 @@
\alias{char}
\alias{as.char}
\alias{is.char}
+\alias{p0}
+\alias{p_}
\alias{ct}
\alias{cta}
\alias{ct_}
\alias{cta_}
-\alias{p}
-\alias{p_}
\alias{charTrans}
\alias{charFold}
\alias{charLower}
\alias{charUpper}
-\alias{charSplit}
\alias{charTrim}
\alias{charTrimL}
\alias{charTrimR}
\alias{charTrunc}
\alias{charSubstr}
\alias{charSubstr<-}
-\alias{charSearch}
+\alias{charSplit}
+\alias{charSub}
+\alias{charSubAll}
\alias{charFind}
\alias{charFindAll}
-\alias{charSub}
-\alias{charSubAll}
+\alias{charSearch}
\alias{charMatch}
\alias{charPMatch}
\alias{charExpand}
@@ -32,6 +32,13 @@
\alias{charWrap}
\alias{charHeight}
\alias{charWidth}
+\alias{useBytes}
+\alias{useBytes<-}
+\alias{encodingToNative}
+\alias{encodingToUTF8}
+\alias{encoding}
+\alias{encoding<-}
+\alias{setEncoding}
\title{Character strings manipulation functions}
@@ -45,16 +52,16 @@
as.char(x, \dots)
is.char(x)
+## Paste strings together
+p0(\dots, collapse = NULL)
+p_(\dots, sep = " ", collapse = NULL)
+
## Concatenate and print strings to the console or in a file
ct(\dots, file = "", end = "\n", fill = FALSE, labels = NULL)
cta(\dots, file = "", end = "\n", fill = FALSE, labels = NULL)
ct_(\dots, file = "", sep = " ", end = "\n", fill = FALSE, labels = NULL)
cta_(\dots, file = "", sep = " ", end = "\n", fill = FALSE, labels = NULL)
-## Paste strings together
-p(\dots, collapse = NULL)
-p_(\dots, sep = " ", collapse = NULL)
-
## character translation or folding
charTrans(x, old, new)
charFold(x, upper = FALSE)
@@ -94,6 +101,13 @@
## Measure size of a character string or expression in a plot
charHeight(s, units = "user", cex = NULL, font = NULL, vfont = NULL, \dots)
charWidth(s, units = "user", cex = NULL, font = NULL, vfont = NULL, \dots)
+
+## String encoding
+encodingToNative(x)
+encodingToUTF8(x)
+encoding(x)
+encoding(x) <- value
+setEncoding(x, value)
}
\arguments{
@@ -103,6 +117,9 @@
\item{\dots}{ a series of character strings or objects that can be coerced to
character, or further arguments passed to or from other methods for
\code{as.char()}. }
+ \item{sep}{ the character string to use to separate successive strings. }
+ \item{collapse}{ an optional character string to separate items in a character
+ vector that is collapsed to a single item. }
\item{file}{ a character string naming a file, or a connection. The default
\code{""} prints to the standard output connection (see \code{\link[base]{cat}}). }
\item{end}{ the character string to append at the end. By default, a carriage
@@ -112,9 +129,6 @@
are formatted within \code{getOption("width")}. With a positive integer,
strings are formatted within this number of characters. }
\item{labels}{ labels of the lines printed. Ignored when \code{fill = FALSE}. }
- \item{sep}{ the character string to use to separate successive strings. }
- \item{collapse}{ an optional character string to separate items in a character
- vector that is collapsed to a single item. }
\item{old}{ a character string with characters to be translated. First element
is used with a warning if length is higher than two. }
\item{new}{ a character string with the translations. First element
@@ -172,7 +186,7 @@
packages.
}
-\seealso{ \code{\link[base]{character}} } %, \code{\link{rx}} }
+\seealso{ \code{\link[base]{character}}, \code{\link{regex}} }
\examples{
## TODO: various examples of character string manipulations
Added: pkg/SciViews/man/file.Rd
===================================================================
--- pkg/SciViews/man/file.Rd (rev 0)
+++ pkg/SciViews/man/file.Rd 2014-02-10 18:28:05 UTC (rev 543)
@@ -0,0 +1,173 @@
+\name{file}
+\alias{filePath}
+\alias{print.filePath}
+\alias{as.filePath}
+\alias{is.filePath}
+\alias{isDir}
+\alias{isFile}
+\alias{fileName}
+\alias{fileDir}
+\alias{fileExpand}
+\alias{fileNormalize}
+\alias{dirR}
+\alias{filePackage}
+\alias{dirTemp}
+\alias{fileTemp}
+\alias{fileFind}
+\alias{dirList}
+\alias{fileList}
+\alias{fileListGlob}
+\alias{dirCreate}
+\alias{fileAccess}
+\alias{fileAppend}
+\alias{fileRename}
+\alias{fileCopy}
+\alias{fileCreate}
+\alias{fileExists}
+\alias{fileInfo}
+\alias{fileChmod}
+\alias{fileUMask}
+\alias{fileTime}
+\alias{fileRemove}
+\alias{fileDelete}
+\alias{fileLink}
+\alias{fileSymLink}
+\alias{fileReadLink}
+\alias{fileShow}
+\alias{wdir}
+\alias{sdir}
+
+
+\title{Files and directories manipulation}
+
+\description{
+ Manipulate files and directories and create or use 'filePath' objects.
+}
+
+\usage{
+## Create, test or print a filePath object
+filePath(\dots, fsep = .Platform$file.sep)
+is.filePath(x)
+as.filePath(x, \dots)
+\method{print}{filePath}(x, \dots)
+
+## Test or manipulate path for files or directories
+isDir(filePath)
+isFile(filePath)
+fileName(filePath)
+fileDir(filePath)
+fileExpand(filePath)
+fileNormalize(filePath, mustWork = FALSE)
+
+## Look for R-associated files or dirs
+dirR(component = "home")
+filePackage(\dots, package = "base", lib.loc = NULL, mustWork = FALSE)
+
+## Temporary directories or files
+dirTemp()
+fileTemp(pattern = "file", tmpdir = tempdir(), fileext = "")
+
+## List of find files and directories
+fileFind(names)
+dirList(filePath = ".", full.names = TRUE, recursive = TRUE)
+fileList(filePath = ".", pattern = NULL, all.files = FALSE, full.names = FALSE,
+ recursive = FALSE, ignore.case = FALSE, include.dirs = FALSE)
+fileListGlob(filePath, dir.mark = FALSE)
+
+## Create, delete, append, etc. files
+dirCreate(path, showWarnings = TRUE, recursive = FALSE, mode = "0777")
+fileAccess(names, mode = 0)
+fileAppend(file1, file2)
+fileRename(from, to)
+fileCopy(from, to, overwrite = recursive, recursive = FALSE, copy.mode = TRUE)
+fileCreate(\dots, showWarnings = TRUE)
+fileExists(\dots)
+
+fileChmod(paths, mode = "0777", use_umask = TRUE)
+fileUMask(mode = NA)
+fileTime(filePath, time)
+fileRemove(\dots)
+fileDelete(filePath, recursive = FALSE, force = FALSE)
+
+## File links and symbolic links
+fileLink(from, to)
+fileSymLink(from, to)
+fileReadLink(filePath)
+
+## Show the content of a file
+fileShow(\dots, header = rep("", nfiles), title = "R Information",
+ delete.file = FALSE, pager = getOption("pager"), encoding = "")
+
+## Working or session directory
+wdir(dir = NULL)
+sdir(dir = NULL)
+}
+
+\arguments{
+ \item{\dots}{ character vector containing file items or file paths. }
+ \item{fsep}{ character used as file separator. }
+ \item{x}{ an object. }
+ \item{filePath}{ a filePath object. }
+ \item{component}{ As well as \code{"home"} which gives the R home directory,
+ other known values are \code{"bin"}, \code{"doc"}, \code{"etc"},
+ \code{"modules"} and \code{"share"} giving the paths to the corresponding
+ parts of an R installation. }
+ \item{package}{ the R package to look for file. }
+ \item{lib.loc}{ the library path to look for the R package. }
+ \item{mustWork}{ should it always return? }
+ \item{pattern}{ pattern to use for the temporary file. }
+ \item{tmpdir}{ temporary directory. }
+ \item{fileext}{ extension of the temporary file. }
+ \item{names}{ file names to find. }
+ \item{full.names}{ return full path names or only file names? }
+ \item{recursive}{ list dirs or files recursively? }
+ \item{all.files}{ return all files? }
+ \item{ignore.case}{ be case insensitive? }
+ \item{include.dirs}{ also list directories? }
+ \item{dir.mark}{ logical: should matches to directories from patterns that do
+ not already end in / have a slash appended? May not be supported on all
+ platforms. }
+ \item{path}{ path to file. }
+ \item{showWarnings}{ warn if dir cannot be created? }
+ \item{mode}{ Unix mode of the file or dir. }
+ \item{file1}{ first file. }
+ \item{file2}{ second file. }
+ \item{from}{ first file. }
+ \item{to}{ second file. }
+ \item{overwrite}{ overwrite the destination file? }
+ \item{copy.mode}{ logical: should file permission bits be copied where
+ possible? This applies to both files and directories. }
+ \item{paths}{ path to files. }
+ \item{use_umask}{ use a mask? }
+ \item{time}{ time to put on the file. }
+ \item{force}{ force file deletion? }
+ \item{header}{ header to use. }
+ \item{title}{ title of the window. }
+ \item{delete.file}{ delete the file once it is displayed? }
+ \item{pager}{ pager to use to display this file. }
+ \item{encoding}{ encoding to use for the file content. }
+ \item{dir}{ directory to set. No change if it is \code{NULL} (by default). }
+}
+
+\details{
+ TODO...
+}
+
+\value{
+ TODO...
+}
+
+\author{
+ Philippe Grosjean <phgrosjean at sciviews.org>, but these are indeed wrappers
+ around existing functions written by the R Core Team in base or utils packages.
+}
+
+\seealso{ \code{\link{char}} }
+
+\examples{
+## TODO: various examples of dirs and files manipulation
+}
+
+\keyword{character}
+
+\concept{ directories and files manipulation }
Property changes on: pkg/SciViews/man/file.Rd
___________________________________________________________________
Added: svn:executable
+ *
Added: pkg/SciViews/man/regex.Rd
===================================================================
--- pkg/SciViews/man/regex.Rd (rev 0)
+++ pkg/SciViews/man/regex.Rd 2014-02-10 18:28:05 UTC (rev 543)
@@ -0,0 +1,63 @@
+\name{regex}
+\alias{regex}
+\alias{is.regex}
+\alias{print.regex}
+\alias{pcre}
+\alias{is.pcre}
+\alias{print.pcre}
+
+\title{Regular expressions}
+
+\description{
+ Create regular expression (either 'regex' -POSIX 1003.2 extended regular
+ expressions- or 'pcre' -perl compatibe regular expressions- objects).
+}
+
+\usage{
+## Create, test or print a regular expression object
+regex(pattern, use.bytes = FALSE, globbing, trim.head = FALSE, trim.tail = TRUE)
+is.regex(x)
+\method{print}{regex}(x, \dots)
+
+## Create, test or print a perl-compatible regular expression object
+pcre(pattern, use.bytes = FALSE)
+is.pcre(x)
+\method{print}{pcre}(x, \dots)
+}
+
+\arguments{
+ \item{pattern}{ character string with the pattern to use for the regular expression. }
+ \item{use.bytes}{ logical. If \code{TRUE}, the matching is done byte-by-byte
+ rather than character-by-character. }
+ \item{globbing}{ character string with wildcard or globbing pattern to be
+ transformed into a regular expression. If provided, \code{pattern} is ignored. }
+ \item{trim.head}{ associated to \code{globbing} only. Specify if \code{"^.*"}
+ should be trimmed from the result. }
+ \item{trim.tail}{ associated to \code{globbing} only. Specify if \code{".*$"}
+ should be trimmed from the result. }
+ \item{x}{ an object. }
+ \item{\dots}{ unused. }
+}
+
+\details{
+ TODO...
+}
+
+\value{
+ TODO...
+}
+
+\author{
+ Philippe Grosjean <phgrosjean at sciviews.org>, but these are indeed wrappers
+ around existing functions written by the R Core Team in base or utils packages.
+}
+
+\seealso{ \code{\link{char}}, \code{\link[base]{character}} }
+
+\examples{
+## TODO: various examples of character string manipulations
+}
+
+\keyword{character}
+
+\concept{ regular expressions for character strings manipulation }
Property changes on: pkg/SciViews/man/regex.Rd
___________________________________________________________________
Added: svn:executable
+ *
More information about the Sciviews-commits
mailing list