[Sciviews-commits] r481 - in pkg: SciViews SciViews/R SciViews/man SciViews/vignettes svDialogs/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Jun 11 14:33:55 CEST 2012


Author: phgrosjean
Date: 2012-06-11 14:33:55 +0200 (Mon, 11 Jun 2012)
New Revision: 481

Added:
   pkg/SciViews/man/character.Rd
Modified:
   pkg/SciViews/DESCRIPTION
   pkg/SciViews/NAMESPACE
   pkg/SciViews/NEWS
   pkg/SciViews/R/SciViews-internal.R
   pkg/SciViews/R/character.R
   pkg/SciViews/R/graphics.R
   pkg/SciViews/man/SciViews-package.Rd
   pkg/SciViews/vignettes/correlation.Rnw
   pkg/SciViews/vignettes/correlation.lyx
   pkg/SciViews/vignettes/introduction.Rnw
   pkg/SciViews/vignettes/introduction.lyx
   pkg/SciViews/vignettes/pca.Rnw
   pkg/SciViews/vignettes/pca.lyx
   pkg/svDialogs/R/menu.R
Log:
Some more work on character function in SciViews package

Modified: pkg/SciViews/DESCRIPTION
===================================================================
--- pkg/SciViews/DESCRIPTION	2012-05-06 19:40:20 UTC (rev 480)
+++ pkg/SciViews/DESCRIPTION	2012-06-11 12:33:55 UTC (rev 481)
@@ -1,7 +1,7 @@
 Package: SciViews
 Type: Package
-Version: 0.9-7
-Date: 2012-04-01
+Version: 0.9-8
+Date: 2012-06-11
 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	2012-05-06 19:40:20 UTC (rev 480)
+++ pkg/SciViews/NAMESPACE	2012-06-11 12:33:55 UTC (rev 481)
@@ -8,6 +8,7 @@
 	   cHeight,
 	   cLower,
 	   cMatch,
+	   cPMatch,
 	   cSearch,
 	   cSplit,
 	   cSubstr,
@@ -34,12 +35,11 @@
 	   "encoding<-",
 	   as.integerBase,
 	   rx,
-	   rxFind,
-	   rxFindAll,
-	   rxSearch,
-	   rxSplit,
-	   rxSub,
-	   rxSubAll,
+	   perl,
+	   is.rx,
+	   is.perl,
+	   useBytes,
+	   "useBytes<-",
 	   path,
 	   as.path,
 	   is.path,
@@ -133,6 +133,9 @@
 
 S3method(print, s)
 
+S3method(print, rx)
+S3method(print, perl)
+
 S3method(vectorplot, default)
 S3method(vectorplot, loadings)
 S3method(vectorplot, correlation)

Modified: pkg/SciViews/NEWS
===================================================================
--- pkg/SciViews/NEWS	2012-05-06 19:40:20 UTC (rev 480)
+++ pkg/SciViews/NEWS	2012-06-11 12:33:55 UTC (rev 481)
@@ -1,5 +1,10 @@
 = SciViews News
 
+== SciViews version 0.9-8
+
+* Several changes in character.R.
+
+
 == SciViews version 0.9-7
 
 * Small corrections in man pages.

Modified: pkg/SciViews/R/SciViews-internal.R
===================================================================
--- pkg/SciViews/R/SciViews-internal.R	2012-05-06 19:40:20 UTC (rev 480)
+++ pkg/SciViews/R/SciViews-internal.R	2012-06-11 12:33:55 UTC (rev 481)
@@ -61,5 +61,5 @@
         assign(x, value, envir = .TempEnv())
 
 ## This is for convenience: . == .GlobalEnv
-.assignTemp(".", base::.GlobalEnv)
+#.assignTemp(".", base::.GlobalEnv)
 

Modified: pkg/SciViews/R/character.R
===================================================================
--- pkg/SciViews/R/character.R	2012-05-06 19:40:20 UTC (rev 480)
+++ pkg/SciViews/R/character.R	2012-06-11 12:33:55 UTC (rev 481)
@@ -2,7 +2,7 @@
 ## and that are renamed/rationalized for facility
 
 ## TODO: deal with zero length strings and NAs appropriately in all functions
-## TODO: make.names, make.unique, abbreviate
+## 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!
@@ -10,140 +10,176 @@
 #nzChar <- nzchar
 
 ## Format character strings
-cEscape <- get("encodeString", envir = baseenv())
-cWrap <- get("strwrap", envir = baseenv())
-# Add cPad => pad a string left/right or both or Pad/PadL/PadR?
+cEscape <- base::encodeString
+cWrap <- base::strwrap
+# Add cPad => pad a string left/right or both or chrPad/chrPadL/chrPadR?
 #+sprintf/gettextf?
 
-## String find/replace using fixed pattern (char*) or regular expressions (rx*)
-## TODO: a rx object which prints an example of its work! => fine-tune it
-## to make it easy to experiment with the rx object
-rx <- glob2rx # This is in utils package
+## String find/replace using fixed pattern or regular expressions
+rx <- function (pattern, use.bytes = FALSE, globbing,
+trim.head = FALSE, trim.tail = TRUE)
+{
+	## Construct an rx 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")
+	if (isTRUE(as.logical(use.bytes))) attr(pattern, "useBytes") <- TRUE
+	pattern
+}
 
-cSearch <- function (x, pattern, ignore.case = FALSE,
-type = c("logical", "position", "value"), ...) # ... for useBytes
+print.rx <- function (x, ...)
 {
-	type <- pmatch(type)
-	res <- switch(type,
-		logical = grepl(pattern, x, ignore.case = ignore.case,
-			fixed = TRUE, ...),
-		position = grep(pattern, x, ignore.case = ignore.case, value = FALSE,
-			fixed = TRUE, ...),
-		value = grep(pattern, x, ignore.case = ignore.case, value = TRUE,
-			fixed = TRUE, ...),
-		stop("Unknown type"))
-	return(res)
+	msg <- "Regular expression pattern"
+	if (useBytes(x)) {
+		msg <- paste(msg, "(byte-by-byte):\n")
+	} else msg <- paste(msg, ":\n", sep = "")
+	cat(msg)
+	print(as.character(x))
 }
 
-rxSearch <- function (x, pattern, ignore.case = FALSE, max.distance = 0,
-type = c("logical", "position", "value"), ...) # ... for Perl & useBytes
+is.rx <- function (x) inherits(x, "rx")
+
+perl <- function (pattern, use.bytes = FALSE)
 {
+	pattern <- as.character(pattern)
+	class(pattern) <- c("perl", "rx", "character")
+	if (isTRUE(as.logical(use.bytes))) attr(pattern, "useBytes") <- TRUE
+	pattern
+}
+
+print.perl <- function (x, ...)
+{
+	msg <- "Perl-compatible regular expression pattern"
+	if (useBytes(x)) {
+		msg <- paste(msg, "(byte-by-byte):\n")
+	} else msg <- paste(msg, ":\n", sep = "")
+	cat(msg)
+	print(as.character(x))
+}
+
+is.perl <- function (x) inherits(x, "perl")
+
+useBytes <- function (x) isTRUE(attr(x, "useBytes"))
+
+`useBytes<-` <- function (x, value)
+{
+	if (!is.character(x)) x <- as.character(x)
+	attr(x, "useBytes") <- isTRUE(as.logical(value))
+	x
+}
+
+cSearch <- function (x, pattern, ignore.case = FALSE,
+type = c("logical", "position", "value"), max.distance = 0, costs = NULL)
+{
 	type <- pmatch(type)
-	## If max.distance > 0, use approximate search
-	if (max.distance > 0) { # Use agrep()
+	if (!is.rx(pattern)) { # Search fixed string
 		res <- switch(type,
-			logical = 1:length(x) %in% agrep(pattern, x,
-				ignore.case = ignore.case, value = FALSE,
-				max.distance = max.distance, ...),
-			position = agrep(pattern, x, ignore.case = ignore.case,
-				value = FALSE, max.distance = max.distance, ...),
-			value = agrep(pattern, x, ignore.case = ignore.case,
-				value = TRUE, max.distance = max.distance, ...),
-			stop("Unknown type"))
-	} else { # Use regular search (grep())
-		res <- switch(type,
 			logical = grepl(pattern, x, ignore.case = ignore.case,
-				fixed = FALSE, ...),
-			position = grep(pattern, x, ignore.case = ignore.case,
-				value = FALSE, fixed = FALSE, ...),
-			value = grep(pattern, x, ignore.case = ignore.case,
-				value = TRUE, fixed = FALSE, ...),
+				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"))
+		}
 	}
-	return(res)
+	res
 }
 
 ## Inconsistencies: regexpr(pattern, text, ...) and strsplit(x, xplit, ...)
-cFind <- function (x, pattern, ignore.case = FALSE, ...) # ... for useBytes
-	return(regexpr(pattern, text = x, ignore.case = ignore.case, fixed = TRUE,
-		...))
+## Solved with the present versions!
+cFind <- 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))
 	
-rxFind <- function (x, pattern, ignore.case = FALSE, ...) # ... for perl & useBytes
-	return(regexpr(pattern, text = x, ignore.case = ignore.case, fixed = FALSE,
-		...))
-	
-cFindAll <- function (x, pattern, ignore.case = FALSE, ...) # ... for useBytes
-	return(gregexpr(pattern, text = x, ignore.case = ignore.case, fixed = TRUE,
-		...))
-	
-rxFindAll <- function (x, pattern, ignore.case = FALSE, ...) # ... for perl & useBytes
-	return(gregexpr(pattern, text = x, ignore.case = ignore.case, fixed = FALSE,
-		...))
+cFindAll <- 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))
 
-cSub <- function (x, pattern, replacement, ignore.case = FALSE, ...) # ... for useBytes
-	return(sub(pattern, replacement, x, ignore.case = ignore.case, fixed = TRUE,
-		...))
+cSub <- 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))
 	
-rxSub <- function (x, pattern, replacement, ignore.case = FALSE, ...) # ... for Perl & useBytes
-	return(sub(pattern, replacement, x, ignore.case = ignore.case, fixed = FALSE,
-		...))
-	
-cSubAll <- function (x, pattern, replacement, ignore.case = FALSE, ...) # ... for useBytes
-	return(gsub(pattern, replacement, x, ignore.case = ignore.case, fixed = TRUE,
-		...))
-	
-rxSubAll <- function (x, pattern, replacement, ignore.case = FALSE, ...) # ... for Perl & useBytes
-	return(gsub(pattern, replacement, x, ignore.case = ignore.case, fixed = FALSE,
-		...))
+cSubAll <- 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))
 
-
 ## Substrings
-cSplit <- function (x, pattern, ...) # ... for useBytes
-	return(strsplit(x, split = pattern, fixed = TRUE, ...))
-	
-rxSplit <- function (x, pattern, ...) # for perl & useBytes
-	return(strsplit(x, split = pattern, fixed = FALSE, ...))
+cSplit <- function (x, pattern)
+	strsplit(x, split = pattern, fixed = !is.rx(pattern),
+		perl = is.perl(pattern), useBytes = useBytes(pattern))
 
-cSubstr <- get("substr", envir = baseenv())
-`cSubstr<-` <- get("substr<-", envir = baseenv())
-cTrunc <- get("strtrim", envir = baseenv()) ## This indeed truncs strings!!!
+cSubstr <- base::substr
+`cSubstr<-` <- base::`substr<-`
+cTrunc <- 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 <- get("paste0", envir = baseenv())
+	p <- base::paste0
 } else {
-	p <- function (..., sep = "", collapse = NULL) 
-		paste(..., sep = sep, collapse = collapse)
+	p <- function (..., collapse = NULL) 
+		paste(..., sep = "", collapse = collapse)
 }
 	
-p_ <- get("paste", envir = baseenv())
+p_ <- base::paste
 
 ## 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.
 ## TODO: by default, interpret unicode and formatting like ucat() or ecat()!
-ct <- function (..., file = "", sep = "", end = "\n", fill = FALSE,
-labels = NULL, append = FALSE)
-	return(cat(..., end, file = file, sep = sep, fill = fill, labels = labels,
-		append = append))
+ct <- function (..., file = "", end = "\n", fill = FALSE,
+labels = NULL)
+	cat(..., end, file = file, sep = "", fill = fill, labels = labels,
+		append = FALSE)
 
-cta <- function (..., file = "", sep = "", end = "\n", fill = FALSE,
+cta <- function (..., file = "", end = "\n", fill = FALSE,
 labels = NULL)
-	return(cat(..., end, file = file, sep = sep, fill = fill, labels = labels,
-		append = TRUE))
+	cat(..., end, file = file, sep = "", fill = fill, labels = labels,
+		append = TRUE)
 
 ct_ <- function (..., file = "", sep = " ", end = "\n", fill = FALSE,
-labels = NULL, append = FALSE)
-	return(cat(..., end, file = file, sep = sep, fill = fill, labels = labels,
-		append = append))
+labels = NULL)
+	cat(..., end, file = file, sep = sep, fill = fill, labels = labels,
+		append = FALSE)
 
-cta_ <- function (..., file = " ", sep = "", end = "\n", fill = FALSE,
+cta_ <- function (..., file = "", sep = " ", end = "\n", fill = FALSE,
 labels = NULL)
-	return(cat(..., end, file = file, sep = sep, fill = fill, labels = labels,
-		append = TRUE))
+	cat(..., end, file = file, sep = sep, fill = fill, labels = labels,
+		append = TRUE)
 
 	
 cTrim <- function (x, all.spaces = FALSE) # Trim both sides
@@ -152,50 +188,51 @@
 	## Trim left first
 	x <- cSub(p("^", pat), "", x)
 	## ... then trim right
-	return(cSub(p(pat, "$"), "", x))
+	cSub(p(pat, "$"), "", x)
 }
 
 cTrimL <- function (x, all.spaces = FALSE) # Trim left-side only
-{
-	pat <- (if (isTRUE(all.spaces)) "^[[:space:]]+" else "^[[:blank:]]+")
-	return(cSub(pat, "", x))
-}
+	cSub(if (isTRUE(all.spaces)) "^[[:space:]]+" else "^[[:blank:]]+", "", x)
 
 cTrimR <- function (x, all.spaces = FALSE) # Trim right-side only
-{
-	pat <- (if (isTRUE(all.spaces)) "[[:space:]]+$" else "[[:blank:]]+$")
-	return(cSub(pat, "", x))
-}
+	cSub(if (isTRUE(all.spaces)) "[[:space:]]+$" else "[[:blank:]]+$", "", x)
 
 
 ## Change case and translate
-cTrans <- get("chartr", envir = baseenv())
-cFold <- get("casefold", envir = baseenv())
-cLower <- get("tolower", envir = baseenv())
-cUpper <- get("toupper", envir = baseenv())
+cTrans <- function (x, old, new) chartr(old = old, new = new, x = x)
+cFold <- base::casefold
+cLower <- base::tolower
+cUpper <- base::toupper
 
 ## Character encoding
-encodingToNative <- get("enc2native", envir = baseenv())
-encodingToUTF8 <- get("enc2utf8", envir = baseenv())
-encoding <- get("Encoding", envir = baseenv())
-`encoding<-` <- get("Encoding<-", envir = baseenv())
+encodingToNative <- base::enc2native
+encodingToUTF8 <- base::enc2utf8
+encoding <- base::Encoding
+`encoding<-` <- base::`Encoding<-`
 
 ## Measure size of a string (package graphics)
-cHeight <- strheight # From package graphics
-cWidth <- strwidth # From package graphics
+cHeight <- graphics::strheight
+cWidth <- graphics::strwidth
 
-## Match and expand character strings to a list of items
-cExpand <- get("char.expand", envir = baseenv())
-cMatch <- get("charmatch", envir = baseenv())
-# What to do with pmatch()???
+## Match, expand or abbreviate character strings to a list of items
+cAbbreviate <- 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)
 
+cExpand <- function (x, target, nomatch = NA_character_)
+	char.expand(input = x, target = target, nomatch = nomatch)
+
+cMatch <- base::charmatch
+cPMatch <- base::pmatch
+
 ## Conversion to character string... no change required
 #as.character
 
 # To avoid using strtoi(), we prefer as.integerBase (because as.integer cannot
 # be converted into a generic function, because it is a primitive!)
 #charToInt <- strtoi # Allows to choose the base used for char representation
-as.integerBase <- get("strtoi", envir = baseenv())
+as.integerBase <- base::strtoi
 
 ## Define a function that takes: singular/plural msg and a vector of strings
 ## and construct a single string with:
@@ -204,5 +241,4 @@
 ## plural msg: item1, item2, ..., itemN
 #+paste = cChar? + my special character string manipulation functions?
 
-#sAbbreviate <- abbreviate
 

Modified: pkg/SciViews/R/graphics.R
===================================================================
--- pkg/SciViews/R/graphics.R	2012-05-06 19:40:20 UTC (rev 480)
+++ pkg/SciViews/R/graphics.R	2012-06-11 12:33:55 UTC (rev 481)
@@ -183,7 +183,8 @@
 plotWindowInternal <- graphics::plot.window
 plotInternal <- graphics::plot.xy
 boxplotInternal <- graphics::bxp
-filledplotInternal <- graphics::.filled.contour
+## Apparently not in R 2.14.0!
+#filledplotInternal <- graphics::.filled.contour
 
 
 ## grDevices ###################################################################

Modified: pkg/SciViews/man/SciViews-package.Rd
===================================================================
--- pkg/SciViews/man/SciViews-package.Rd	2012-05-06 19:40:20 UTC (rev 480)
+++ pkg/SciViews/man/SciViews-package.Rd	2012-06-11 12:33:55 UTC (rev 481)
@@ -13,8 +13,8 @@
   \tabular{ll}{
     Package: \tab SciViews\cr
     Type: \tab Package\cr
-    Version: \tab 0.9-7\cr
-    Date: \tab 2012-04-01\cr
+    Version: \tab 0.9-8\cr
+    Date: \tab 2012-06-11\cr
     License: \tab GPL (>= 2)\cr
     LazyLoad: \tab yes\cr
   }

Added: pkg/SciViews/man/character.Rd
===================================================================
--- pkg/SciViews/man/character.Rd	                        (rev 0)
+++ pkg/SciViews/man/character.Rd	2012-06-11 12:33:55 UTC (rev 481)
@@ -0,0 +1,172 @@
+\name{character-fun}
+\alias{ct}
+\alias{cta}
+\alias{ct_}
+\alias{cta_}
+\alias{p}
+\alias{p_}
+\alias{cTrans}
+\alias{cFold}
+\alias{cLower}
+\alias{cUpper}
+\alias{cSplit}
+\alias{cTrim}
+\alias{cTrimL}
+\alias{cTrimR}
+\alias{cTrunc}
+\alias{cSubstr} 
+\alias{cSubstr<-}
+\alias{cSearch}
+\alias{cFind}
+\alias{cFindAll}
+\alias{cSub}
+\alias{cSubAll}
+\alias{cMatch}
+\alias{cPMatch}
+\alias{cExpand}
+\alias{cAbbreviate}
+\alias{cEscape}
+\alias{cWrap}
+\alias{cHeight}
+\alias{cWidth}
+
+\title{Character strings manipulation functions}
+
+\description{
+  A series of functions to manipulate character objects.
+}
+
+\usage{
+## 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
+cTrans(x, old, new)
+cFold(x, upper = FALSE)
+cLower(x)
+cUpper(x)
+
+## Split, truncate or work with substrings
+cTrim(x, all.spaces = FALSE)
+cTrimL(x, all.spaces = FALSE)
+cTrimR(x, all.spaces = FALSE)
+cTrunc(x, width)
+cSubstr(x, start, stop) 
+cSubstr(x, start, stop) <- value
+cSplit(x, pattern)
+
+## Find and replace in character strings
+cSub(x, pattern, replacement, ignore.case = FALSE)
+cSubAll(x, pattern, replacement, ignore.case = FALSE)
+cFind(x, pattern, ignore.case = FALSE)
+cFindAll(x, pattern, ignore.case = FALSE)
+cSearch(x, pattern, ignore.case = FALSE,
+    type = c("logical", "position", "value"), max.distance = 0, costs = NULL)
+
+## Match, expand or abbreviate character strings
+cMatch(x, table, nomatch = NA_integer_) 
+cPMatch(x, table, nomatch = NA_integer_, duplicates.ok = FALSE)
+cExpand(x, target, nomatch = NA_character_)
+cAbbreviate(x, min.length = 4, dot = FALSE, strict = FALSE,
+    method = c("left.kept", "both.sides"))
+
+## Format character strings
+cEscape(x, width = 0L, quote = "", na.encode = TRUE,
+    justify = c("left", "right", "centre", "none")) 
+cWrap(x, width = 0.9 * getOption("width"), indent = 0, exdent = 0, 
+    prefix = "", simplify = TRUE, initial = prefix)
+
+## Measure size of a character string or expression in a graph
+cHeight(s, units = "user", cex = NULL, font = NULL, vfont = NULL, \dots)
+cWidth(s, units = "user", cex = NULL, font = NULL, vfont = NULL, \dots)
+}
+
+\arguments{
+  \item{\dots}{ a series of character strings or objects that can be coerced to
+    character. }
+  \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
+    return. }
+  \item{fill}{ a logical or positive numeric. With \code{FALSE} (default), only
+    carriage returns (\code{"\n"}) create new lines. With \code{TRUE}, strings
+    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{x}{ a character string or an object that can be coerced to character. }
+  \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
+    is used with a warning if length is higher than two. }
+  \item{upper}{ a logical indicating if conversion is done to upper- or lowercase. }
+  \item{all.spaces}{ eliminate all spacing characters, or only blanks? }
+  \item{width}{ todo }
+  \item{start}{ todo }
+  \item{stop}{ todo }
+  \item{value}{ todo }
+  \item{pattern}{ todo }
+  \item{replacement}{ todo }
+  \item{ignore.case}{ todo }
+  \item{type}{ todo }
+  \item{max.distance}{ todo }
+  \item{costs}{ todo }
+  \item{table}{ todo }
+  \item{nomatch}{ todo }
+  \item{duplicates.ok}{ todo }
+  \item{target}{ todo }
+  \item{min.length}{ todo }
+  \item{dot}{ todo }
+  \item{strict}{ todo }
+  \item{method}{ todo }
+  \item{quote}{ todo }
+  \item{na.encode}{ todo }
+  \item{justify}{ todo }
+  \item{indent}{ todo }
+  \item{exdent}{ todo }
+  \item{prefix}{ todo }
+  \item{simplify}{ todo }
+  \item{initial}{ todo }
+  \item{s}{ todo }
+  \item{units}{ todo }
+  \item{cex}{ todo }
+  \item{font}{ todo }
+  \item{vfont}{ todo }
+}
+
+\details{
+  All these functions start with a lowercase c before an uppercase letter to
+  indicate that they operate on, character strings and coerce their first
+  argument \code{x} to a character object.
+  
+  \code{cEscape(x)} ...
+}
+
+\value{
+  Most of these functions return a modified character string object, except ...
+}
+
+\author{
+  Philippe Grosjean <phgrosjean at sciviews.org>, but most functions are wrappers
+  around existing functions written by the R Core Team in base, or recommended
+  packages.
+}
+
+\seealso{ \code{\link[base]{character}} } %, \code{\link{rx}} }
+
+\examples{
+## TODO: various examples of character string manipulations 
+}
+
+\keyword{character}
+
+\concept{ character strings manipulation }


Property changes on: pkg/SciViews/man/character.Rd
___________________________________________________________________
Added: svn:executable
   + *

Modified: pkg/SciViews/vignettes/correlation.Rnw
===================================================================
--- pkg/SciViews/vignettes/correlation.Rnw	2012-05-06 19:40:20 UTC (rev 480)
+++ pkg/SciViews/vignettes/correlation.Rnw	2012-06-11 12:33:55 UTC (rev 481)
@@ -5,7 +5,7 @@
 \usepackage{berasans}
 \usepackage{beramono}
 \usepackage[T1]{fontenc}
-\usepackage[utf8x]{inputenc}
+\usepackage[utf8]{inputenc}
 \usepackage{color}
 \usepackage{babel}
 \usepackage{latexsym}

Modified: pkg/SciViews/vignettes/correlation.lyx
===================================================================
--- pkg/SciViews/vignettes/correlation.lyx	2012-05-06 19:40:20 UTC (rev 480)
+++ pkg/SciViews/vignettes/correlation.lyx	2012-06-11 12:33:55 UTC (rev 481)
@@ -18,7 +18,7 @@
 \maintain_unincluded_children false
 \language english
 \language_package default
-\inputencoding utf8x
+\inputencoding utf8
 \fontencoding global
 \font_roman palatino
 \font_sans berasans

Modified: pkg/SciViews/vignettes/introduction.Rnw
===================================================================
--- pkg/SciViews/vignettes/introduction.Rnw	2012-05-06 19:40:20 UTC (rev 480)
+++ pkg/SciViews/vignettes/introduction.Rnw	2012-06-11 12:33:55 UTC (rev 481)
@@ -5,7 +5,7 @@
 \usepackage{berasans}
 \usepackage{beramono}
 \usepackage[T1]{fontenc}
-\usepackage[utf8x]{inputenc}
+\usepackage[utf8]{inputenc}
 \usepackage{color}
 \usepackage{babel}
 \usepackage{latexsym}

Modified: pkg/SciViews/vignettes/introduction.lyx
===================================================================
--- pkg/SciViews/vignettes/introduction.lyx	2012-05-06 19:40:20 UTC (rev 480)
+++ pkg/SciViews/vignettes/introduction.lyx	2012-06-11 12:33:55 UTC (rev 481)
@@ -18,7 +18,7 @@
 \maintain_unincluded_children false
 \language english
 \language_package default
-\inputencoding utf8x
+\inputencoding utf8
 \fontencoding global
 \font_roman palatino
 \font_sans berasans

Modified: pkg/SciViews/vignettes/pca.Rnw
===================================================================
--- pkg/SciViews/vignettes/pca.Rnw	2012-05-06 19:40:20 UTC (rev 480)
+++ pkg/SciViews/vignettes/pca.Rnw	2012-06-11 12:33:55 UTC (rev 481)
@@ -5,7 +5,7 @@
 \usepackage{berasans}
 \usepackage{beramono}
 \usepackage[T1]{fontenc}
-\usepackage[utf8x]{inputenc}
+\usepackage[utf8]{inputenc}
 \usepackage{color}
 \usepackage{babel}
 \usepackage{latexsym}

Modified: pkg/SciViews/vignettes/pca.lyx
===================================================================
--- pkg/SciViews/vignettes/pca.lyx	2012-05-06 19:40:20 UTC (rev 480)
+++ pkg/SciViews/vignettes/pca.lyx	2012-06-11 12:33:55 UTC (rev 481)
@@ -18,7 +18,7 @@
 \maintain_unincluded_children false
 \language english
 \language_package default
-\inputencoding utf8x
+\inputencoding utf8
 \fontencoding global
 \font_roman palatino
 \font_sans berasans

Modified: pkg/svDialogs/R/menu.R
===================================================================
--- pkg/svDialogs/R/menu.R	2012-05-06 19:40:20 UTC (rev 480)
+++ pkg/svDialogs/R/menu.R	2012-06-11 12:33:55 UTC (rev 481)
@@ -651,7 +651,7 @@
 }
 
 .macMenuClear <- function () {
-	stop("Not implemented yet!")
+	#stop("Not implemented yet!")
 	
 #	## To be called when svDialogs package loads: make sure to zap all
 #    ## custom menu items that may have been previously defined
@@ -669,17 +669,17 @@
 
 .macMenuNames <- function ()
 {
-	stop("Not implemented yet!")
+	#stop("Not implemented yet!")
 }
 
 .macMenuItems <- function (menuname)
 {
-	stop("Not implemented yet!")
+	#stop("Not implemented yet!")
 }
 
 .macMenuAdd <- function (menuname)
 {
-    stop("Not implemented yet!")
+    #stop("Not implemented yet!")
 	
 #	## Menus are folders created in ~/Scripts/Applications/R/Custom
 #    ## I just need to create (recursively) the directories
@@ -690,7 +690,7 @@
 
 .macMenuAddItem <- function (menuname, itemname, action)
 {
-	stop("Not implemented yet!")
+	#stop("Not implemented yet!")
 	
 #	## TODO: manage 'enable' and 'disable'!!!
 #	## Make sure that the dir is created
@@ -732,7 +732,7 @@
 
 .macMenuDel <- function (menuname)
 {
-	stop("Not implemented yet!")
+	#stop("Not implemented yet!")
 	
 #	## Unlink does not like ~ => change working dir first
 #    odir <- getwd()
@@ -744,7 +744,7 @@
 
 .macMenuDelItem <- function (menuname, itemname)
 {
-	stop("Not implemented yet!")
+	#stop("Not implemented yet!")
 
 #    ## Unlink does not like ~ => change working dir first
 #    odir <- getwd()



More information about the Sciviews-commits mailing list