[R-gregmisc-users] SF.net SVN: r-gregmisc:[1788] trunk/gdata
Brought to you by:
warnes
From: <wa...@us...> - 2014-04-05 13:57:14
|
Revision: 1788 http://sourceforge.net/p/r-gregmisc/code/1788 Author: warnes Date: 2014-04-05 13:57:10 +0000 (Sat, 05 Apr 2014) Log Message: ----------- Change 'aggregate.table' from deprecated to defunct. Modified Paths: -------------- trunk/gdata/R/aggregate.table.R Added Paths: ----------- trunk/gdata/man/gdata-defunct.Rd Removed Paths: ------------- trunk/gdata/man/aggregate.table.Rd Modified: trunk/gdata/R/aggregate.table.R =================================================================== --- trunk/gdata/R/aggregate.table.R 2014-04-05 12:53:38 UTC (rev 1787) +++ trunk/gdata/R/aggregate.table.R 2014-04-05 13:57:10 UTC (rev 1788) @@ -2,32 +2,34 @@ aggregate.table <- function(x, by1, by2, FUN=mean, ...) { - warning("'aggregate.table' is deprecated and will be removed in a future version of the gdata package. ", - "Please use 'tapply(X=", - deparse(substitute(x)), - ", INDEX=list(", - deparse(substitute(by1)), - ", ", - deparse(substitute(by2)), - "), FUN=", - deparse(substitute(FUN)), - if(length(list(...))>0) - { - l <- list(...) - paste(", ", - paste(names(l),"=", - deparse(substitute(...)), - sep="", - collapse=", ") - ) - }, - ")' instead.") - tapply(X=x, INDEX=list(by1, by2), FUN=FUN, ...) + .Defunct( + new=paste( + "tapply(X=", + deparse(substitute(x)), + ", INDEX=list(", + deparse(substitute(by1)), + ", ", + deparse(substitute(by2)), + "), FUN=", + deparse(substitute(FUN)), + if(length(list(...))>0) + { + l <- list(...) + paste(", ", + paste(names(l),"=", + deparse(substitute(...)), + sep="", + collapse=", ") + ) + }, + ")", sep=""), + package="gdata" + ) } ## aggregate.table <- function(x, by1, by2, FUN=mean, ... ) ## { -## +## ## tab <- matrix( nrow=nlevels(by1), ncol=nlevels(by2) ) ## dimnames(tab) <- list(levels(by1),levels(by2)) ## Deleted: trunk/gdata/man/aggregate.table.Rd =================================================================== --- trunk/gdata/man/aggregate.table.Rd 2014-04-05 12:53:38 UTC (rev 1787) +++ trunk/gdata/man/aggregate.table.Rd 2014-04-05 13:57:10 UTC (rev 1788) @@ -1,94 +0,0 @@ -% $Id$ -% -% $Log$ -% Revision 1.7 2005/09/12 15:42:45 nj7w -% Updated Greg's email -% -% Revision 1.6 2005/06/09 14:20:25 nj7w -% Updating the version number, and various help files to synchronize splitting of gregmisc bundle in 4 individual components. -% -% Revision 1.1.1.1 2005/05/25 22:07:33 nj7w -% Initial entry for individual package gdata -% -% Revision 1.5 2003/11/17 22:09:00 warnes -% Fix syntax error. -% -% Revision 1.4 2003/06/07 17:58:37 warnes -% -% - Fixed error in examples. Had sqrt(var(x)/(n-1)) for the standard -% error of the mean instead of sqrt(var(x)/n). -% -% Revision 1.3 2002/09/23 13:59:30 warnes -% - Modified all files to include CVS Id and Log tags. -% -% - -\name{aggregate.table} -\alias{aggregate.table} -\title{Create 2-Way Table of Summary Statistics} -\description{ - Splits the data into subsets based on two factors, computes a summary - statistic on each subset, and arranges the results in a 2-way table. -} -\usage{ -aggregate.table(x, by1, by2, FUN=mean, ...) -} -%- maybe also `usage' for other objects documented here. -\arguments{ - \item{x}{ data to be summarized } - \item{by1}{ first grouping factor. } - \item{by2}{ second grouping factor. } - \item{FUN}{ a scalar function to compute the summary statistics which can - be applied to all data subsets. Defaults to \code{mean}.} - \item{\dots}{ Optional arguments for \code{FUN}. } -} -%\details{ -% ~~ If necessary, more details than the __description__ above ~~ -%} -\value{ - Returns a matrix with one element for each combination of \code{by1} - and \code{by2}. -} -\author{ Gregory R. Warnes \email{gr...@wa...}} - -\seealso{ \code{\link{aggregate}}, \code{\link{tapply}}, - \code{\link{interleave}} } -\note{This function is DEPRECIATED. Please use \code{tapply} - instead. See example for illustration.} -\examples{ -# Useful example: -# -# Create a 2-way table of means, standard errors, and # obs -set.seed(314159) -g1 <- sample(letters[1:5], 1000, replace=TRUE) -g2 <- sample(LETTERS[1:3], 1000, replace=TRUE ) -dat <- rnorm(1000) - -stderr <- function(x) sqrt( var(x,na.rm=TRUE) / nobs(x) ) - -## Depreciated: -means <- aggregate.table( dat, g1, g2, mean ) -## Instead use: -means <- tapply( dat, list(g1, g2), mean ) - -## Depreciated -stderrs <- aggregate.table( dat, g1, g2, stderr ) -## Instead use: -stderrs <- tapply( dat, list(g1, g2), stderr ) - -## Depreciated -ns <- aggregate.table( dat, g1, g2, nobs ) -## Instead use: -ns <- tapply( dat, list(g1, g2), nobs ) - -blanks <- matrix( " ", nrow=5, ncol=3) - -tab <- interleave( "Mean"=round(means,2), - "Std Err"=round(stderrs,2), - "N"=ns, " " = blanks, sep=" " ) - -print(tab, quote=FALSE) -} -\keyword{iteration} -\keyword{category} - Copied: trunk/gdata/man/gdata-defunct.Rd (from rev 1786, trunk/gdata/man/aggregate.table.Rd) =================================================================== --- trunk/gdata/man/gdata-defunct.Rd (rev 0) +++ trunk/gdata/man/gdata-defunct.Rd 2014-04-05 13:57:10 UTC (rev 1788) @@ -0,0 +1,24 @@ +\name{gdata-defunct} +\alias{aggregate.table} +\title{Defunct Functions in Package 'gdata'} +\description{ + The functions or variables listed here are no longer part of 'gdata'. +} +\usage{ +aggregate.table(x, by1, by2, FUN=mean, ...) +} +%- maybe also `usage' for other objects documented here. +\arguments{ + \item{x}{ data to be summarized } + \item{by1}{ first grouping factor. } + \item{by2}{ second grouping factor. } + \item{FUN}{ a scalar function to compute the summary statistics which can + be applied to all data subsets. Defaults to \code{mean}.} + \item{\dots}{ Optional arguments for \code{FUN}. } +} +\details{ + \code{aggregate.table(x, by1, by2, FUN=mean, ...)} should be replacede + by \code{tapply(X=x, INDEX=list(by1, by2), FUN=FUN, ...)}. +} + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |