[R-gregmisc-users] SF.net SVN: r-gregmisc:[1920] trunk/gtools
Brought to you by:
warnes
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. |