Thread: [R-gregmisc-users] SF.net SVN: r-gregmisc:[1808] trunk/gtools (Page 2)
Brought to you by:
warnes
|
From: <wa...@us...> - 2014-04-17 16:56:37
|
Revision: 1808
http://sourceforge.net/p/r-gregmisc/code/1808
Author: warnes
Date: 2014-04-17 16:56:34 +0000 (Thu, 17 Apr 2014)
Log Message:
-----------
Add ASCIIfy function posted to RDevel by Arni Magnusson
Modified Paths:
--------------
trunk/gtools/DESCRIPTION
trunk/gtools/NAMESPACE
Added Paths:
-----------
trunk/gtools/R/ASCIIfy.R
trunk/gtools/man/ASCIIfy.Rd
Modified: trunk/gtools/DESCRIPTION
===================================================================
--- trunk/gtools/DESCRIPTION 2014-04-10 02:32:21 UTC (rev 1807)
+++ trunk/gtools/DESCRIPTION 2014-04-17 16:56:34 UTC (rev 1808)
@@ -1,8 +1,8 @@
Package: gtools
Title: Various R programming tools
Description: Various R programming tools
-Version: 3.3.1
-Date: 2014-03-01
+Version: 3.4.0
+Date: 2014-04-15
Author: Gregory R. Warnes, Ben Bolker, and Thomas Lumley
Maintainer: Gregory R. Warnes <gr...@wa...>
License: LGPL-2.1
Modified: trunk/gtools/NAMESPACE
===================================================================
--- trunk/gtools/NAMESPACE 2014-04-10 02:32:21 UTC (rev 1807)
+++ trunk/gtools/NAMESPACE 2014-04-17 16:56:34 UTC (rev 1808)
@@ -4,6 +4,7 @@
addLast,
ask,
assert,
+ ASCIIfy,
binsearch,
capture,
checkRVersion,
Added: trunk/gtools/R/ASCIIfy.R
===================================================================
--- trunk/gtools/R/ASCIIfy.R (rev 0)
+++ trunk/gtools/R/ASCIIfy.R 2014-04-17 16:56:34 UTC (rev 1808)
@@ -0,0 +1,39 @@
+ASCIIfy <- function(string, bytes=2, fallback="?")
+{
+ bytes <- match.arg(as.character(bytes), 1:2)
+ convert <- function(char) # convert to ASCII, e.g. "z", "\xfe", or "\u00fe"
+ {
+ raw <- charToRaw(char)
+ if(length(raw)==1 && raw<=127) # 7-bit
+ ascii <- char
+ else if(length(raw)==1 && bytes==1) # 8-bit to \x00
+ ascii <- paste0("\\x", raw)
+ else if(length(raw)==1 && bytes==2) # 8-bit to \u0000
+ ascii <- paste0("\\u", chartr(" ","0",formatC(as.character(raw),width=4)))
+ else if(length(raw)==2 && bytes==1) # 16-bit to \x00, if possible
+ if(utf8ToInt(char) <= 255)
+ ascii <- paste0("\\x", format.hexmode(utf8ToInt(char)))
+ else {
+ ascii <- fallback; warning(char, " could not be converted to 1 byte")}
+ else if(length(raw)==2 && bytes==2) # UTF-8 to \u0000
+ ascii <- paste0("\\u", format.hexmode(utf8ToInt(char),width=4))
+ else {
+ ascii <- fallback
+ warning(char, " could not be converted to ", bytes, " byte")}
+ return(ascii)
+ }
+
+ if(length(string) > 1)
+ {
+ sapply(string, ASCIIfy, bytes=bytes, fallback=fallback, USE.NAMES=FALSE)
+ }
+ else
+ {
+ input <- unlist(strsplit(string,"")) # "c" "a" "f" "<\'e>"
+ output <- character(length(input)) # "" "" "" ""
+ for(i in seq_along(input))
+ output[i] <- convert(input[i]) # "c" "a" "f" "\\u00e9"
+ output <- paste(output, collapse="") # "caf\\u00e9"
+ return(output)
+ }
+}
Added: trunk/gtools/man/ASCIIfy.Rd
===================================================================
--- trunk/gtools/man/ASCIIfy.Rd (rev 0)
+++ trunk/gtools/man/ASCIIfy.Rd 2014-04-17 16:56:34 UTC (rev 1808)
@@ -0,0 +1,47 @@
+\name{ASCIIfy}
+\alias{ASCIIfy}
+\title{Convert Characters to ASCII}
+\description{
+ Convert character vector to ASCII, replacing non-ASCII characters with
+ single-byte (\samp{\x00}) or two-byte (\samp{\u0000}) codes.
+}
+\usage{
+ASCIIfy(x, bytes = 2, fallback = "?")
+}
+\arguments{
+ \item{x}{a character vector, possibly containing non-ASCII
+ characters.}
+ \item{bytes}{either \code{1} or \code{2}, for single-byte
+ (\samp{\x00}) or two-byte (\samp{\u0000}) codes.}
+ \item{fallback}{an output character to use, when input characters
+ cannot be converted.}
+}
+\value{
+ A character vector like \code{x}, except non-ASCII characters have
+ been replaced with \samp{\x00} or \samp{\u0000} codes.
+}
+\author{Arni Magnusson \email{ar...@ha...}}
+\note{
+ To render single backslashes, use these or similar techniques:
+ \verb{
+ write(ASCIIfy(x), "file.txt")
+ cat(paste(ASCIIfy(x), collapse="\n"), "\n", sep="")}
+
+ The resulting strings are plain ASCII and can be used in R functions
+ and datasets to improve package portability.
+}
+\seealso{
+ \code{\link[tools]{showNonASCII}} identifies non-ASCII characters in
+ a character vector.
+}
+\examples{
+cities <- c("S\u00e3o Paulo", "Reykjav\u00edk")
+print(cities)
+ASCIIfy(cities, 1)
+ASCIIfy(cities, 2)
+
+athens <- "\u0391\u03b8\u03ae\u03bd\u03b1"
+print(athens)
+ASCIIfy(athens)
+}
+\keyword{}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ar...@us...> - 2014-04-18 18:11:23
|
Revision: 1813
http://sourceforge.net/p/r-gregmisc/code/1813
Author: arnima
Date: 2014-04-18 18:11:20 +0000 (Fri, 18 Apr 2014)
Log Message:
-----------
Main arg is 'x' like showNonASCII(x), preformatted notes instead of verb
Modified Paths:
--------------
trunk/gtools/R/ASCIIfy.R
trunk/gtools/man/ASCIIfy.Rd
Modified: trunk/gtools/R/ASCIIfy.R
===================================================================
--- trunk/gtools/R/ASCIIfy.R 2014-04-17 19:05:11 UTC (rev 1812)
+++ trunk/gtools/R/ASCIIfy.R 2014-04-18 18:11:20 UTC (rev 1813)
@@ -1,4 +1,4 @@
-ASCIIfy <- function(string, bytes=2, fallback="?")
+ASCIIfy <- function(x, bytes=2, fallback="?")
{
bytes <- match.arg(as.character(bytes), 1:2)
convert <- function(char) # convert to ASCII, e.g. "z", "\xfe", or "\u00fe"
@@ -23,13 +23,13 @@
return(ascii)
}
- if(length(string) > 1)
+ if(length(x) > 1)
{
- sapply(string, ASCIIfy, bytes=bytes, fallback=fallback, USE.NAMES=FALSE)
+ sapply(x, ASCIIfy, bytes=bytes, fallback=fallback, USE.NAMES=FALSE)
}
else
{
- input <- unlist(strsplit(string,"")) # "c" "a" "f" "<\'e>"
+ input <- unlist(strsplit(x,"")) # "c" "a" "f" "<\'e>"
output <- character(length(input)) # "" "" "" ""
for(i in seq_along(input))
output[i] <- convert(input[i]) # "c" "a" "f" "\\u00e9"
Modified: trunk/gtools/man/ASCIIfy.Rd
===================================================================
--- trunk/gtools/man/ASCIIfy.Rd 2014-04-17 19:05:11 UTC (rev 1812)
+++ trunk/gtools/man/ASCIIfy.Rd 2014-04-18 18:11:20 UTC (rev 1813)
@@ -6,10 +6,10 @@
single-byte (\samp{\x00}) or two-byte (\samp{\u0000}) codes.
}
\usage{
-ASCIIfy(string, bytes = 2, fallback = "?")
+ASCIIfy(x, bytes = 2, fallback = "?")
}
\arguments{
- \item{string}{a character vector, possibly containing non-ASCII
+ \item{x}{a character vector, possibly containing non-ASCII
characters.}
\item{bytes}{either \code{1} or \code{2}, for single-byte
(\samp{\x00}) or two-byte (\samp{\u0000}) codes.}
@@ -23,7 +23,7 @@
\author{Arni Magnusson \email{ar...@ha...}}
\note{
To render single backslashes, use these or similar techniques:
- \verb{
+ \preformatted{
write(ASCIIfy(x), "file.txt")
cat(paste(ASCIIfy(x), collapse="\n"), "\n", sep="")}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wa...@us...> - 2014-05-28 00:24:27
|
Revision: 1816
http://sourceforge.net/p/r-gregmisc/code/1816
Author: warnes
Date: 2014-05-28 00:24:23 +0000 (Wed, 28 May 2014)
Log Message:
-----------
Update for gtools 3.4.1
Modified Paths:
--------------
trunk/gtools/DESCRIPTION
trunk/gtools/inst/NEWS
Modified: trunk/gtools/DESCRIPTION
===================================================================
--- trunk/gtools/DESCRIPTION 2014-05-28 00:18:38 UTC (rev 1815)
+++ trunk/gtools/DESCRIPTION 2014-05-28 00:24:23 UTC (rev 1816)
@@ -1,8 +1,8 @@
Package: gtools
Title: Various R programming tools
Description: Various R programming tools
-Version: 3.4.0
-Date: 2014-04-15
+Version: 3.4.1
+Date: 2014-05-27
Author: Gregory R. Warnes, Ben Bolker, and Thomas Lumley
Maintainer: Gregory R. Warnes <gr...@wa...>
License: LGPL-2.1
Modified: trunk/gtools/inst/NEWS
===================================================================
--- trunk/gtools/inst/NEWS 2014-05-28 00:18:38 UTC (rev 1815)
+++ trunk/gtools/inst/NEWS 2014-05-28 00:24:23 UTC (rev 1816)
@@ -1,3 +1,17 @@
+gtools 3.4.1 - 2014-05-27
+-------------------------
+
+Bug fixes:
+
+- smartbind() now converts all non-atomic type columns (except factor)
+ to type character instead of generating an opaque error message.
+
+Other changes:
+
+- the argument to ASCIIfy() is now named 'x' instead of 'string'.
+
+- minor formatting changes to ASCIIfy() man page.
+
gtools 3.4.0 - 2014-04-14
-------------------------
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wa...@us...> - 2014-08-27 00:36:44
|
Revision: 1871
http://sourceforge.net/p/r-gregmisc/code/1871
Author: warnes
Date: 2014-08-27 00:36:40 +0000 (Wed, 27 Aug 2014)
Log Message:
-----------
Finish adding first(), last(), left(), and right().
Modified Paths:
--------------
trunk/gtools/DESCRIPTION
trunk/gtools/NAMESPACE
trunk/gtools/R/first.R
Added Paths:
-----------
trunk/gtools/man/first.Rd
trunk/gtools/man/left.Rd
Modified: trunk/gtools/DESCRIPTION
===================================================================
--- trunk/gtools/DESCRIPTION 2014-08-27 00:12:52 UTC (rev 1870)
+++ trunk/gtools/DESCRIPTION 2014-08-27 00:36:40 UTC (rev 1871)
@@ -1,8 +1,8 @@
Package: gtools
Title: Various R programming tools
Description: Various R programming tools
-Version: 3.4.1
-Date: 2014-05-27
+Version: 3.4.2
+Date: 2014-08-26
Author: Gregory R. Warnes, Ben Bolker, and Thomas Lumley
Maintainer: Gregory R. Warnes <gr...@wa...>
License: LGPL-2.1
Modified: trunk/gtools/NAMESPACE
===================================================================
--- trunk/gtools/NAMESPACE 2014-08-27 00:12:52 UTC (rev 1870)
+++ trunk/gtools/NAMESPACE 2014-08-27 00:36:40 UTC (rev 1871)
@@ -12,12 +12,15 @@
ddirichlet,
defmacro,
even,
+ first,
foldchange,
foldchange2logratio,
getDependencies,
inv.logit,
invalid,
keywords,
+ last,
+ left,
lastAdd,
logit,
logratio2foldchange,
@@ -27,6 +30,7 @@
permutations,
permute,
quantcut,
+ right,
rdirichlet,
running,
scat,
Modified: trunk/gtools/R/first.R
===================================================================
--- trunk/gtools/R/first.R 2014-08-27 00:12:52 UTC (rev 1870)
+++ trunk/gtools/R/first.R 2014-08-27 00:36:40 UTC (rev 1871)
@@ -4,6 +4,9 @@
first.default <- function(x) x[1]
last.default <- function(x) x[length(x)]
+first.list <- function(x) x[[1]]
+last.list <- function(x) x[[length(x)]]
+
left <- function(x, n=6)
{
n <- min(n, ncol(x))
@@ -13,5 +16,6 @@
right <- function(x, n=6)
{
n <- min(n, ncol(x))
- x[, (ncol(x)-n):ncol(x)]
+ x[, (ncol(x)-n+1):ncol(x)]
}
+
Added: trunk/gtools/man/first.Rd
===================================================================
--- trunk/gtools/man/first.Rd (rev 0)
+++ trunk/gtools/man/first.Rd 2014-08-27 00:36:40 UTC (rev 1871)
@@ -0,0 +1,43 @@
+\name{first}
+\alias{first}
+\alias{last}
+\title{Return first or last element of a vector or list}
+\description{
+ Return first or last element of a vector or list
+}
+\usage{
+first(x)
+last(x)
+\method{first}{default}(x)
+\method{last}{default}(x)
+\method{first}{list}(x)
+\method{last}{list}(x)
+}
+%- maybe also 'usage' for other objects documented here.
+\arguments{
+ \item{x}{vector or list}
+}
+\value{
+ The first or last element of \code{x}.
+}
+\author{
+ Gregory R. Warnes \email{gr...@wa...}
+}
+\seealso{
+ \code{\link[utils]{head}},
+ \code{\link[utils]{tail}},
+ \code{\link{left}},
+ \code{\link{right}}
+}
+\examples{
+## works for vectors..
+v <- 1:10
+first(v)
+last(v)
+
+## and for lists
+l <- list(a=1, b=2, c=3)
+first(l)
+last(l)
+}
+\keyword{ manip }
Added: trunk/gtools/man/left.Rd
===================================================================
--- trunk/gtools/man/left.Rd (rev 0)
+++ trunk/gtools/man/left.Rd 2014-08-27 00:36:40 UTC (rev 1871)
@@ -0,0 +1,39 @@
+\name{left}
+\alias{right}
+\alias{left}
+\title{Return the leftmost or rightmost columns of a matrix or dataframe}
+\description{
+ Return the leftmost or rightmost or columns of a matrix or dataframe
+}
+\usage{
+right(x, n = 6)
+left(x, n=6)
+}
+\arguments{
+ \item{x}{Matrix or dataframe}
+ \item{n}{Number of columns to return}
+}
+\value{
+ An object consisting of the leftmost or rightmost \code{n} columns
+ of \code{x}.
+}
+\author{
+ Gregory R. Warnes \email{gr...@wa...}
+}
+\seealso{
+ \code{\link{first}},
+ \code{\link{last}},
+ \code{\link[utils]{head}},
+ \code{\link[utils]{tail}}
+}
+\examples{
+ m <- matrix( 1:100, ncol=10 )
+ colnames(m) <- paste("Col",1:10, sep="_")
+ left(m)
+ right(m)
+
+ d <- as.data.frame(m)
+ left(d)
+ right(d)
+}
+\keyword{ manip }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wa...@us...> - 2014-10-09 18:56:27
|
Revision: 1897
http://sourceforge.net/p/r-gregmisc/code/1897
Author: warnes
Date: 2014-10-09 18:56:18 +0000 (Thu, 09 Oct 2014)
Log Message:
-----------
Update for 3.5.0 release of gtools
Modified Paths:
--------------
trunk/gtools/DESCRIPTION
trunk/gtools/inst/NEWS
Modified: trunk/gtools/DESCRIPTION
===================================================================
--- trunk/gtools/DESCRIPTION 2014-10-09 18:52:58 UTC (rev 1896)
+++ trunk/gtools/DESCRIPTION 2014-10-09 18:56:18 UTC (rev 1897)
@@ -1,8 +1,8 @@
Package: gtools
Title: Various R programming tools
Description: Various R programming tools
-Version: 3.4.2
-Date: 2014-08-26
+Version: 3.5.0
+Date: 2014-10-09
Author: Gregory R. Warnes, Ben Bolker, and Thomas Lumley
Maintainer: Gregory R. Warnes <gr...@wa...>
License: LGPL-2.1
Modified: trunk/gtools/inst/NEWS
===================================================================
--- trunk/gtools/inst/NEWS 2014-10-09 18:52:58 UTC (rev 1896)
+++ trunk/gtools/inst/NEWS 2014-10-09 18:56:18 UTC (rev 1897)
@@ -1,3 +1,15 @@
+gtools 3.5.0 - 2014-10-08
+-------------------------
+
+New features:
+
+- New functions first() and last() to retrun the first or last
+ element of a vector or list.
+
+- New functions left() and right() to return the leftmost or
+ rightmost n (default to 6) columns of a matrix or dataframe.
+
+
gtools 3.4.1 - 2014-05-27
-------------------------
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wa...@us...> - 2015-04-06 21:40:05
|
Revision: 1914
http://sourceforge.net/p/r-gregmisc/code/1914
Author: warnes
Date: 2015-04-06 21:40:03 +0000 (Mon, 06 Apr 2015)
Log Message:
-----------
- Export S3 methods for first(), last(), left() and right().
- Ensure code matches man page for first(), last(), left(), and right().
Modified Paths:
--------------
trunk/gtools/NAMESPACE
trunk/gtools/R/first.R
Modified: trunk/gtools/NAMESPACE
===================================================================
--- trunk/gtools/NAMESPACE 2015-01-02 20:20:05 UTC (rev 1913)
+++ trunk/gtools/NAMESPACE 2015-04-06 21:40:03 UTC (rev 1914)
@@ -40,3 +40,16 @@
stars.pval,
strmacro
)
+
+S3method(first, default)
+S3method(first, list )
+
+S3method(last, default)
+S3method(last, list )
+
+S3method(left, data.frame)
+S3method(left, matrix)
+
+S3method(right, data.frame)
+S3method(right, matrix)
+
Modified: trunk/gtools/R/first.R
===================================================================
--- trunk/gtools/R/first.R 2015-01-02 20:20:05 UTC (rev 1913)
+++ trunk/gtools/R/first.R 2015-04-06 21:40:03 UTC (rev 1914)
@@ -1,15 +1,18 @@
first <- function(x) UseMethod("first")
last <- function(x) UseMethod("last")
-left <- function(x, n) UseMethod("left")
-right <- function(x, n) UseMethod("left")
+left <- function(x, n=6) UseMethod("left")
+right <- function(x, n=6) UseMethod("left")
+
+
first.default <- function(x) x[1]
last.default <- function(x) x[length(x)]
-first.list <- function(x, ...) x[[1]]
-last.list <- function(x, ...) x[[length(x)]]
+first.list <- function(x) x[[1]]
+last.list <- function(x) x[[length(x)]]
+
left.data.frame <- function(x, n=6)
{
n <- min(n, ncol(x))
@@ -17,6 +20,7 @@
}
left.matrix <- left.data.frame
+
right.data.frame <- function(x, n=6)
{
n <- min(n, ncol(x))
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wa...@us...> - 2015-04-09 19:45:29
|
Revision: 1920
http://sourceforge.net/p/r-gregmisc/code/1920
Author: warnes
Date: 2015-04-09 19:45:21 +0000 (Thu, 09 Apr 2015)
Log Message:
-----------
Move first()/last()/left()/right() to gdata.
Add new functions na.replace() and loadedPackages().
Add more text to package description.
Modified Paths:
--------------
trunk/gtools/DESCRIPTION
trunk/gtools/NAMESPACE
trunk/gtools/inst/ChangeLog
trunk/gtools/inst/NEWS
Added Paths:
-----------
trunk/gtools/R/loadedPackages.R
trunk/gtools/R/na.replace.R
trunk/gtools/man/loadedPackages.Rd
trunk/gtools/man/na.replace.Rd
Modified: trunk/gtools/DESCRIPTION
===================================================================
--- trunk/gtools/DESCRIPTION 2015-04-08 19:55:41 UTC (rev 1919)
+++ trunk/gtools/DESCRIPTION 2015-04-09 19:45:21 UTC (rev 1920)
@@ -1,8 +1,25 @@
Package: gtools
-Title: Various R programming tools
-Description: Various R programming tools
-Version: 3.5.0
-Date: 2014-10-09
+Title: Various R Programming Tools
+Description: Functions to assist in R programming, including:
+ - assist in developing, updating, and maintaning R and R packages ('ask', 'checkRVersion', 'getDependencies', 'keywords', 'scat'),
+ - calculate the logit and inverse logit transformations ('logit', 'inv.logit')
+ - test if a value is missing, empty or contains only NA and NULL values ('invalid')
+ - manipulate R's .Last function ('addLast')
+ - define macros ('defmacro'),
+ - detect odd and even integers ('odd', 'even')
+ - convert strings containig non-ascii characters (like single quotes) to plain ASCII ('ASCIIfy'),
+ - perform a binary search ('binseach')
+ - sort strings containing both numeric and character components ('mixedsort')
+ - create a factor variable from the quantiles of a continuous variable ('quantcut')
+ - enumerate permutations and combinations ('combinations', 'permutation'),
+ - calculate and convert betwen fold-change and log-ratio ('foldchange', 'logratio2foldchange', 'foldchange2logratio'),
+ - calculate probablities and generate random numbers from dirichlet distributions ('rdirichlet', 'ddirichlet')
+ - apply a function over adjacent subsets of a vector ('running')
+ - Modify the TCP\_NODELAY ('de-Nagle') flag for socket objects
+ - Efficient rbind of data frames, even if the column names don't match ('smartbind')
+ - Generate significance stars from p-values ('stars.pval')
+Version: 3.4.2
+Date: 2015-04-06
Author: Gregory R. Warnes, Ben Bolker, and Thomas Lumley
Maintainer: Gregory R. Warnes <gr...@wa...>
License: LGPL-2.1
Modified: trunk/gtools/NAMESPACE
===================================================================
--- trunk/gtools/NAMESPACE 2015-04-08 19:55:41 UTC (rev 1919)
+++ trunk/gtools/NAMESPACE 2015-04-09 19:45:21 UTC (rev 1920)
@@ -19,10 +19,12 @@
invalid,
keywords,
lastAdd,
+ loadedPackages,
logit,
logratio2foldchange,
mixedorder,
mixedsort,
+ na.replace,
odd,
permutations,
permute,
Added: trunk/gtools/R/loadedPackages.R
===================================================================
--- trunk/gtools/R/loadedPackages.R (rev 0)
+++ trunk/gtools/R/loadedPackages.R 2015-04-09 19:45:21 UTC (rev 1920)
@@ -0,0 +1,12 @@
+loadedPackages <- function(silent=FALSE)
+{
+ packageNames <- loadedNamespaces()
+ packageVersions <- sapply(packageNames, function(package) paste(packageVersion(package), sep=".") )
+ packagePaths <- find.package(packageNames)
+ inSearchPath <- match(packageNames, gsub('^package:', '', grep('^package:', search(), value=TRUE)))
+ retval <- data.frame(Name=packageNames, Version=packageVersions, Path=packagePaths, SearchPath=inSearchPath)
+ retval$SearchPath <- na.replace(retval$SearchPath, '-')
+ retval <- retval[order(inSearchPath),]
+ if(!silent) print(retval)
+ retval
+}
Added: trunk/gtools/R/na.replace.R
===================================================================
--- trunk/gtools/R/na.replace.R (rev 0)
+++ trunk/gtools/R/na.replace.R 2015-04-09 19:45:21 UTC (rev 1920)
@@ -0,0 +1,5 @@
+na.replace <- function(x, replace)
+{
+ x[is.na(x)] <- replace
+ x
+}
Modified: trunk/gtools/inst/ChangeLog
===================================================================
--- trunk/gtools/inst/ChangeLog 2015-04-08 19:55:41 UTC (rev 1919)
+++ trunk/gtools/inst/ChangeLog 2015-04-09 19:45:21 UTC (rev 1920)
@@ -1,5 +1,8 @@
2015-04-06 warnes
+ * [r1918] man/dirichlet.Rd: Correct URL
+ * [r1917] inst/ChangeLog, inst/NEWS: Update NEWS and ChangeLog for
+ gtools 3.5.0
* [r1916] inst/ChangeLog: Add ChangeLog files to repository
* [r1915] R/keywords.R: Implement fix to keywords() needed for
R-3.4.1, as suggested by Kurt
Modified: trunk/gtools/inst/NEWS
===================================================================
--- trunk/gtools/inst/NEWS 2015-04-08 19:55:41 UTC (rev 1919)
+++ trunk/gtools/inst/NEWS 2015-04-09 19:45:21 UTC (rev 1920)
@@ -1,13 +1,13 @@
-gtools 3.5.0 - 2015-04-06
+gtools 3.4.2 - 2015-04-06
-------------------------
New features:
-- New functions first() and last() to retrun the first or last
- element of a vector or list.
+- New function loadedPackages() to display name, version, and path of
+ loaded packages (package namespaces).
-- New functions left() and right() to return the leftmost or
- rightmost n (default to 6) columns of a matrix or dataframe.
+- New function: na.replace() to replace missing values within a
+ vector with a specified value.`
Bug fixes:
Added: trunk/gtools/man/loadedPackages.Rd
===================================================================
--- trunk/gtools/man/loadedPackages.Rd (rev 0)
+++ trunk/gtools/man/loadedPackages.Rd 2015-04-09 19:45:21 UTC (rev 1920)
@@ -0,0 +1,37 @@
+\name{loadedPackages}
+\alias{loadedPackages}
+\title{
+ Provide Name, Version, and Path of Loaded Package Namespaces
+}
+\description{
+ Provide name, version, and path of loaded package namespaces
+}
+\usage{
+loadedPackages(silent = FALSE)
+}
+\arguments{
+ \item{silent}{Logical indicating whether the results should be printed}
+}
+\value{
+ Data frame containing one row per loaded package namespace, with columns:
+ \item{Package}{Package name}
+ \item{Version}{Version string}
+ \item{Path}{Path to package files}
+ \item{SearchPath}{Either the index of the package namespace in the current
+ search path, or '-' if the package namespace is not in the search
+ path. '1' corresponds to the top of the search path (the first namespace
+ searched for values). }
+}
+\author{
+ Gregory R. Warnes \email{gr...@wa...}
+}
+\seealso{
+ \code{\link[base]{loadedNamespaces}},
+ \code{\link[utils]{packageVersion}},
+ \code{\link[base]{search}},
+ \code{\link[base]{find.package}}
+}
+\examples{
+ loadedPackages()
+}
+\keyword{package}
Added: trunk/gtools/man/na.replace.Rd
===================================================================
--- trunk/gtools/man/na.replace.Rd (rev 0)
+++ trunk/gtools/man/na.replace.Rd 2015-04-09 19:45:21 UTC (rev 1920)
@@ -0,0 +1,34 @@
+\name{na.replace}
+\alias{na.replace}
+\title{
+ Replace Missing Values
+}
+\description{
+ Replace missing values
+}
+\usage{
+na.replace(x, replace)
+}
+\arguments{
+ \item{x}{vector possibly contining missing (\code{NA}) values.}
+ \item{replace}{scalar replacement value}
+}
+\details{
+ This is a convenience function that is the same as
+ x[is.na(x)] <- replace
+}
+\value{
+ Vector with missing values (\code{NA}) replaced by the
+ value of \code{replace}.
+}
+\author{
+ Gregory R. Warnes \email{gr...@wa...}
+}
+\seealso{
+ \code{\link[base]{is.na}}, \code{\link[stats]{na.omit}}
+}
+\examples{
+ x <- c(1,2,3,NA,6,7,8,NA,NA)
+ na.replace(x, '999')
+}
+\keyword{ manip }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wa...@us...> - 2015-04-23 21:09:21
|
Revision: 1945
http://sourceforge.net/p/r-gregmisc/code/1945
Author: warnes
Date: 2015-04-23 21:09:19 +0000 (Thu, 23 Apr 2015)
Log Message:
-----------
Update for gtools 3.4.3
Modified Paths:
--------------
trunk/gtools/DESCRIPTION
trunk/gtools/inst/ChangeLog
trunk/gtools/inst/NEWS
Modified: trunk/gtools/DESCRIPTION
===================================================================
--- trunk/gtools/DESCRIPTION 2015-04-23 21:06:19 UTC (rev 1944)
+++ trunk/gtools/DESCRIPTION 2015-04-23 21:09:19 UTC (rev 1945)
@@ -1,28 +1,5 @@
-Package: gtools
-Title: Various R Programming Tools
-Description: Functions to assist in R programming, including:
- - assist in developing, updating, and maintaining R and R packages ('ask', 'checkRVersion',
- 'getDependencies', 'keywords', 'scat'),
- - calculate the logit and inverse logit transformations ('logit', 'inv.logit'),
- - test if a value is missing, empty or contains only NA and NULL values ('invalid'),
- - manipulate R's .Last function ('addLast'),
- - define macros ('defmacro'),
- - detect odd and even integers ('odd', 'even'),
- - convert strings containing non-ASCII characters (like single quotes) to plain ASCII ('ASCIIfy'),
- - perform a binary search ('binsearch'),
- - sort strings containing both numeric and character components ('mixedsort'),
- - create a factor variable from the quantiles of a continuous variable ('quantcut'),
- - enumerate permutations and combinations ('combinations', 'permutation'),
- - calculate and convert between fold-change and log-ratio ('foldchange',
- 'logratio2foldchange', 'foldchange2logratio'),
- - calculate probabilities and generate random numbers from Dirichlet distributions
- ('rdirichlet', 'ddirichlet'),
- - apply a function over adjacent subsets of a vector ('running'),
- - Modify the TCP\_NODELAY ('de-Nagle') flag for socket objects,
- - Efficient 'rbind' of data frames, even if the column names don't match ('smartbind'),
- - Generate significance stars from p-values ('stars.pval').
-Version: 3.4.2
-Date: 2015-04-06
+Version: 3.4.3
+Date: 2015-04-23
Author: Gregory R. Warnes, Ben Bolker, and Thomas Lumley
Maintainer: Gregory R. Warnes <gr...@wa...>
License: LGPL-2.1
Modified: trunk/gtools/inst/ChangeLog
===================================================================
--- trunk/gtools/inst/ChangeLog 2015-04-23 21:06:19 UTC (rev 1944)
+++ trunk/gtools/inst/ChangeLog 2015-04-23 21:09:19 UTC (rev 1945)
@@ -1,5 +1,15 @@
+2015-04-23 warnes
+
+ * [r1944] R/smartbind.R, R/strmacro.R: Remove debugging code and
+ stray browser() call
+
+2015-04-14 warnes
+
+ * [r1923] DESCRIPTION: Fix typo
+
2015-04-09 warnes
+ * [r1921] inst/ChangeLog: Update gtools ChangeLog
* [r1920] DESCRIPTION, NAMESPACE, R/loadedPackages.R,
R/na.replace.R, inst/ChangeLog, inst/NEWS, man/loadedPackages.Rd,
man/na.replace.Rd: Move first()/last()/left()/right() to gdata.
Modified: trunk/gtools/inst/NEWS
===================================================================
--- trunk/gtools/inst/NEWS 2015-04-23 21:06:19 UTC (rev 1944)
+++ trunk/gtools/inst/NEWS 2015-04-23 21:09:19 UTC (rev 1945)
@@ -1,3 +1,15 @@
+gtools 3.4.3 - 2015-04-06
+-------------------------
+
+Bug fixes:
+
+- Removed stray browser() call in smartbind().
+
+Other changes:
+
+- Correct typographical errors in package description.
+
+
gtools 3.4.2 - 2015-04-06
-------------------------
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wa...@us...> - 2015-04-23 21:47:51
|
Revision: 1949
http://sourceforge.net/p/r-gregmisc/code/1949
Author: warnes
Date: 2015-04-23 21:47:48 +0000 (Thu, 23 Apr 2015)
Log Message:
-----------
- The 'q' argument to quantcut()'s 'q' now accept an integer
indicating the number of equally spaced quantile groups to
create. (Suggestion and patch submitted by Ryan C. Thompson.)
Modified Paths:
--------------
trunk/gtools/R/quantcut.R
trunk/gtools/man/quantcut.Rd
Modified: trunk/gtools/R/quantcut.R
===================================================================
--- trunk/gtools/R/quantcut.R 2015-04-23 21:23:36 UTC (rev 1948)
+++ trunk/gtools/R/quantcut.R 2015-04-23 21:47:48 UTC (rev 1949)
@@ -1,7 +1,10 @@
# $Id$
-quantcut <- function(x, q=seq(0,1,by=0.25), na.rm=TRUE, ... )
+quantcut <- function(x, q=4, na.rm=TRUE, ... )
{
+ if(length(q)==1)
+ q <- seq(0,1, length.out=q+1)
+
quant <- quantile(x, q, na.rm=na.rm)
dups <- duplicated(quant)
if(any(dups))
Modified: trunk/gtools/man/quantcut.Rd
===================================================================
--- trunk/gtools/man/quantcut.Rd 2015-04-23 21:23:36 UTC (rev 1948)
+++ trunk/gtools/man/quantcut.Rd 2015-04-23 21:47:48 UTC (rev 1949)
@@ -13,8 +13,10 @@
%- maybe also `usage' for other objects documented here.
\arguments{
\item{x}{ Continous variable. }
- \item{q}{ Vector of quantiles used for creating groups. Defaults to
- \code{seq(0, 1, by=0.25)}. See \code{\link{quantile}} for details. }
+ \item{q}{ Either a integer number of equally spaced quantile groups to
+ create, or a vector of quantiles used for creating groups. Defaults to
+ \code{q=4} which is equivalent to \code{q=seq(0, 1, by=0.25)}.
+ See \code{\link{quantile}} for details. }
\item{na.rm}{ Boolean indicating whether missing values should be
removed when computing quantiles. Defaults to TRUE.}
\item{\dots}{ Optional arguments passed to \code{\link{cut}}. }
@@ -31,7 +33,7 @@
of quantile intervals.
}
\value{
- Factor variable with one level for each quantile interval given by \code{q}.
+ Factor variable with one level for each quantile interval.
}
\author{Gregory R. Warnes \email{gr...@wa...}}
@@ -51,13 +53,19 @@
table(quartiles)
## cut into deciles
- deciles <- quantcut( x, seq(0,1,by=0.1) )
- table(deciles)
+ deciles.1 <- quantcut( x, 10 )
+ table(deciles.1)
+ # or equivalently
+ deciles.2 <- quantcut( x, seq(0,1,by=0.1) )
+ \testonly{
+ stopifnot(identical(deciles.1, deciles.2))
+ }
+
## show handling of 'tied' quantiles.
x <- round(x) # discretize to create ties
stem(x) # display the ties
- deciles <- quantcut( x, seq(0,1,by=0.1) )
+ deciles <- quantcut( x, 10 )
table(deciles) # note that there are only 5 groups (not 10)
# due to duplicates
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <wa...@us...> - 2015-04-28 04:16:59
|
Revision: 1975
http://sourceforge.net/p/r-gregmisc/code/1975
Author: warnes
Date: 2015-04-28 04:16:56 +0000 (Tue, 28 Apr 2015)
Log Message:
-----------
Add private function 'checkReverseDependencies'.
Modified Paths:
--------------
trunk/gtools/DESCRIPTION
trunk/gtools/R/mixedsort.R
trunk/gtools/man/mixedsort.Rd
Added Paths:
-----------
trunk/gtools/R/checkReverseDependencies.R
trunk/gtools/R/roman2int.R
trunk/gtools/R/trim.R
trunk/gtools/R/unByteCode.R
trunk/gtools/src/roman2int.c
Removed Paths:
-------------
trunk/gtools/inst/ChangeLog
Modified: trunk/gtools/DESCRIPTION
===================================================================
--- trunk/gtools/DESCRIPTION 2015-04-25 17:16:31 UTC (rev 1974)
+++ trunk/gtools/DESCRIPTION 2015-04-28 04:16:56 UTC (rev 1975)
@@ -1,26 +1,26 @@
Package: gtools
Title: Various R Programming Tools
Description: Functions to assist in R programming, including:
- - assist in developing, updating, and maintaining R and R packages ('ask', 'checkRVersion',
- 'getDependencies', 'keywords', 'scat'),
+ - assist in developing, updating, and maintaining R and R packages ('ask', 'checkRVersion',
+ 'getDependencies', 'keywords', 'scat'),
- calculate the logit and inverse logit transformations ('logit', 'inv.logit'),
- test if a value is missing, empty or contains only NA and NULL values ('invalid'),
- manipulate R's .Last function ('addLast'),
- define macros ('defmacro'),
- detect odd and even integers ('odd', 'even'),
- - convert strings containing non-ASCII characters (like single quotes) to plain ASCII ('ASCIIfy'),
+ - convert strings containing non-ASCII characters (like single quotes) to plain ASCII ('ASCIIfy'),
- perform a binary search ('binsearch'),
- sort strings containing both numeric and character components ('mixedsort'),
- create a factor variable from the quantiles of a continuous variable ('quantcut'),
- enumerate permutations and combinations ('combinations', 'permutation'),
- - calculate and convert between fold-change and log-ratio ('foldchange',
+ - calculate and convert between fold-change and log-ratio ('foldchange',
'logratio2foldchange', 'foldchange2logratio'),
- - calculate probabilities and generate random numbers from Dirichlet distributions
+ - calculate probabilities and generate random numbers from Dirichlet distributions
('rdirichlet', 'ddirichlet'),
- apply a function over adjacent subsets of a vector ('running'),
- - Modify the TCP\_NODELAY ('de-Nagle') flag for socket objects,
- - Efficient 'rbind' of data frames, even if the column names don't match ('smartbind'),
- - Generate significance stars from p-values ('stars.pval').
+ - modify the TCP\_NODELAY ('de-Nagle') flag for socket objects,
+ - efficient 'rbind' of data frames, even if the column names don't match ('smartbind'),
+ - generate significance stars from p-values ('stars.pval').
Version: 3.4.3
Date: 2015-04-23
Author: Gregory R. Warnes, Ben Bolker, and Thomas Lumley
Added: trunk/gtools/R/checkReverseDependencies.R
===================================================================
--- trunk/gtools/R/checkReverseDependencies.R (rev 0)
+++ trunk/gtools/R/checkReverseDependencies.R 2015-04-28 04:16:56 UTC (rev 1975)
@@ -0,0 +1,22 @@
+packagefile="gdata_2.16.0.tar.gz"
+destdir=tempdir()
+
+checkReverseDependencies <- function(packagefile, destdir=tempdir(), cleanup=FALSE )
+ {
+ if(!file.exists(packagefile))
+ stop(packagefile, " does not exist!")
+
+ cat("Using directory '", destdir, "'. Remember to delete it when done.\n", sep='')
+
+ file.copy(packagefile, destdir)
+
+ package <- gsub("_.*$", "", packagefile)
+
+ rdeps <- tools::package_dependencies(package, db=available.packages(), reverse = TRUE)[[1]]
+ cat( length(rdeps), "reverse dependencies:\n")
+ print(rdeps)
+
+ tools::check_packages_in_dir(destdir, reverse=list(), Ncpus=6)
+
+ if(cleanup) unlink(destdir, recursive=TRUE, force=TRUE)
+ }
Modified: trunk/gtools/R/mixedsort.R
===================================================================
--- trunk/gtools/R/mixedsort.R 2015-04-25 17:16:31 UTC (rev 1974)
+++ trunk/gtools/R/mixedsort.R 2015-04-28 04:16:56 UTC (rev 1975)
@@ -1,8 +1,13 @@
# $Id$
-mixedsort <- function(x) x[mixedorder(x)]
+mixedsort <- function(x, decreasing=FALSE, na.last=TRUE, blank.last=FALSE)
+ {
+ ord <- mixedorder(x, decreasing=decreasing, na.last=na.last,
+ blank.last=blank.last)
+ x[ord]
+ }
-mixedorder <- function(x)
+mixedorder <- function(x, decreasing=FALSE, na.last=TRUE, blank.last=FALSE)
{
# - Split each each character string into an vector of strings and
# numbers
@@ -14,10 +19,9 @@
else if(length(x)==1)
return(1)
- if( is.numeric(x) )
- return( order(x) )
+ if( !is.character(x) )
+ return( order(x, decreasing=decreasing, na.last=na.last) )
-
delim="\\$\\@\\$"
numeric <- function(x)
@@ -35,12 +39,6 @@
which.nas <- which(is.na(x))
which.blanks <- which(x=="")
- if(length(which.blanks) >0)
- x[ which.blanks ] <- -Inf
-
- if(length(which.nas) >0)
- x[ which.nas ] <- Inf
-
####
# - Convert each character string into an vector containing single
# character and numeric values.
@@ -79,7 +77,7 @@
)
# now order them
- rank.numeric <- sapply(step1.numeric.t,rank)
+ rank.numeric <- sapply(step1.numeric.t, rank)
rank.character <- sapply(step1.character.t,
function(x) as.numeric(factor(x)))
@@ -95,9 +93,27 @@
order.frame <- as.data.frame(rank.overall)
if(length(which.nas) > 0)
- order.frame[which.nas,] <- Inf
- retval <- do.call("order",order.frame)
+ if(is.na(na.last))
+ order.frame[which.nas,] <- NA
+ else if(na.last)
+ order.frame[which.nas,] <- Inf
+ else
+ order.frame[which.nas,] <- -Inf
+ if(length(which.blanks) > 0)
+ if(is.na(blank.last))
+ order.frame[which.blanks,] <- NA
+ else if(blank.last)
+ order.frame[which.blanks,] <- 1e99
+ else
+ order.frame[which.blanks,] <- -1e99
+
+ order.frame <- as.list(order.frame)
+ order.frame$decreasing <- decreasing
+ order.frame$na.last <- NA
+
+ retval <- do.call("order", order.frame)
+
return(retval)
}
Added: trunk/gtools/R/roman2int.R
===================================================================
--- trunk/gtools/R/roman2int.R (rev 0)
+++ trunk/gtools/R/roman2int.R 2015-04-28 04:16:56 UTC (rev 1975)
@@ -0,0 +1,37 @@
+testConvert <- function()
+ {
+ roman <- 'IVXLCDM'
+ retval <- romandigit.convert(roman)
+ stopifnot(retval==c(1,5,10,50,100,500,1000))
+ return(TRUE)
+ }
+
+romandigit.convert <- function(roman)
+ {
+ retval <- .C('convert',
+ roman=as.character(roman),
+ nchar=as.integer(nchar(roman)),
+ values=integer(nchar(roman))
+ )
+ retval$values
+ }
+
+roman2int.inner <- function(roman)
+ {
+ results <- .C("roman2int",
+ roman = as.character(roman),
+ nchar = as.integer(nchar(roman)),
+ value = integer(1),
+
+ PACKAGE="gtools")
+
+ return(results$value)
+ }
+
+roman2int <- function(roman)
+ {
+ roman <- trim(toupper(as.character(roman)))
+ retval <- sapply(roman, roman2int.inner)
+ retval
+ }
+
Added: trunk/gtools/R/trim.R
===================================================================
--- trunk/gtools/R/trim.R (rev 0)
+++ trunk/gtools/R/trim.R 2015-04-28 04:16:56 UTC (rev 1975)
@@ -0,0 +1 @@
+link ../../gdata/R/trim.R
\ No newline at end of file
Property changes on: trunk/gtools/R/trim.R
___________________________________________________________________
Added: svn:special
## -0,0 +1 ##
+*
\ No newline at end of property
Added: trunk/gtools/R/unByteCode.R
===================================================================
--- trunk/gtools/R/unByteCode.R (rev 0)
+++ trunk/gtools/R/unByteCode.R 2015-04-28 04:16:56 UTC (rev 1975)
@@ -0,0 +1,29 @@
+## Convert a byte-compiled function to an interpreted-code function
+unByteCode <- function(fun)
+{
+ FUN <- eval(parse(text=deparse(fun)))
+ environment(FUN) <- environment(fun)
+ FUN
+}
+
+## Replace function definition inside of a locked environment **HACK**
+assignEdgewise <- function(name, env, value)
+{
+ unlockBinding(name, env=env)
+ assign( name, envir=env, value=value)
+ lockBinding(name, env=env)
+ invisible(value)
+}
+
+## Replace byte-compiled function in a locked environment with an
+## interpreted-code function
+unByteCodeAssign <- function(fun)
+{
+ name <- gsub('^.*::+','', deparse(substitute(fun)))
+ FUN <- unByteCode(fun)
+ retval <- assignEdgewise(name=name,
+ env=environment(FUN),
+ value=FUN
+ )
+ invisible(retval)
+}
Deleted: trunk/gtools/inst/ChangeLog
===================================================================
--- trunk/gtools/inst/ChangeLog 2015-04-25 17:16:31 UTC (rev 1974)
+++ trunk/gtools/inst/ChangeLog 2015-04-28 04:16:56 UTC (rev 1975)
@@ -1,876 +0,0 @@
-2015-04-23 warnes
-
- * [r1949] R/quantcut.R, man/quantcut.Rd: - The 'q' argument to
- quantcut()'s 'q' now accept an integer
- indicating the number of equally spaced quantile groups to
- create. (Suggestion and patch submitted by Ryan C. Thompson.)
- * [r1946] DESCRIPTION: Revers accidental text deletion:
- * [r1945] DESCRIPTION, inst/ChangeLog, inst/NEWS: Update for gtools
- 3.4.3
- * [r1944] R/smartbind.R, R/strmacro.R: Remove debugging code and
- stray browser() call
-
-2015-04-14 warnes
-
- * [r1923] DESCRIPTION: Fix typo
-
-2015-04-09 warnes
-
- * [r1921] inst/ChangeLog: Update gtools ChangeLog
- * [r1920] DESCRIPTION, NAMESPACE, R/loadedPackages.R,
- R/na.replace.R, inst/ChangeLog, inst/NEWS, man/loadedPackages.Rd,
- man/na.replace.Rd: Move first()/last()/left()/right() to gdata.
- Add new functions na.replace() and loadedPackages().
- Add more text to package description.
-
-2015-04-08 warnes
-
- * [r1919] NAMESPACE, R/first.R, man/first.Rd, man/left.Rd: Move
- first/last/left/right to from gtools to gdata
-
-2015-04-06 warnes
-
- * [r1918] man/dirichlet.Rd: Correct URL
- * [r1917] inst/ChangeLog, inst/NEWS: Update NEWS and ChangeLog for
- gtools 3.5.0
- * [r1916] inst/ChangeLog: Add ChangeLog files to repository
- * [r1915] R/keywords.R: Implement fix to keywords() needed for
- R-3.4.1, as suggested by Kurt
- Hornik.
- * [r1914] NAMESPACE, R/first.R: - Export S3 methods for first(),
- last(), left() and right().
- - Ensure code matches man page for first(), last(), left(), and
- right().
-
-2014-10-09 warnes
-
- * [r1897] DESCRIPTION, inst/NEWS: Update for 3.5.0 release of
- gtools
- * [r1896] R/first.R: Make right() and left() S3 methods for classes
- data.frame and matrix
-
-2014-08-27 warnes
-
- * [r1872] man/first.Rd: Fix man page
- * [r1871] DESCRIPTION, NAMESPACE, R/first.R, man/first.Rd,
- man/left.Rd: Finish adding first(), last(), left(), and right().
- * [r1870] R/first.R: Add functions first(), last(), left(), and
- right().
-
-2014-05-28 warnes
-
- * [r1816] DESCRIPTION, inst/NEWS: Update for gtools 3.4.1
- * [r1815] tests/smartbind_Dates.R: Add test to ensure smartbind()
- properly handles Date columns.
- * [r1814] R/smartbind.R: smartbind: Convert non-native type columns
- (except factor) to character.
-
-2014-04-18 arnima
-
- * [r1813] R/ASCIIfy.R, man/ASCIIfy.Rd: Main arg is 'x' like
- showNonASCII(x), preformatted notes instead of verb
-
-2014-04-17 warnes
-
- * [r1810] man/ASCIIfy.Rd: Update ASCIIfy man page to match source
- code and add keywords
- * [r1809] inst/NEWS: Update NEWS for gtools 3.4.0
- * [r1808] DESCRIPTION, NAMESPACE, R/ASCIIfy.R, man/ASCIIfy.Rd: Add
- ASCIIfy function posted to RDevel by Arni Magnusson
-
-2014-03-01 warnes
-
- * [r1776] tests/test_mixedorder.R: Fix cut-and-paste error.
- * [r1775] DESCRIPTION, inst/NEWS: Update files for gtools 3.3.1
- release
- * [r1774] R/mixedsort.R, tests/test_mixedorder.R: Fix bug in
- gtools::mixedorder regular expression for regognizing numbers.
- (Periods weren't escaped).
-
-2014-02-11 warnes
-
- * [r1773] R/clean_up_dependencies2.R: Create and use locate copy of
- tools:::.split_op_version.
- * [r1772] inst/NEWS: Update for gtools 3.3.0.
- * [r1771] man/getDependencies.Rd: Fix arguments
- * [r1770] man/getDependencies.Rd: Update arguments to match code.
- * [r1769] DESCRIPTION, NAMESPACE, R/clean_up_dependencies2.R,
- R/getDependencies.R, man/getDependencies.Rd: Add
- getDependencies() function to return a list of package
- dependencies.
-
-2014-01-14 warnes
-
- * [r1768] DESCRIPTION, inst/NEWS: Update for bug-fix release
- * [r1767] tests, tests/test_binsearch.R: Add test file for
- binsearch() function.
- * [r1766] R/binsearch.R: Fixed bug where binsearch() returned the
- wrong endpoint & value when the found value was at the upper
- endpoint.
-
-2014-01-13 warnes
-
- * [r1765] man/smartbind.Rd: Fix typo
-
-2014-01-11 warnes
-
- * [r1764] inst/NEWS: Update for gtools release 3.2.0
- * [r1763] man/gtools-defunct.Rd: fixes for R CMD check
- * [r1762] DESCRIPTION, NAMESPACE, R/capture.R, R/defunct.R,
- R/keywords.R, man/capture.Rd, man/gtools-defunct.Rd,
- man/stars.pval.Rd: Fixes for gtools release 3.2.0
-
-2013-12-23 warnes
-
- * [r1761] R/keywords.R, man/keywords.Rd: Extend the keywords()
- function to return keywords associated with a specified topic via
- 'keywords(topic)'.
- * [r1760] man/stars.pval.Rd: Add keyword.
- * [r1759] NAMESPACE, R/stars.pval.R, man/stars.pval.Rd: Add
- stars.pval() function to convert p-values into significance
- symbols.
-
-2013-11-26 warnes
-
- * [r1748] R/mixedsort.R: mixedorder() was failing to correctly
- handle numbers including
- decimals due to a faulty regular expression. Prior to the fix:
-
- > drr
- [1] "Dose 0.3 mg" "Dose 0.04 mg" "Dose 0.5 mg"
- > gtools::mixedsort(drr)
- [1] "Dose 0.3 mg" "Dose 0.04 mg" "Dose 0.5 mg"
-
- After the fix:
-
- > drr
- [1] "Dose 0.3 mg" "Dose 0.04 mg" "Dose 0.5 mg"
- > mixedsort(drr)
- [1] "Dose 0.04 mg" "Dose 0.3 mg" "Dose 0.5 mg"
-
- In addition, an optimization was added that checked if the input
- vector
- was numeric. If so, simply use the existing base::order function.
-
-2013-11-18 warnes
-
- * [r1747] R/capture.R: Use ".Deprecated" instead of warning.
-
-2013-11-06 warnes
-
- * [r1746] DESCRIPTION, inst/NEWS: Update files for gtools 3.1.1
- * [r1745] R/mixedsort.R: Fix problem with mixedorder/mixedsort when
- there is only zero or one elements in the vector.
-
-2013-09-23 warnes
-
- * [r1716] man/gtools-deprecated.Rd: Comment out empty sections in
- gtools-deprecated.Rd
- * [r1715] DESCRIPTION, inst/NEWS: Update files for gtools 3.1.0
- release
- * [r1714] man/addLast-deprecated.Rd, man/gtools-defunct.Rd,
- man/gtools-deprecated.Rd, man/lastAdd.Rd: Make 'addLast()'
- defunct.
- * [r1713] R/addLast.R, R/lastAdd.R: Mark 'addLast()' as defunct and
- move 'lastAdd()' function to a separate file.
- * [r1712] DESCRIPTION, inst/NEWS: Update for gtools 3.0.1 release
- * [r1711] R/mixedsort.R: Use 'suppressWarnings() instead of
- 'options(warn=-1)' in 'mixedorder()'.
-
-2013-07-07 warnes
-
- * [r1705] man/lastAdd.Rd: Fix typo.
-
-2013-07-06 warnes
-
- * [r1704] man/lastAdd.Rd: Fix Rd warning.
- * [r1703] NAMESPACE: Include lastAdd in NAMESPACE
- * [r1702] R/deprecated.R: Change assert from deprecated to defunct.
- * [r1701] R/addLast.R: Improve deprecation message
- * [r1700] DESCRIPTION, inst/NEWS: Update for gtools 3.0.0
- * [r1699] R/addLast.R, man/addLast-deprecated.Rd, man/addLast.Rd,
- man/gtools-defunct.Rd, man/gtools-deprecated.Rd, man/lastAdd.Rd:
- Create new function lastAdd to replace addLast and mark addLast
- as deprecated.
-
-2013-07-05 warnes
-
- * [r1698] inst/NEWS: Point out that addLast() modifies the value of
- .Last in the global environment.
- * [r1697] man/addLast.Rd: Point out that addLast() modifies the
- value of .Last in the global environment.
- * [r1696] DESCRIPTION, inst/NEWS: Update for gtools 2.7.2 mark 2
- * [r1695] man/logit.Rd: Remove cross-reference to (obsolete?) moc
- package
- * [r1694] DESCRIPTION, inst/NEWS: Update for gtools 2.7.2
- * [r1693] R/checkRVersion.R: Update for R version 3.0.0 and later
-
-2013-03-17 warnes
-
- * [r1640] R/smartbind.R: Fix error in smartbind: factor levels were
- not being handled if the factor column was not present in the
- first data frame.
-
-2012-06-19 warnes
-
- * [r1570] DESCRIPTION, inst/NEWS: Update for gtools 2.7.0.
- * [r1569] man/smartbind.Rd: Document new 'verbose' argument to
- smartbind().
- * [r1568] R/addLast.R, R/running.R: Clean up R CMD check warnings.
-
-2012-05-04 warnes
-
- * [r1529] R/smartbind.R: smartbind(): Improve handling of factors
- and ordered factors.
-
-2011-10-05 warnes
-
- * [r1518] DESCRIPTION: Update version number for release
- * [r1517] R/smartbind.R, man/smartbind.Rd: Add 'sep' argument to
- smartbind() to allow specification of character used to separate
- components of constructed names
-
-2011-09-28 warnes
-
- * [r1513] R/smartbind.R: smartbind(): Prevent coersion to data
- frame from mangling column names.
- * [r1512] R/smartbind.R, inst/NEWS: Add 'fill' argument to
- smartbind() to specify a value to use for
- missing entries.
- * [r1511] DESCRIPTION, man/smartbind.Rd: Add 'fill' argument to
- smartbind() to specify a value to use for
- missing entries.
-
-2010-08-14 warnes
-
- * [r1451] R/mixedsort.R: Modify mixedorder()/mixedsort() to better
- handle strings containing multiple periods, like version numbers
- (e.g 1.1.2, 1.2.1. 1.1.1.1).
-
-2010-05-01 warnes
-
- * [r1434] DESCRIPTION: Update version number for new release
- * [r1433] DESCRIPTION, man/addLast.Rd, man/ask.Rd,
- man/binsearch.Rd, man/capture.Rd, man/combinations.Rd,
- man/defmacro.Rd, man/dirichlet.Rd, man/foldchange.Rd,
- man/invalid.Rd, man/keywords.Rd, man/logit.Rd, man/mixedsort.Rd,
- man/oddeven.Rd, man/permute.Rd, man/quantcut.Rd, man/running.Rd,
- man/scat.Rd, man/setTCPNoDelay.Rd, man/smartbind.Rd: Change
- Greg's email address to gr...@wa...
- * [r1432] R/checkRVersion.R: Fix error in checkRVersion()
-
-2010-04-28 ggrothendieck2
-
- * [r1431] R/quantcut.R, R/strmacro.R, man/binsearch.Rd,
- man/capture.Rd, man/setTCPNoDelay.Rd: fixed problems with R CMD
- CHECK
-
-2009-05-09 warnes
-
- * [r1328] man/keywords.Rd: Escape $ in .Rd file to avoid latex
- issues
- * [r1327] ChangeLog, NEWS, inst/NEWS: Update NEWS and create
- softlinks for NEWS and ChangeLog in top level directory
- * [r1326] NEWS, inst, inst/NEWS: Move actual NEWS file into inst.
- * [r1325] DESCRIPTION, man/addLast.Rd, man/binsearch.Rd,
- man/capture.Rd, man/combinations.Rd, man/defmacro.Rd,
- man/dirichlet.Rd, man/foldchange.Rd, man/gtools-deprecated.Rd,
- man/invalid.Rd, man/logit.Rd, man/mixedsort.Rd, man/oddeven.Rd,
- man/permute.Rd, man/quantcut.Rd, man/running.Rd, man/scat.Rd,
- man/setTCPNoDelay.Rd, man/smartbind.Rd: Update Greg's email
- address and fix Rd syntax errors
-
-2009-02-16 warnes
-
- * [r1313] src/Makevars.win: Correct windows make flags as suggested
- by Brian Ripley.
-
-2008-08-15 warnes
-
- * [r1303] DESCRIPTION, NAMESPACE, R/keywords.R, man/keywords.Rd:
- Add keywords() function to show /doc/KEYWORDS file
-
-2008-05-29 warnes
-
- * [r1285] R/newVersionAvailable.R: Add newVersionAvailable()
- function to compare running and latest available R versions
-
-2008-05-26 warnes
-
- * [r1284] DESCRIPTION: Update license specification
- * [r1283] man/assert-deprecated.Rd: Remove 'assert' man page
-
-2008-05-22 warnes
-
- * [r1282] man/assert.R: Finish rename of assert.R to
- assert-depricated.Rd
- * [r1281] R/checkRVersion.R: Add checkRVersion.R file
- * [r1280] man/assert-deprecated.Rd: Rename again to get correct
- extension!
- * [r1279] NEWS: Update NEWS for 2.5.0
- * [r1278] man/checkRVersion.Rd: Add man page for checkRVersion
- * [r1277] man/assert-deprecated.R, man/assert.R: Rename
- assert-deprecated.R to assert.R to meet R file name requirements.
- * [r1276] DESCRIPTION, NAMESPACE: Add checkRVersion to NAMESPACE,
- and increment version in DESCRIPTION.
- * [r1275] man/gtools-deprecated.Rd: Remove broken SEE LSO reference
-
-2008-04-12 warnes
-
- * [r1259] man/defmacro.Rd: Improve text explanation of how
- defmacro() and strmacro() differ from
- function().
- * [r1258] NEWS, man/assert-deprecated.R, man/assert.Rd,
- man/gtools-deprecated.Rd: assert() is now deprecated in favor of
- base::stopifnot()
- * [r1257] R/assert.R, R/deprecated.R: Rename 'assert.R' to
- 'deprecated.R'.
- * [r1256] R/assert.R: Assert is now deprecated in favor of
- base::stopifnot(), so add call to
- .Deprecated() to inform the user.
-
-2007-11-30 warnes
-
- * [r1228] R/oddeven.R: Update defnitions of odd() and even() to use
- modulus operator instead of division. Prettier, I think, :-D
-
-2007-08-08 warnes
-
- * [r1121] DESCRIPTION, R/binsearch.R: Fix bug identified by R-2.6's
- check routings in binsearch()
- * [r1120] DESCRIPTION, NAMESPACE, NEWS, R/binsearch.R,
- man/binsearch.Rd: Add the binsearch(), previously in the genetics
- package.
-
-2007-07-18 ggorjan
-
- * [r1100] man/combinations.Rd: typo fixed
-
-2007-04-12 warnes
-
- * [r1088] NAMESPACE, NEWS, R/ask.R, man/ask.Rd: Add ask() function
- to prompt the user and collect a single response.
-
-2007-04-07 warnes
-
- * [r1087] DESCRIPTION, R/mixedsort.R: Fix improper escapes in
- regexp detected by R 2.5.0 package check.
-
-2007-03-23 warnes
-
- * [r1083] R/combinations.R: Allow permutations for r>n provided
- repeats.allowed=TRUE
-
-2006-11-28 warnes
-
- * [r1023] man/smartbind.Rd: Replace F with FALSE in smartbind
- example.
-
-2006-11-27 warnes
-
- * [r1022] man/smartbind.Rd: Replace T with TRUE in smartbind
- example
- * [r1021] data/ELISA.rda: Temprary remove to reset binary flag
- * [r1020] data/ELISA.rda: Temprary remove to reset binary flag
- * [r1019] DESCRIPTION, NAMESPACE, NEWS, R/smartbind.R,
- man/smartbind.Rd: Add smartbind() to list of exported functions,
- and add corresponding
- documentation file.
- * [r1018] DESCRIPTION: Update my email address
-
-2006-11-14 ggorjan
-
- * [r1012] R/combinations.R, R/running.R, man/ELISA.Rd,
- man/combinations.Rd: Removed executable property
-
-2006-08-02 warnes
-
- * [r977] man/addLast.Rd, man/assert.Rd, man/capture.Rd,
- man/combinations.Rd, man/defmacro.Rd, man/dirichlet.Rd,
- man/foldchange.Rd, man/invalid.Rd, man/logit.Rd,
- man/mixedsort.Rd, man/oddeven.Rd, man/permute.Rd,
- man/quantcut.Rd, man/running.Rd, man/scat.Rd,
- man/setTCPNoDelay.Rd: Update my email address
-
-2006-05-05 nj7w
-
- * [r958] man/combinations.Rd: Fixed minor typo - in {value} - n was
- replaced by r
- * [r957] NAMESPACE, man/capture.Rd: Fixed minor typos
-
-2006-03-01 warnes
-
- * [r903] R/smartbind.R: Add smartbind function
-
-2006-01-18 warnes
-
- * [r845] man/mixedsort.Rd: Add concept tags to make mixedsort
- easier to locate.
-
-2005-12-21 warnes
-
- * [r837] DESCRIPTION: Update version number and date
- * [r836] NEWS: Note changes for 2.2.3
- * [r835] src/Makevars.win, src/setTCPNoDelay.c: Should now work on
- Windows
-
-2005-12-20 warnes
-
- * [r834] src/setTCPNoDelay.c: Temporary fix to allow
- setTCPNoDelay.c to compile on Windows. If compiled on windows
- calling setTCPNoDelay will just raise an error.
-
-2005-12-14 warnes
-
- * [r813] src/setTCPNoDelay.c: Change C++ comment to standard
- comment
-
-2005-12-13 nj7w
-
- * [r810] ChangeLog: *** empty log message ***
- * [r809] NEWS: Updated NEWS and removed ChangeLog
-
-2005-12-12 nj7w
-
- * [r800] DESCRIPTION: Updated version for CRAN release
-
-2005-12-08 warnes
-
- * [r790] src, src/setTCPNoDelay.c: Add C source code for
- setTCPNoDelay.
-
-2005-12-01 nj7w
-
- * [r776] man/combinations.Rd, man/foldchange.Rd, man/invalid.Rd,
- man/logit.Rd, man/mixedsort.Rd, man/oddeven.Rd, man/quantcut.Rd,
- man/running.Rd: Updated Greg's email address
-
-2005-11-29 warnes
-
- * [r769] NAMESPACE: Add UseDynLib to NAMESPACE so the shared
- library gets properly loaded.
- * [r768] R/setTCPNoDelay.R: - Remove debugging comments
- - Change return value on success to "Success".
-
-2005-11-22 warnes
-
- * [r758] NAMESPACE: NAMESPACE
- * [r757] NEWS: Update news for 2.2.1 release.
- * [r756] man/addLast.Rd, man/setTCPNoDelay.Rd: Fixes for R CMD
- check
- * [r755] DESCRIPTION, NAMESPACE, R/setTCPNoDelay.R,
- man/setTCPNoDelay.Rd: Add setTCPNoDelay() function and
- documentation
- * [r745] R/addLast.R, man/addLast.Rd: New function 'addLast' that
- adds functions to R's .Last() so that
- they will be executed when R is terminating.
-
-2005-09-22 warnes
-
- * [r678] DESCRIPTION, NAMESPACE, man/defmacro.Rd: More changes for
- strmacro(), also changes for 2.1.1 release
- * [r677] R/defmacro.R, R/strmacro.R, man/defmacro.Rd: Add strmaco()
- which defines functions that use strings for macro definition
-
-2005-09-21 warnes
-
- * [r676] DESCRIPTION, R/defmacro.R, man/defmacro.Rd: Add support
- for DOTS/... arguments to defmacro
-
-2005-09-12 nj7w
-
- * [r671] man/assert.Rd, man/dirichlet.Rd, man/permute.Rd,
- man/scat.Rd: Updated Greg's email
-
-2005-09-02 nj7w
-
- * [r653] NAMESPACE: Exported assert
- * [r652] DESCRIPTION: Updated the version number
- * [r651] NEWS: Added NEWS
- * [r650] ChangeLog: Added ChangeLog
- * [r649] man/assert.Rd: Fixed syntax errors
-
-2005-09-02 warnes
-
- * [r648] R/assert.R, man/assert.Rd: Add assert() and documentation
- * [r647] man/defmacro.Rd: Fix problem in defmacro.Rd file: don't
- use \code{} in the example section.
-
-2005-08-31 warnes
-
- * [r645] DESCRIPTION, NAMESPACE, R/defmacro.R, man/defmacro.Rd:
- Adding the defmacro() function, extracted from
-
- Lumley T. "Programmer's Niche: Macros in {R}", R News, 2001, Vol
- 1,
- No. 3, pp 11--13, \url{http://CRAN.R-project.org/doc/Rnews/}
- * [r642] DESCRIPTION, DESCRIPTION.in: Add stand-alone DESCRIPTION
- file and remove old DESCRIPTION.in file.
-
-2005-06-13 nj7w
-
- * [r626] R/mixedsort.R: Fixed a bug in mixedsort - check if
- "which.na" and "which.blank" is numeric(0) before subsetting the
- datasets.
-
-2005-06-09 nj7w
-
- * [r625] R/RSCompat.S, R/combinations.R, R/dirichlet.R,
- R/foldchange.R, R/invalid.R, R/logit.R, R/mixedsort.R,
- R/oddeven.R, R/permute.R, R/quantcut.R, R/running.R, R/scat.R,
- man/ELISA.Rd, man/combinations.Rd, man/dirichlet.Rd,
- man/foldchange.Rd, man/invalid.Rd, man/logit.Rd,
- man/mixedsort.Rd, man/oddeven.Rd, man/permute.Rd,
- man/quantcut.Rd, man/running.Rd, man/scat.Rd: Updating the
- version number, and various help files to synchronize splitting
- of gregmisc bundle in 4 individual components.
-
-2005-05-10 warnes
-
- * [r619] R/mixedsort.R: Fix handling of NA's in mixedorder. We were
- using a high UTF character to try
- to put NA's at the end of the sort order, but R 2.1.0 checks if
- characters
- are in the correct range. Instead, we explicitly force NA's to
- the end.
-
-2005-04-07 warnes
-
- * [r606] NAMESPACE, R/scat.R, man/scat.Rd: - Add scat() function
- which writes its arguments to stderr and
- flushes so that output is immediately displayed, but only if
- 'getOption("DEBUG")' is true.
-
-2005-04-02 warnes
-
- * [r600] NAMESPACE, R/drop.levels.R, man/drop.levels.Rd: Move
- drop.levels() from gtools to gdata.
- * [r599] R/mixedsort.R: Minor reordering of functions in file
- * [r598] NAMESPACE, R/frameApply.R, man/frameApply.Rd: Move
- frameApply() to gdata package.
- * [r597] R/mixedsort.R: Fix error if only one value passed to
- mixedorder.
- * [r596] R/quantcut.R, man/quantcut.Rd: Add proper handling where
- more than one quantile obtains the same value
-
-2005-04-01 warnes
-
- * [r595] man/ELISA.Rd, man/combinations.Rd, man/dirichlet.Rd,
- man/drop.levels.Rd, man/foldchange.Rd, man/invalid.Rd,
- man/logit.Rd, man/mixedsort.Rd, man/oddeven.Rd, man/permute.Rd,
- man/quantcut.Rd, man/running.Rd: Add CVS ID tag to file headers.
- * [r594] R/frameApply.R, man/frameApply.Rd: Fixes from Jim Rogers
- for R CMD check problems in frameApply
-
-2005-03-31 warnes
-
- * [r591] R/drop.levels.R, R/frameApply.R, man/drop.levels.Rd,
- man/frameApply.Rd: Updates to drop.levels() and frameApply() from
- Jim Rogers
- * [r590] data, data/ELISA.rda, man/ELISA.Rd: Add ELISA data set
- used by frameApply and drop.levels examples
-
-2005-02-25 warnes
-
- * [r562] man/frameApply.Rd: Replace 'T' with TRUE.
- * [r561] man/frameApply.Rd: Remove dependency on ELISA data set for
- the example.
- * [r558] NAMESPACE: Add drop.levels, frameApply to namespace
- export.
-
-2005-02-15 warnes
-
- * [r542] R/drop.levels.R, R/frameApply.R, man/drop.levels.Rd,
- man/frameApply.Rd: Add frameApply and drop.levels contributed by
- Jim Rogers.
-
-2005-01-12 warnes
-
- * [r515] DESCRIPTION.in: Add dependency on R 1.9.0+ to prevent
- poeple from installing on old
- versions of R which don't support namespaces.
-
-2004-09-27 warneg
-
- * [r461] DESCRIPTION, DESCRIPTION.in, man/running.Rd: Updated to
- pass R CMD check.
-
-2004-09-03 warneg
-
- * [r446] DESCRIPTION, NAMESPACE, R/dirichlet.R, R/foldchange.R,
- R/invalid.R, R/mixedsort.R, R/oddeven.R, R/permute.R,
- R/quantcut.R, R/running.R, man/running.Rd: initial bundle checkin
-
-2004-09-02 warneg
-
- * [r442] DESCRIPTION, DESCRIPTION.in, NAMESPACE: Initial revision
-
-2004-08-27 warnes
-
- * [r441] R/mixedsort.R, man/mixedsort.Rd: Fixed bug in mixedsort,
- and modified reorder....
[truncated message content] |
|
From: <wa...@us...> - 2015-04-28 04:27:06
|
Revision: 1976
http://sourceforge.net/p/r-gregmisc/code/1976
Author: warnes
Date: 2015-04-28 04:27:04 +0000 (Tue, 28 Apr 2015)
Log Message:
-----------
Changes to mixedsort():
- Hands off objects that are not character vectors to the default sort.
- Add 'decreasing', 'na.last', and 'blank.last' arguments.
Modified Paths:
--------------
trunk/gtools/R/mixedsort.R
trunk/gtools/man/mixedsort.Rd
Modified: trunk/gtools/R/mixedsort.R
===================================================================
--- trunk/gtools/R/mixedsort.R 2015-04-28 04:16:56 UTC (rev 1975)
+++ trunk/gtools/R/mixedsort.R 2015-04-28 04:27:04 UTC (rev 1976)
@@ -1,8 +1,6 @@
-# $Id$
-
mixedsort <- function(x, decreasing=FALSE, na.last=TRUE, blank.last=FALSE)
{
- ord <- mixedorder(x, decreasing=decreasing, na.last=na.last,
+ svn ord <- mixedorder(x, decreasing=decreasing, na.last=na.last,
blank.last=blank.last)
x[ord]
}
@@ -116,5 +114,3 @@
return(retval)
}
-
-
Modified: trunk/gtools/man/mixedsort.Rd
===================================================================
--- trunk/gtools/man/mixedsort.Rd 2015-04-28 04:16:56 UTC (rev 1975)
+++ trunk/gtools/man/mixedsort.Rd 2015-04-28 04:27:04 UTC (rev 1976)
@@ -1,5 +1,3 @@
-% $Id$
-%
\name{mixedsort}
\alias{mixedsort}
\alias{mixedorder}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|