r-gregmisc-users Mailing List for R gregmisc package (Page 9)
Brought to you by:
warnes
You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
(12) |
Apr
(5) |
May
(3) |
Jun
(5) |
Jul
(2) |
Aug
(5) |
Sep
(7) |
Oct
(15) |
Nov
(34) |
Dec
(3) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(3) |
Feb
(16) |
Mar
(28) |
Apr
(5) |
May
|
Jun
(5) |
Jul
(9) |
Aug
(50) |
Sep
(29) |
Oct
(9) |
Nov
(25) |
Dec
(7) |
2008 |
Jan
(6) |
Feb
(4) |
Mar
(5) |
Apr
(8) |
May
(26) |
Jun
(11) |
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
(9) |
2009 |
Jan
|
Feb
(1) |
Mar
|
Apr
(2) |
May
(26) |
Jun
|
Jul
(10) |
Aug
(6) |
Sep
|
Oct
(7) |
Nov
(3) |
Dec
(2) |
2010 |
Jan
(45) |
Feb
(11) |
Mar
|
Apr
(1) |
May
(8) |
Jun
(7) |
Jul
(3) |
Aug
(1) |
Sep
|
Oct
(1) |
Nov
(9) |
Dec
(1) |
2011 |
Jan
(2) |
Feb
|
Mar
|
Apr
(3) |
May
(1) |
Jun
|
Jul
|
Aug
(14) |
Sep
(29) |
Oct
(3) |
Nov
|
Dec
(3) |
2012 |
Jan
|
Feb
|
Mar
|
Apr
(7) |
May
(6) |
Jun
(59) |
Jul
|
Aug
(8) |
Sep
(21) |
Oct
|
Nov
|
Dec
|
2013 |
Jan
(1) |
Feb
|
Mar
(10) |
Apr
|
May
(18) |
Jun
(25) |
Jul
(18) |
Aug
(1) |
Sep
(6) |
Oct
(28) |
Nov
(4) |
Dec
(13) |
2014 |
Jan
(7) |
Feb
(5) |
Mar
(4) |
Apr
(36) |
May
(3) |
Jun
(7) |
Jul
(46) |
Aug
(14) |
Sep
(12) |
Oct
(2) |
Nov
|
Dec
(12) |
2015 |
Jan
(4) |
Feb
|
Mar
|
Apr
(80) |
May
(36) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <wa...@us...> - 2014-07-17 02:14:30
|
Revision: 1826 http://sourceforge.net/p/r-gregmisc/code/1826 Author: warnes Date: 2014-07-17 02:14:21 +0000 (Thu, 17 Jul 2014) Log Message: ----------- Rename former 'label.Rd' file to 'SASformatRd' and remove references to label() and "label<-"() (checkin missed from previous release). Added Paths: ----------- trunk/SASxport/man/SASformat.Rd Added: trunk/SASxport/man/SASformat.Rd =================================================================== --- trunk/SASxport/man/SASformat.Rd (rev 0) +++ trunk/SASxport/man/SASformat.Rd 2014-07-17 02:14:21 UTC (rev 1826) @@ -0,0 +1,91 @@ +\name{SASformat} + +\alias{SASformat} +\alias{SASformat.default} +\alias{SASformat<-} +\alias{SASformat<-.default} + +\alias{SASiformat} +\alias{SASiformat.default} +\alias{SASiformat<-} +\alias{SASiformat<-.default} + +\alias{SAStype} +\alias{SAStype.default} +\alias{SAStype<-} +\alias{SAStype<-.default} + +\title{ +Set or Retreive the 'label', 'SASformat', 'SASiformat', or 'SAStype' +attribute of a vector or (components of) a data frame +} +\description{ + Sets or retrieves the %\code{"label"},% + \code{"SASformat"}, + \code{"SASiformat"}, or \code{SAStype} attribute of an object. + + More comprehensive support for object labels, and SASformat, are + available in Frank Harrell's \code{Hmisc} package. + + Note that \code{SAStype} enforces the SAS 8-character naming convention. +} +\usage{ +SASformat(x, default) +SASformat(x) <- value + +SASiformat(x, default) +SASiformat(x) <- value + +SAStype(x, default) +SAStype(x) <- value +} +\arguments{ +\item{x}{any object} +\item{value}{new value for the \code{"label"}, \code{"SASformat"}, + \code{"SASiformat"}, or \code{SAStype} attribute of an object.} +\item{default}{value to return when no appropriate attribute is + found. The usual return value is NULL.} +} +\value{ + the contents of the \code{"label"}, \code{"SASformat"}, + \code{"SASiformat"}, \code{"SAStype"} attribute of x, if any; + otherwise, the value provided by \code{default}. +} +\author{ + Gregory R. Warnes \email{gr...@wa...} based on code from the + \code{Hmisc} library by Frank E. Harrell, Jr. ] +} +%\seealso{ +%} +\examples{ + +## Examples for vectors + +fail.time <- c(10,20) + +# set attributes +%% label(fail.time) <- 'Failure Time' +SASformat(fail.time) <- 'Numeric2' +SASiformat(fail.time) <- 'Numeric2' + +# display individual attributes +%% label(fail.time) +SASformat(fail.time) +SASiformat(fail.time) + +# display all attributes +attributes(fail.time) + +## SAStype only applies to data frames +df <- data.frame( fail.time, day=c("Mon","Tue") ) +SAStype(df) <- "USER" + +SAStype(df) + +## Example showing specification of default return value +a <- 70 +label(a, default="no label") +} +\keyword{utilities} +\keyword{interface} + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2014-07-17 00:27:38
|
Revision: 1825 http://sourceforge.net/p/r-gregmisc/code/1825 Author: warnes Date: 2014-07-17 00:27:29 +0000 (Thu, 17 Jul 2014) Log Message: ----------- read.xport: Preserve '$' at the beginning of SAS character format strings. Modified Paths: -------------- trunk/SASxport/R/read.xport.R Modified: trunk/SASxport/R/read.xport.R =================================================================== --- trunk/SASxport/R/read.xport.R 2014-07-17 00:14:58 UTC (rev 1824) +++ trunk/SASxport/R/read.xport.R 2014-07-17 00:27:29 UTC (rev 1825) @@ -130,10 +130,10 @@ names(w) <- nam dinfo <- dsinfo[[k]] - fmt <- sub('^\\$','',dinfo$format) + fmt <- dinfo$format formats <- fstr( fmt, dinfo$flength, dinfo$fdigits) - ifmt <- sub('^\\$','',dinfo$iformat) + ifmt <- dinfo$iformat iformats <- fstr( ifmt, dinfo$iflength, dinfo$ifdigits) lab <- dinfo$label This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2014-07-17 00:15:02
|
Revision: 1824 http://sourceforge.net/p/r-gregmisc/code/1824 Author: warnes Date: 2014-07-17 00:14:58 +0000 (Thu, 17 Jul 2014) Log Message: ----------- read.xport() argument names.tolower was not being honored for dataset names. Modified Paths: -------------- trunk/SASxport/R/read.xport.R Modified: trunk/SASxport/R/read.xport.R =================================================================== --- trunk/SASxport/R/read.xport.R 2014-06-30 19:26:21 UTC (rev 1823) +++ trunk/SASxport/R/read.xport.R 2014-07-17 00:14:58 UTC (rev 1824) @@ -102,7 +102,7 @@ else names.tolower <- function(x) x - dsn <- tolower(which.regular) + dsn <- names.tolower(which.regular) res <- vector('list', nds) names(res) <- gsub('_','.',dsn) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2014-06-30 19:26:24
|
Revision: 1823 http://sourceforge.net/p/r-gregmisc/code/1823 Author: warnes Date: 2014-06-30 19:26:21 +0000 (Mon, 30 Jun 2014) Log Message: ----------- Fix typo in dendrogram size checking code. Modified Paths: -------------- trunk/gplots/R/heatmap.2.R Modified: trunk/gplots/R/heatmap.2.R =================================================================== --- trunk/gplots/R/heatmap.2.R 2014-06-19 18:51:32 UTC (rev 1822) +++ trunk/gplots/R/heatmap.2.R 2014-06-30 19:26:21 UTC (rev 1823) @@ -210,7 +210,7 @@ { ddc <- Colv ## use Colv 'as-is', when it is dendrogram colInd <- order.dendrogram(ddc) - if(length(colInd)>nr || any(colInd<1 | colInd > nc )) + if(length(colInd)>nc || any(colInd<1 | colInd > nc )) stop("Colv dendrogram doesn't match size of x") } else if(identical(Colv, "Rowv")) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2014-06-19 18:51:40
|
Revision: 1822 http://sourceforge.net/p/r-gregmisc/code/1822 Author: warnes Date: 2014-06-19 18:51:32 +0000 (Thu, 19 Jun 2014) Log Message: ----------- Fix typo 'ColInd' --> 'colInd'. Modified Paths: -------------- trunk/gplots/R/heatmap.2.R Modified: trunk/gplots/R/heatmap.2.R =================================================================== --- trunk/gplots/R/heatmap.2.R 2014-06-19 18:36:19 UTC (rev 1821) +++ trunk/gplots/R/heatmap.2.R 2014-06-19 18:51:32 UTC (rev 1822) @@ -210,7 +210,7 @@ { ddc <- Colv ## use Colv 'as-is', when it is dendrogram colInd <- order.dendrogram(ddc) - if(length(ColInd)>nr || any(colInd<1 | colInd > nc )) + if(length(colInd)>nr || any(colInd<1 | colInd > nc )) stop("Colv dendrogram doesn't match size of x") } else if(identical(Colv, "Rowv")) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2014-06-19 18:36:29
|
Revision: 1821 http://sourceforge.net/p/r-gregmisc/code/1821 Author: warnes Date: 2014-06-19 18:36:19 +0000 (Thu, 19 Jun 2014) Log Message: ----------- Update for gplots 2.14.0 Modified Paths: -------------- trunk/gplots/DESCRIPTION trunk/gplots/inst/NEWS Modified: trunk/gplots/DESCRIPTION =================================================================== --- trunk/gplots/DESCRIPTION 2014-06-17 23:22:57 UTC (rev 1820) +++ trunk/gplots/DESCRIPTION 2014-06-19 18:36:19 UTC (rev 1821) @@ -4,8 +4,8 @@ Depends: R (>= 3.0) Imports: gtools, gdata, stats, caTools, KernSmooth Suggests: grid, MASS -Version: 2.13.0 -Date: 2014-04-04 +Version: 2.14.0 +Date: 2014-06-19 Author: Gregory R. Warnes, Ben Bolker, Lodewijk Bonebakker, Robert Gentleman, Wolfgang Huber Andy Liaw, Thomas Lumley, Martin Maechler, Arni Magnusson, Steffen Moeller, Marc Schwartz, Bill Modified: trunk/gplots/inst/NEWS =================================================================== --- trunk/gplots/inst/NEWS 2014-06-17 23:22:57 UTC (rev 1820) +++ trunk/gplots/inst/NEWS 2014-06-19 18:36:19 UTC (rev 1821) @@ -1,3 +1,27 @@ +Release 2.14.0 - 2014-06-18 +--------------------------- + +Bug Fixes: + +- heatmap.2(): Fix typo in heatmap.2() that caused an error when + 'Rowv=FALSE'. (Reported by Yuanhua Liu.) + +Enhancements: + +- heatmap.2(): Add new 'reorderfun' argument to allow the user to + specify an alternative function to reorder rows/columns based on + row/column dendrogram. (Suggested by Yuanhua Liu.) + +- heatmap.2(): Center margin labels. + +- heatmap.2(): Check size of user-provided Rowv and Colv dendrogram + objects to ensure they match the dimensions of the data. + +- Add references to man page for hist2d() and ci2d() to the new r2d2 + package which implements an improved algorithm for 2-dimensional + emprical confidence regions. + + Release 2.13.0 - 2014-04-04 --------------------------- This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2014-06-17 23:23:01
|
Revision: 1820 http://sourceforge.net/p/r-gregmisc/code/1820 Author: warnes Date: 2014-06-17 23:22:57 +0000 (Tue, 17 Jun 2014) Log Message: ----------- - Document new 'key.title', 'key.xlab', 'key.ylab', 'key.xtickfun', 'key.ytickfun', 'key.par' arguments to heatmap.2 (belated commit). - Document new 'reorderfun' argument to heatmap.2. Modified Paths: -------------- trunk/gplots/man/heatmap.2.Rd Modified: trunk/gplots/man/heatmap.2.Rd =================================================================== --- trunk/gplots/man/heatmap.2.Rd 2014-06-17 23:19:46 UTC (rev 1819) +++ trunk/gplots/man/heatmap.2.Rd 2014-06-17 23:22:57 UTC (rev 1820) @@ -20,6 +20,7 @@ distfun = dist, hclustfun = hclust, dendrogram = c("both","row","column","none"), + reorderfun = function(d, w) reorder(d, w), symm = FALSE, # data scaling @@ -78,6 +79,12 @@ denscol=tracecol, symkey = min(x < 0, na.rm=TRUE) || symbreaks, densadj = 0.25, + key.title = NULL, + key.xlab = NULL, + key.ylab = NULL, + key.xtickfun = NULL, + key.ytickfun = NULL, + key.par=list(), # plot labels main = NULL, @@ -95,7 +102,7 @@ ) } \arguments{ - % Dendogram Control + % Dendrogram Control \item{x}{numeric matrix of the values to be plotted. } \item{Rowv}{determines if and how the \emph{row} dendrogram should be reordered. By default, it is TRUE, which implies dendrogram is @@ -115,15 +122,17 @@ \code{\link{hclust}}.} \item{dendrogram}{character string indicating whether to draw 'none', 'row', 'column' or 'both' dendrograms. Defaults to 'both'. However, - if Rowv (or Colv) is FALSE or NULL and dendrogram is 'both', then a - warning is issued and Rowv (or Colv) arguments are honoured.} + if Rowv (or Colv) is FALSE or NULL and dendrogram is 'both', then a + warning is issued and Rowv (or Colv) arguments are honoured.} + \item{reorderfun}{\code{function(d, w)} of dendrogram and weights for + reordering the row and column dendrograms. The default uses + \code{\link{stats}{reorder.dendrogram}}. \item{symm}{logical indicating if \code{x} should be treated \bold{symm}etrically; can only be true when \code{x} is a square matrix.} % data scaling \item{scale}{character indicating if the values should be centered and scaled in either the row direction or the column direction, or - none. The default is \code{"row"} if \code{symm} false, and - \code{"none"} otherwise.} + none. The default is \code{"none"}.} \item{na.rm}{logical indicating whether \code{NA}'s should be removed.} % image plot \item{revC}{logical indicating if the column order should be @@ -207,6 +216,20 @@ a density plot is drawn on the color key. (See the \code{adjust} parameter for the \code{density} function for details.) Defaults to 0.25.} + \item{key.title}{main title of the color key. If set to NA no title + will be plotted.} + \item{key.xlab}{x axis label of the color key. If set to NA no label + will be plotted.} + \item{key.ylab}{y axis label of the color key. If set to NA no label + will be plotted.} + \item{key.xtickfun}{function computing tick location and labels for + the xaxis of the color key. Returns a named list containing + parameters that can be passed to \code{axis}. See examples.} + \item{key.ytickfun}{function computing tick location and labels for + the y axis of the color key. Returns a named list containing + parameters that can be passed to \code{axis}. See examples.} + \item{key.par}{graphical parameters for the color key. Named list that + can be passed to \code{par}.} % plot labels \item{main, xlab, ylab}{main, x- and y-axis titles; defaults to none.} % figure layout @@ -234,19 +257,19 @@ If either is \code{\link{NULL}}, \emph{no reordering} will be done for the corresponding side. - If \code{scale="row"} the rows are scaled to have mean - zero and standard deviation one. There is some empirical evidence - from genomic plotting that this is useful. + If \code{scale="row"} (or \code{scale="col"}) the rows (columns) are + scaled to have mean zero and standard deviation one. There is some + empirical evidence from genomic plotting that this is useful. The default colors range from red to white (\code{heat.colors}) and - are not pretty. Consider using enhancements such - as the \pkg{RColorBrewer} package, + are not pretty. Consider using enhancements such as the + \pkg{RColorBrewer} package, \url{http://cran.r-project.org/src/contrib/PACKAGES.html#RColorBrewer} to select better colors. By default four components will be displayed in the plot. At the top - left is the color key, top right is the column dendogram, bottom left - is the row dendogram, bottom right is the image plot. When + left is the color key, top right is the column dendrogram, bottom left + is the row dendrogram, bottom right is the image plot. When RowSideColor or ColSideColor are provided, an additional row or column is inserted in the appropriate location. This layout can be overriden by specifiying appropriate values for \code{lmat}, @@ -257,16 +280,13 @@ arguments. } \note{ - The original rows and columns are reordered \emph{in any case} to - match the dendrogram, e.g., the rows by - \code{\link{order.dendrogram}(Rowv)} where \code{Rowv} is the - (possibly \code{\link{reorder}()}ed) row dendrogram. + The original rows and columns are reordered to match the dendrograms + \code{Rowv} and \code{Colv} (if present). - \code{heatmap.2()} uses \code{\link{layout}} and draws the - \code{\link{image}} in the lower right corner of a 2x2 layout. - Consequentially, it can \bold{not} be used in a multi column/row - layout, i.e., when \code{\link{par}(mfrow= *)} or \code{(mfcol= *)} - has been called. + \code{heatmap.2()} uses \code{\link{layout}} to arragent the plot + elements. Consequentially, it can \bold{not} be used in a multi + column/row layout using \code{\link{layout}(\dots)}, + \code{\link{par}(mfrow=\dots)} or \code{(mfcol=\dots)}. } \value{ Invisibly, a list with components @@ -304,7 +324,7 @@ cc <- rainbow(ncol(x), start=0, end=.3) ## - ## demonstrate the effect of row and column dendogram options + ## demonstrate the effect of row and column dendrogram options ## heatmap.2(x) ## default - dendrogram plotted and reordering done. heatmap.2(x, dendrogram="none") ## no dendrogram plotted, but reordering done. @@ -317,6 +337,10 @@ heatmap.2(x, Rowv=NULL, dendrogram="both") ## generate warning! heatmap.2(x, Colv=FALSE, dendrogram="both") ## generate warning! + ## Reorder dendrogram by branch means rather than sums + heatmap.2(x, reorderfun=function(d, w) reorder(d, w, agglo.FUN = mean) ) + + ## Show effect of row and column label rotation heatmap.2(x, srtCol=NULL) heatmap.2(x, srtCol=0, adjCol = c(0.5,1) ) @@ -332,6 +356,7 @@ heatmap.2(x, srtRow=45, adjRow=c(0, 1), srtCol=45, adjCol=c(1,1) ) heatmap.2(x, srtRow=45, adjRow=c(0, 1), srtCol=270, adjCol=c(0,0.5) ) + ## Show effect of offsetRow/offsetCol (only works when srtRow/srtCol is ## not also present) heatmap.2(x, offsetRow=0, offsetCol=0) @@ -344,6 +369,7 @@ heatmap.2(x, srtRow=0, srtCol=90, offsetRow=2, offsetCol=2) heatmap.2(x, srtRow=0, srtCol=90, offsetRow=-1, offsetCol=-1) + ## Show how to use 'extrafun' to replace the 'key' with a scatterplot lmat <- rbind( c(5,3,4), c(2,1,4) ) lhei <- c(1.5, 4) @@ -357,7 +383,42 @@ heatmap.2(x, lmat=lmat, lhei=lhei, lwid=lwid, key=FALSE, extrafun=myplot) + ## show how to customize the color key + heatmap.2(x, + key.title=NA, # no title + key.xlab=NA, # no xlab + key.par=list(mgp=c(1.5, 0.5, 0), + mar=c(2.5, 2.5, 1, 0)), + key.xtickfun=function() { + breaks <- parent.frame()$breaks + return(list( + at=parent.frame()$scale01(c(breaks[1], + breaks[length(breaks)])), + labels=c(as.character(breaks[1]), + as.character(breaks[length(breaks)])) + )) + }) + heatmap.2(x, + breaks=256, + key.title=NA, + key.xlab=NA, + key.par=list(mgp=c(1.5, 0.5, 0), + mar=c(1, 2.5, 1, 0)), + key.xtickfun=function() { + cex <- par("cex")*par("cex.axis") + side <- 1 + line <- 0 + col <- par("col.axis") + font <- par("font.axis") + mtext("low", side=side, at=0, adj=0, + line=line, cex=cex, col=col, font=font) + mtext("high", side=side, at=1, adj=1, + line=line, cex=cex, col=col, font=font) + return(list(labels=FALSE, tick=FALSE)) + }) + + ## ## Show effect of z-score scaling within columns, blue-red color scale ## This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2014-06-17 23:19:50
|
Revision: 1819 http://sourceforge.net/p/r-gregmisc/code/1819 Author: warnes Date: 2014-06-17 23:19:46 +0000 (Tue, 17 Jun 2014) Log Message: ----------- Allow user to specify function used to reorder based on the dendogram via a new 'reorderfun' argument. Suggested by Yuanhua Liu. Modified Paths: -------------- trunk/gplots/R/heatmap.2.R Modified: trunk/gplots/R/heatmap.2.R =================================================================== --- trunk/gplots/R/heatmap.2.R 2014-06-17 20:34:17 UTC (rev 1818) +++ trunk/gplots/R/heatmap.2.R 2014-06-17 23:19:46 UTC (rev 1819) @@ -8,6 +8,7 @@ distfun = dist, hclustfun = hclust, dendrogram = c("both","row","column","none"), + reorderfun = function(d, w) reorder(d, w), symm = FALSE, ## data scaling @@ -109,13 +110,6 @@ "specified can produce unpredictable results.", "Please consider using only one or the other.") - ## key & density don't make sense when data is not all on the same scale - ## if(scale!="none" && key==TRUE) - ## { - ## warning("Key cannot be plotted when scale!=\"none\".") - ## key=FALSE - ## } - if ( is.null(Rowv) || is.na(Rowv) ) Rowv <- FALSE if ( is.null(Colv) || is.na(Colv) ) @@ -190,7 +184,7 @@ { ## Compute dendrogram and do reordering based on given vector hcr <- hclustfun(distfun(x)) ddr <- as.dendrogram(hcr) - ddr <- reorder(ddr, Rowv) + ddr <- reorderfun(ddr, Rowv) rowInd <- order.dendrogram(ddr) if(nr != length(rowInd)) @@ -201,7 +195,7 @@ Rowv <- rowMeans(x, na.rm = na.rm) hcr <- hclustfun(distfun(x)) ddr <- as.dendrogram(hcr) - ddr <- reorder(ddr, Rowv) + ddr <- reorderfun(ddr, Rowv) rowInd <- order.dendrogram(ddr) if(nr != length(rowInd)) @@ -232,7 +226,7 @@ {## Compute dendrogram and do reordering based on given vector hcc <- hclustfun(distfun(if(symm)x else t(x))) ddc <- as.dendrogram(hcc) - ddc <- reorder(ddc, Colv) + ddc <- reorderfun(ddc, Colv) colInd <- order.dendrogram(ddc) if(nc != length(colInd)) @@ -243,7 +237,7 @@ Colv <- colMeans(x, na.rm = na.rm) hcc <- hclustfun(distfun(if(symm)x else t(x))) ddc <- as.dendrogram(hcc) - ddc <- reorder(ddc, Colv) + ddc <- reorderfun(ddc, Colv) colInd <- order.dendrogram(ddc) if(nc != length(colInd)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2014-06-17 20:34:24
|
Revision: 1818 http://sourceforge.net/p/r-gregmisc/code/1818 Author: warnes Date: 2014-06-17 20:34:17 +0000 (Tue, 17 Jun 2014) Log Message: ----------- Fix typo in heatmap.2() reported by Yuanhua Liu. Modified Paths: -------------- trunk/gplots/R/heatmap.2.R Modified: trunk/gplots/R/heatmap.2.R =================================================================== --- trunk/gplots/R/heatmap.2.R 2014-06-05 17:21:11 UTC (rev 1817) +++ trunk/gplots/R/heatmap.2.R 2014-06-17 20:34:17 UTC (rev 1818) @@ -147,7 +147,7 @@ if (is.logical(Colv) && (Colv)) dendrogram <- "column" else - dedrogram <- "none" + dendrogram <- "none" warning("Discrepancy: Rowv is FALSE, while dendrogram is `", dendrogram, "'. Omitting row dendogram.") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2014-06-05 17:21:17
|
Revision: 1817 http://sourceforge.net/p/r-gregmisc/code/1817 Author: warnes Date: 2014-06-05 17:21:11 +0000 (Thu, 05 Jun 2014) Log Message: ----------- Check size of Rowv and Colv dendogram objects to ensure they matches data. Modified Paths: -------------- trunk/gplots/R/heatmap.2.R Modified: trunk/gplots/R/heatmap.2.R =================================================================== --- trunk/gplots/R/heatmap.2.R 2014-05-28 00:24:23 UTC (rev 1816) +++ trunk/gplots/R/heatmap.2.R 2014-06-05 17:21:11 UTC (rev 1817) @@ -183,6 +183,8 @@ { ddr <- Rowv ## use Rowv 'as-is', when it is dendrogram rowInd <- order.dendrogram(ddr) + if(length(rowInd)>nr || any(rowInd<1 | rowInd > nr )) + stop("Rowv dendrogram doesn't match size of x") } else if (is.integer(Rowv)) { ## Compute dendrogram and do reordering based on given vector @@ -214,6 +216,8 @@ { ddc <- Colv ## use Colv 'as-is', when it is dendrogram colInd <- order.dendrogram(ddc) + if(length(ColInd)>nr || any(colInd<1 | colInd > nc )) + stop("Colv dendrogram doesn't match size of x") } else if(identical(Colv, "Rowv")) { if(nr != nc) 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-05-28 00:18:42
|
Revision: 1815 http://sourceforge.net/p/r-gregmisc/code/1815 Author: warnes Date: 2014-05-28 00:18:38 +0000 (Wed, 28 May 2014) Log Message: ----------- Add test to ensure smartbind() properly handles Date columns. Added Paths: ----------- trunk/gtools/tests/smartbind_Dates.R Added: trunk/gtools/tests/smartbind_Dates.R =================================================================== --- trunk/gtools/tests/smartbind_Dates.R (rev 0) +++ trunk/gtools/tests/smartbind_Dates.R 2014-05-28 00:18:38 UTC (rev 1815) @@ -0,0 +1,9 @@ +library(gtools) + +today <- Sys.Date() +tenweeks <- seq(today, length.out=10, by="1 week") + +df1 <- data.frame(dates=tenweeks, chars=letters[1:10], ints=1:10, numeric=1.1:10.1) +df2 <- data.frame(chars=letters[11:20], ints=11:20, numeric=11.1:20.1) + +smartbind(df1, df2) 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:15:00
|
Revision: 1814 http://sourceforge.net/p/r-gregmisc/code/1814 Author: warnes Date: 2014-05-28 00:14:56 +0000 (Wed, 28 May 2014) Log Message: ----------- smartbind: Convert non-native type columns (except factor) to character. Modified Paths: -------------- trunk/gtools/R/smartbind.R Modified: trunk/gtools/R/smartbind.R =================================================================== --- trunk/gtools/R/smartbind.R 2014-04-18 18:11:20 UTC (rev 1813) +++ trunk/gtools/R/smartbind.R 2014-05-28 00:14:56 UTC (rev 1814) @@ -63,18 +63,33 @@ " End:", end, " Column:", col, "\n", sep="") + if ("factor" %in% classVec) { newclass <- "character" } else - newclass <- classVec + newclass <- classVec[1] + ## Coerce everything that isn't a native type to character + if(! (newclass %in% c("logical", "integer", "numeric", + "complex", "character", "raw") )) + { + newclass <- "character" + warning("Converting non-atomic type column '", col, + "' to type character.") + } + retval[[col]] <- as.vector(rep(fill,nrows), mode=newclass) } - retval[[col]][start:end] <- as.vector(block[,col], - mode=class(retval[[col]])) + mode <- class(retval[[col]]) + if(mode=="character") + vals <- as.character(block[,col]) + else + vals <- block[,col] + + retval[[col]][start:end] <- as.vector(vals, mode=mode) } start <- end+1 blockIndex <- blockIndex+1 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-04-17 19:05:15
|
Revision: 1812 http://sourceforge.net/p/r-gregmisc/code/1812 Author: warnes Date: 2014-04-17 19:05:11 +0000 (Thu, 17 Apr 2014) Log Message: ----------- Add see also to r2d2::freq2d. Modified Paths: -------------- trunk/gplots/man/hist2d.Rd Modified: trunk/gplots/man/hist2d.Rd =================================================================== --- trunk/gplots/man/hist2d.Rd 2014-04-17 19:03:08 UTC (rev 1811) +++ trunk/gplots/man/hist2d.Rd 2014-04-17 19:05:11 UTC (rev 1812) @@ -39,7 +39,6 @@ then constucted which holds the counts of the number of observed (x,y) pairs that fall into each bin. If \code{show=TRUE}, this matrix is then then passed to \code{image} for display. - } \value{ A list containing 5 elements: @@ -50,7 +49,10 @@ } \author{ Gregory R. Warnes \email{gr...@wa...}} -\seealso{ \code{\link{image}}, \code{\link{persp}}, \code{\link{hist}} } +\seealso{ + \code{\link{image}}, \code{\link{persp}}, \code{\link{hist}}, + \code{\link[r2d2]{freq2d}} + } \examples{ ## example data, bivariate normal, no correlation This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2014-04-17 19:03:13
|
Revision: 1811 http://sourceforge.net/p/r-gregmisc/code/1811 Author: warnes Date: 2014-04-17 19:03:08 +0000 (Thu, 17 Apr 2014) Log Message: ----------- Add reference to r2d2::conf2d. Modified Paths: -------------- trunk/gplots/man/ci2d.Rd Modified: trunk/gplots/man/ci2d.Rd =================================================================== --- trunk/gplots/man/ci2d.Rd 2014-04-17 17:33:31 UTC (rev 1810) +++ trunk/gplots/man/ci2d.Rd 2014-04-17 19:03:08 UTC (rev 1811) @@ -65,6 +65,10 @@ Confidence intervals generated by ci2d are \emph{approximate}, and are subject to biases and/or artifacts induced by the binning or kernel smoothing method, bin locations, bin sizes, and kernel bandwidth. + + The \code{\link[r2d2]{conf2d}} function in the \pkg{r2d2} package may create a more + accurate confidence region, and reports the actual proportion of + points inside the region. } \value{ A \code{ci2d} object consisting of a list containing (at least) the @@ -82,8 +86,8 @@ } \author{ Gregory R. Warnes \email{gr...@wa...}} \seealso{ - \code{\link[KernSmooth]{bkde2D}}, \code{\link[KernSmooth]{dpik}}, - \code{\link{hist2d}} + \code{\link[KernSmooth]{bkde2D}}, \code{\link[r2d2]{conf2d}}, + \code{\link[KernSmooth]{dpik}}, \code{\link{hist2d}} } \examples{ #### This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2014-04-17 17:33:33
|
Revision: 1810 http://sourceforge.net/p/r-gregmisc/code/1810 Author: warnes Date: 2014-04-17 17:33:31 +0000 (Thu, 17 Apr 2014) Log Message: ----------- Update ASCIIfy man page to match source code and add keywords Modified Paths: -------------- trunk/gtools/man/ASCIIfy.Rd Modified: trunk/gtools/man/ASCIIfy.Rd =================================================================== --- trunk/gtools/man/ASCIIfy.Rd 2014-04-17 17:25:53 UTC (rev 1809) +++ trunk/gtools/man/ASCIIfy.Rd 2014-04-17 17:33:31 UTC (rev 1810) @@ -6,10 +6,10 @@ single-byte (\samp{\x00}) or two-byte (\samp{\u0000}) codes. } \usage{ -ASCIIfy(x, bytes = 2, fallback = "?") +ASCIIfy(string, bytes = 2, fallback = "?") } \arguments{ - \item{x}{a character vector, possibly containing non-ASCII + \item{string}{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.} @@ -44,4 +44,5 @@ print(athens) ASCIIfy(athens) } -\keyword{} +\keyword{utilites} +\keyword{character} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2014-04-17 17:25:55
|
Revision: 1809 http://sourceforge.net/p/r-gregmisc/code/1809 Author: warnes Date: 2014-04-17 17:25:53 +0000 (Thu, 17 Apr 2014) Log Message: ----------- Update NEWS for gtools 3.4.0 Modified Paths: -------------- trunk/gtools/inst/NEWS Modified: trunk/gtools/inst/NEWS =================================================================== --- trunk/gtools/inst/NEWS 2014-04-17 16:56:34 UTC (rev 1808) +++ trunk/gtools/inst/NEWS 2014-04-17 17:25:53 UTC (rev 1809) @@ -1,3 +1,13 @@ +gtools 3.4.0 - 2014-04-14 +------------------------- + +New features: + +- New ASCIIfy() function to converts character vectors to ASCII + representation by escaping them as \x00 or \u0000 codes. + Contributed by Arni Magnusson. + + gtools 3.3.1 - 2014-03-01 ------------------------- This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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: <wa...@us...> - 2014-04-10 02:32:23
|
Revision: 1807 http://sourceforge.net/p/r-gregmisc/code/1807 Author: warnes Date: 2014-04-10 02:32:21 +0000 (Thu, 10 Apr 2014) Log Message: ----------- Oops. Correct over-zealous paste. Modified Paths: -------------- trunk/SASxport/tests/dfAttributes.R Modified: trunk/SASxport/tests/dfAttributes.R =================================================================== --- trunk/SASxport/tests/dfAttributes.R 2014-04-10 02:29:46 UTC (rev 1806) +++ trunk/SASxport/tests/dfAttributes.R 2014-04-10 02:32:21 UTC (rev 1807) @@ -30,8 +30,8 @@ label(abc.out, self=TRUE, "MISSING!") label(abc.in , self=TRUE, "MISSING!") -SAStype(abc.out, self=TRUE, "MISSING!") -SAStype(abc.in , self=TRUE, "MISSING!") +SAStype(abc.out, "MISSING!") +SAStype(abc.in , "MISSING!") stopifnot( label (abc.out, self=TRUE, "MISSING!") == label (abc.in, self=TRUE, "MISSING!") ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2014-04-10 02:29:48
|
Revision: 1806 http://sourceforge.net/p/r-gregmisc/code/1806 Author: warnes Date: 2014-04-10 02:29:46 +0000 (Thu, 10 Apr 2014) Log Message: ----------- Update test to use new 'self' argument for label data.frame method. Modified Paths: -------------- trunk/SASxport/tests/dfAttributes.R Modified: trunk/SASxport/tests/dfAttributes.R =================================================================== --- trunk/SASxport/tests/dfAttributes.R 2014-04-10 02:11:45 UTC (rev 1805) +++ trunk/SASxport/tests/dfAttributes.R 2014-04-10 02:29:46 UTC (rev 1806) @@ -5,7 +5,7 @@ abc.out <- data.frame( x=c(1, 2, NA, NA ), y=c('a', 'B', NA, '*' ) ) ## add a data set label (not used by R) -label(abc.out) <- "xxxx data set xxxxx" +label(abc.out, self=TRUE) <- "xxxx data set xxxxx" SAStype(abc.out) <- "normal" ## add a format specifier (not used by R) @@ -27,13 +27,16 @@ abc.in <- read.xport("dfAttributes.xpt", names.tolower=FALSE) ## Test that the files are otherwise identical -label(abc.out, "MISSING!") -label(abc.in , "MISSING!") +label(abc.out, self=TRUE, "MISSING!") +label(abc.in , self=TRUE, "MISSING!") -SAStype(abc.out, "MISSING!") -SAStype(abc.in , "MISSING!") +SAStype(abc.out, self=TRUE, "MISSING!") +SAStype(abc.in , self=TRUE, "MISSING!") -stopifnot( label (abc.out, "MISSING!")==label (abc.in, "MISSING!") ) -stopifnot( SAStype(abc.out, "MISSING!")==SAStype(abc.in, "MISSING!") ) +stopifnot( label (abc.out, self=TRUE, "MISSING!") == + label (abc.in, self=TRUE, "MISSING!") ) +stopifnot( SAStype(abc.out, "MISSING!") == + SAStype(abc.in, "MISSING!") ) + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2014-04-10 02:11:49
|
Revision: 1805 http://sourceforge.net/p/r-gregmisc/code/1805 Author: warnes Date: 2014-04-10 02:11:45 +0000 (Thu, 10 Apr 2014) Log Message: ----------- Update for SASxport 1.4.0. Modified Paths: -------------- trunk/SASxport/DESCRIPTION trunk/SASxport/inst/NEWS Modified: trunk/SASxport/DESCRIPTION =================================================================== --- trunk/SASxport/DESCRIPTION 2014-04-10 02:03:19 UTC (rev 1804) +++ trunk/SASxport/DESCRIPTION 2014-04-10 02:11:45 UTC (rev 1805) @@ -1,7 +1,7 @@ Package: SASxport Type: Package Title: Read and Write SAS XPORT Files -Version: 1.3.7 +Version: 1.4.0 Date: 2014-04-09 Description: This package provides functions for reading, listing the contents of, and writing SAS xport format files. Modified: trunk/SASxport/inst/NEWS =================================================================== --- trunk/SASxport/inst/NEWS 2014-04-10 02:03:19 UTC (rev 1804) +++ trunk/SASxport/inst/NEWS 2014-04-10 02:11:45 UTC (rev 1805) @@ -1,3 +1,20 @@ +Version 1.4.0 - 2014-04-09 +-------------------------- + +API Change: + +- SASxport now relies on the 'label' methods defined by the Hmisc + package instead of defining its own. + +Bug fixes: + +- The 'read.xport' and 'write.xport' functions were failing when both + the SASxport and the Hmisc packages were loaded due to conflicts + between the label methods defined by each package. This has been + resolved by removing the label methods from SASxport and using those + from Hmisc instead. + + Version 1.3.6 2013-10-09 ------------------------ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2014-04-10 02:03:22
|
Revision: 1804 http://sourceforge.net/p/r-gregmisc/code/1804 Author: warnes Date: 2014-04-10 02:03:19 +0000 (Thu, 10 Apr 2014) Log Message: ----------- Remove definitions of labels in favor of those coming from Hmisc. Modify read.xport and write.xport to use appropriate arguments for label method for data.frames. Modified Paths: -------------- trunk/SASxport/DESCRIPTION trunk/SASxport/NAMESPACE Modified: trunk/SASxport/DESCRIPTION =================================================================== --- trunk/SASxport/DESCRIPTION 2014-04-10 02:02:25 UTC (rev 1803) +++ trunk/SASxport/DESCRIPTION 2014-04-10 02:03:19 UTC (rev 1804) @@ -1,8 +1,8 @@ Package: SASxport Type: Package Title: Read and Write SAS XPORT Files -Version: 1.3.6 -Date: 2013-10-09 +Version: 1.3.7 +Date: 2014-04-09 Description: This package provides functions for reading, listing the contents of, and writing SAS xport format files. The functions support reading and writing of either @@ -38,5 +38,5 @@ <http://metruminstitute.org>. Maintainer: Gregory R. Warnes <gr...@wa...> License: GPL-2 -Depends: R (>= 2.4.0), chron +Depends: R (>= 2.4.0), chron, Hmisc URL: http://www.warnes.net, http://metruminstitute.org Modified: trunk/SASxport/NAMESPACE =================================================================== --- trunk/SASxport/NAMESPACE 2014-04-10 02:02:25 UTC (rev 1803) +++ trunk/SASxport/NAMESPACE 2014-04-10 02:03:19 UTC (rev 1804) @@ -2,20 +2,21 @@ importFrom(chron, chron, times) importFrom(utils, packageDescription) +importFrom(Hmisc, label, "label<-") export( toSAS, lookup.xport, read.xport, write.xport, - "label", - "label<-", + ## "label", + ## "label<-", makeSASNames, - + "SASformat", "SASformat<-", - + "SASiformat", "SASiformat<-", @@ -32,12 +33,12 @@ S3method(toSAS, Date) S3method(toSAS, default) -S3method(label, default) +## S3method(label, default) S3method(SASformat, default) S3method(SASiformat, default) S3method(SAStype, default) -S3method("label<-", default) +## S3method("label<-", default) S3method("SASformat<-", default) S3method("SASiformat<-", default) S3method("SAStype<-", default) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2014-04-10 02:02:29
|
Revision: 1803 http://sourceforge.net/p/r-gregmisc/code/1803 Author: warnes Date: 2014-04-10 02:02:25 +0000 (Thu, 10 Apr 2014) Log Message: ----------- Remove definitions of labels in favor of those coming from Hmisc. Modify read.xport and write.xport to use appropriate arguments for label method for data.frames. Modified Paths: -------------- trunk/SASxport/R/read.xport.R trunk/SASxport/R/write.xport.R Removed Paths: ------------- trunk/SASxport/R/label.R trunk/SASxport/man/label.Rd Deleted: trunk/SASxport/R/label.R =================================================================== --- trunk/SASxport/R/label.R 2014-04-09 23:52:17 UTC (rev 1802) +++ trunk/SASxport/R/label.R 2014-04-10 02:02:25 UTC (rev 1803) @@ -1,20 +0,0 @@ -label <- function(x, default) - UseMethod("label") - -label.default <- function(x, default=NULL) -{ - lab <- attr(x,"label") - if(is.null(lab)) - default - else - lab -} - -"label<-" <- function(x, value) - UseMethod("label<-") - -"label<-.default" <- function(x, value) -{ - attr(x,'label') <- value - x -} Modified: trunk/SASxport/R/read.xport.R =================================================================== --- trunk/SASxport/R/read.xport.R 2014-04-09 23:52:17 UTC (rev 1802) +++ trunk/SASxport/R/read.xport.R 2014-04-10 02:02:25 UTC (rev 1803) @@ -1,5 +1,5 @@ ## -## Code originally from Frank Harrell's 'Hmisc' library: +## Code originally from Frank Harrell's 'Hmisc' library: ## http://biostat.mc.vanderbilt.edu/twiki/bin/view/Main/Hmisc ## Copied with permission on 2007-08-04 ## @@ -32,7 +32,7 @@ if(length(grep('http://', file))>0 || length(grep('ftp://', file))>0 ) { - scat("Downloading file...") + scat("Downloading file...") tf <- tempfile() download.file(file, tf, mode='wb', quiet=TRUE) file <- tf @@ -44,13 +44,13 @@ file.header <- substr(file.header, start=1, stop=nchar(xport.file.header) ) if( !identical(xport.file.header, file.header) ) stop("The specified file does not start with a SAS xport file header!") - + scat("Extracting data file information...") dsinfo <- lookup.xport.inner(file) dsLabels <- sapply(dsinfo, label) dsTypes <- sapply(dsinfo, SAStype) - + if(length(keep)) whichds <- toupper(keep) else @@ -65,7 +65,7 @@ names(ds) <- make.unique(names(ds)) } - + if( (length(keep)>0 || length(drop)>0) ) ds <- ds[whichds] @@ -82,7 +82,7 @@ fds <- fds[1] } } - + finfo <- NULL if(length(formats) || length(fds)) { if(length(formats)) @@ -108,7 +108,7 @@ names(res) <- gsub('_','.',dsn) - possiblyConvertChar <- (is.logical(as.is) && !as.is) || + possiblyConvertChar <- (is.logical(as.is) && !as.is) || (is.numeric(as.is) && as.is > 0) j <- 0 for(k in which.regular) { @@ -120,9 +120,9 @@ else ds[[k]] scat('.') - - label(w) <- dsLabels[k] - names(label(w)) <- NULL + + label(w, self=TRUE) <- dsLabels[k] + names(label(w, self=TRUE)) <- NULL SAStype(w) <- dsTypes[k] names(SAStype(w)) <- NULL @@ -137,7 +137,7 @@ iformats <- fstr( ifmt, dinfo$iflength, dinfo$ifdigits) lab <- dinfo$label - + ndinfo <- names.tolower(makeNames(dinfo$name, allow=name.chars)) names(lab) <- names(fmt) <- names(formats) <- names(iformats) <- ndinfo if(length(w)>0) @@ -176,13 +176,13 @@ } } } else if(possiblyConvertChar && is.character(x)) { - if((is.logical(as.is) && !as.is) || + if((is.logical(as.is) && !as.is) || (is.numeric(as.is) && length(unique(x)) < as.is*length(x))) { x <- factor(x, exclude='') changed <- TRUE } } - + lz <- lab[nam[i]] if(!is.null(lz) && length(lz)>0 && !is.na(lz) && lz != '') { names(lz) <- NULL @@ -195,13 +195,13 @@ SASformat(x) <- formats[[nam[i]]] changed <- TRUE } - + if(nam[i] %in% names(iformats) && iformats[nam[i]] > "" ) { SASformat(x) <- formats[[nam[i]]] changed <- TRUE } - + if(changed) w[[i]] <- x } @@ -216,7 +216,7 @@ if( include.formats ) { nds <- nds+1 - if( length(fds)>0 ) + if( length(fds)>0 ) res$"FORMATS" <- ds[[fds]] else res$FORMATS <- empty.format.table() Modified: trunk/SASxport/R/write.xport.R =================================================================== --- trunk/SASxport/R/write.xport.R 2014-04-09 23:52:17 UTC (rev 1802) +++ trunk/SASxport/R/write.xport.R 2014-04-10 02:02:25 UTC (rev 1803) @@ -1,13 +1,13 @@ write.xport <- function(..., list=base::list(), - file = stop("'file' must be specified"), + file = stop("'file' must be specified"), verbose=FALSE, sasVer="7.00", osType, cDate=Sys.time(), formats=NULL, autogen.formats=TRUE - ) + ) { ## Handle verbose option ## @@ -31,10 +31,10 @@ dotNames <- names(dotList) if(is.null(dotNames)) dotNames <- rep("", length(dotList)) - if(length(dotList)>0) + if(length(dotList)>0) { ## Get data frame names from ... in function call, but don't - ## clobber any explicitly provided names + ## clobber any explicitly provided names mc <- match.call() mc$file <- NULL mc$verbose <- NULL @@ -45,8 +45,8 @@ mc$autogen.formats <- NULL mc[[1]] <- NULL # note we *do not* mask off format argument so it will get - # magically included if present. - + # magically included if present. + mc <- as.character(mc) badNames <- which(is.na(dotNames) | dotNames<="") @@ -59,7 +59,7 @@ listNames <- rep("", length(list)) dfList <- c(dotList, list) dfNames <- c(dotNames, listNames) - + ## check for and handle <NA> or empty names ## badNames <- which(is.na(dfNames) | dfNames<="") if(length(badNames)>0) @@ -79,7 +79,7 @@ if(length(not.df)==1) stop(paste("'", dfNames[not.df], "'"), " is not a data.frame object.") - else + else stop(paste("'", dfNames[not.df], "'", sep="", collapse=", "), " are not data.frame objects.") ## @@ -111,8 +111,8 @@ ####### scat("opening file ...") - if (is.character(file)) - if (file == "") + if (is.character(file)) + if (file == "") file <- stdout() else { file <- file(description=file, open="wb") @@ -132,10 +132,10 @@ scat("Write file header ...") out( xport.file.header( cDate=cDate, sasVer=sasVer, osType=osType ) ) scat("Done.") - + for(i in dfNames) { - + df <- dfList[[i]] if(is.null(colnames(df))) @@ -149,17 +149,17 @@ dfList[[i]] <- df } - + colnames(dfList[[i]]) <- colnames(df) <- varNames <- makeSASNames(colnames(df)) - + offsetTable <- data.frame("name"=varNames, "len"=rep(NA, length(varNames)), "offset"=rep(NA, length(varNames)) ) rownames(offsetTable) <- offsetTable[,"name"] - dfLabel <- label(df, default="" ) + dfLabel <- label(df, default="", self=TRUE ) dfType <- SAStype(df, default="") - + scat("Write data frame header ...") out( xport.member.header(dfName=i, cDate=cDate, sasVer=sasVer, osType=osType, dfLabel=dfLabel, dfType=dfType) ) @@ -168,7 +168,7 @@ scat("Write variable information block header ...") out( xport.namestr.header( nvar=ncol(df) ) ) scat("Done.") - + scat("Write entries for variable information block ...") lenIndex <- 0 varIndex <- 1 @@ -197,14 +197,14 @@ offsetTable[i, "offset"] <- lenIndex - + # parse format and iformat formatInfo <- parseFormat(varFormat) iFormatInfo <- parseFormat(varIFormat) - - - + + + # write the entry out( xport.namestr( @@ -213,7 +213,7 @@ varNum = varIndex, varPos = lenIndex, varLength = varLen, - varLabel = varLabel, + varLabel = varLabel, fName = formatInfo$name, fLength = formatInfo$len, fDigits = formatInfo$digits, @@ -232,8 +232,8 @@ # Space-fill to 80 character record end fillSize <- 80 - (spaceUsed %% 80) - if(fillSize==80) fillSize <- 0 - out( xport.fill( TRUE, fillSize ) ) + if(fillSize==80) fillSize <- 0 + out( xport.fill( TRUE, fillSize ) ) scat("Write header for data block ...") out( xport.obs.header() ) @@ -248,7 +248,7 @@ { val <- df[i,j] valLen <- offsetTable[j,"len"] - + scat("i=", i, " j=", j, " value=", val, " len=", valLen, ""); if(is.character( val )) { @@ -260,18 +260,18 @@ spaceUsed <- spaceUsed + valLen } } - + fillSize <- 80 - (spaceUsed %% 80) if(fillSize==80) fillSize <- 0 out( xport.fill(TRUE, fillSize ) ) - + scat("Done.") } scat("Closing file ...") - if (is.character(file)) + if (is.character(file)) if (file != "") - { + { close(file) on.exit() } Deleted: trunk/SASxport/man/label.Rd =================================================================== --- trunk/SASxport/man/label.Rd 2014-04-09 23:52:17 UTC (rev 1802) +++ trunk/SASxport/man/label.Rd 2014-04-10 02:02:25 UTC (rev 1803) @@ -1,107 +0,0 @@ -\name{label} - -\alias{label} -\alias{label.default} -\alias{label<-} -\alias{label<-.default} - -\alias{SASformat} -\alias{SASformat.default} -\alias{SASformat<-} -\alias{SASformat<-.default} - -\alias{SASiformat} -\alias{SASiformat.default} -\alias{SASiformat<-} -\alias{SASiformat<-.default} - -\alias{SAStype} -\alias{SAStype.default} -\alias{SAStype<-} -\alias{SAStype<-.default} - -\title{ -Set or Retreive the 'label', 'SASformat', 'SASiformat', or 'SAStype' -attribute of a vector or (components of) a data frame -} -\description{ - Sets or retrieves the \code{"label"}, \code{"SASformat"}, - \code{"SASiformat"}, or \code{SAStype} attribute of an object. - - More comprehensive support for object labels, and SASformat, are - available in Frank Harrell's \code{Hmisc} package. - - Note that \code{SAStype} enforces the SAS 8-character naming convention. -} -\usage{ -label(x, default) -label(x) <- value - -SASformat(x, default) -SASformat(x) <- value - -SASiformat(x, default) -SASiformat(x) <- value - -SAStype(x, default) -SAStype(x) <- value -} -\arguments{ -\item{x}{any object} -\item{value}{new value for the \code{"label"}, \code{"SASformat"}, - \code{"SASiformat"}, or \code{SAStype} attribute of an object.} -\item{default}{value to return when no appropriate attribute is - found. The usual return value is NULL.} -} -\value{ - the contents of the \code{"label"}, \code{"SASformat"}, - \code{"SASiformat"}, \code{"SAStype"} attribute of x, if any; - otherwise, the value provided by \code{default}. -} -\author{ - Gregory R. Warnes \email{gr...@wa...} based on code from the - \code{Hmisc} library by Frank E. Harrell, Jr. ] -} -%\seealso{ -%} -\examples{ - -## Examples for vectors - -fail.time <- c(10,20) - -# set attributes -label(fail.time) <- 'Failure Time' -SASformat(fail.time) <- 'Numeric2' -SASiformat(fail.time) <- 'Numeric2' - -# display individual attributes -label(fail.time) -SASformat(fail.time) -SASiformat(fail.time) - -# display all attributes -attributes(fail.time) - -## SAStype only applies to data frames -df <- data.frame( fail.time, day=c("Mon","Tue") ) -label(df) <- "Data frame object" -SAStype(df) <- "USER" - -label(df) -SAStype(df) - -## Example showing specification of default return value -a <- 70 -label(a, default="no label") - -\dontrun{ -# Hmisc packages functions label attributes for annotating tables and plots: -library(Hmisc) -label(fail.time) -describe(fail.time) -} -} -\keyword{utilities} -\keyword{interface} - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2014-04-09 23:52:19
|
Revision: 1802 http://sourceforge.net/p/r-gregmisc/code/1802 Author: warnes Date: 2014-04-09 23:52:17 +0000 (Wed, 09 Apr 2014) Log Message: ----------- Add padj=0.5 to better align margin labels. Modified Paths: -------------- trunk/gplots/R/heatmap.2.R Modified: trunk/gplots/R/heatmap.2.R =================================================================== --- trunk/gplots/R/heatmap.2.R 2014-04-05 21:08:41 UTC (rev 1801) +++ trunk/gplots/R/heatmap.2.R 2014-04-09 23:52:17 UTC (rev 1802) @@ -66,6 +66,12 @@ denscol=tracecol, symkey = min(x < 0, na.rm=TRUE) || symbreaks, densadj = 0.25, + key.title = NULL, + key.xlab = NULL, + key.ylab = NULL, + key.xtickfun = NULL, + key.ytickfun = NULL, + key.par=list(), ## plot labels main = NULL, @@ -562,7 +568,16 @@ ## Add the color-key if(key) { - par(mar = c(5, 4, 2, 1), cex=0.75) + mar <- c(5, 4, 2, 1) + if (!is.null(key.xlab) && is.na(key.xlab)) + mar[1] <- 2 + if (!is.null(key.ylab) && is.na(key.ylab)) + mar[2] <- 2 + if (!is.null(key.title) && is.na(key.title)) + mar[3] <- 1 + par(mar = mar, cex=0.75, mgp=c(2, 1, 0)) + if (length(key.par) > 0) + do.call(par, key.par) tmpbreaks <- breaks if(symkey) @@ -584,15 +599,26 @@ xaxt="n", yaxt="n") par(usr=c(0,1,0,1)) - lv <- pretty(breaks) - xv <- scale01(as.numeric(lv), min.raw, max.raw) - axis(1, at=xv, labels=lv) - if(scale=="row") - mtext(side=1,"Row Z-Score", line=2) - else if(scale=="column") - mtext(side=1,"Column Z-Score", line=2) - else - mtext(side=1,"Value", line=2) + if (is.null(key.xtickfun)) { + lv <- pretty(breaks) + xv <- scale01(as.numeric(lv), min.raw, max.raw) + xargs <- list(at=xv, labels=lv) + } else { + xargs <- key.xtickfun() + } + xargs$side <- 1 + do.call(axis, xargs) + if (is.null(key.xlab)) { + if(scale=="row") + key.xlab <- "Row Z-Score" + else if(scale=="column") + key.xlab <- "Column Z-Score" + else + key.xlab <- "Value" + } + if (!is.na(key.xlab)) { + mtext(side=1, key.xlab, line=par("mgp")[1], padj=0.5) + } if(density.info=="density") { @@ -602,10 +628,22 @@ dens$y <- dens$y[-omit] dens$x <- scale01(dens$x, min.raw, max.raw) lines(dens$x, dens$y / max(dens$y) * 0.95, col=denscol, lwd=1) - axis(2, at=pretty(dens$y)/max(dens$y) * 0.95, pretty(dens$y) ) - title("Color Key\nand Density Plot") + if (is.null(key.ytickfun)) { + yargs <- list(at=pretty(dens$y)/max(dens$y) * 0.95, labels=pretty(dens$y)) + } else { + yargs <- key.ytickfun() + } + yargs$side <- 2 + do.call(axis, yargs) + if (is.null(key.title)) + key.title <- "Color Key\nand Density Plot" + if (!is.na(key.title)) + title(key.title) par(cex=0.5) - mtext(side=2,"Density", line=2) + if (is.null(key.ylab)) + key.ylab <- "Density" + if (!is.na(key.ylab)) + mtext(side=2,key.ylab, line=par("mgp")[1], padj=0.5) } else if(density.info=="histogram") { @@ -613,10 +651,22 @@ hx <- scale01(breaks, min.raw, max.raw) hy <- c(h$counts, h$counts[length(h$counts)]) lines(hx, hy/max(hy)*0.95, lwd=1, type="s", col=denscol) - axis(2, at=pretty(hy)/max(hy) * 0.95, pretty(hy) ) - title("Color Key\nand Histogram") + if (is.null(key.ytickfun)) { + yargs <- list(at=pretty(hy)/max(hy) * 0.95, labels=pretty(hy)) + } else { + yargs <- key.ytickfun() + } + yargs$side <- 2 + do.call(axis, yargs) + if (is.null(key.title)) + key.title <- "Color Key\nand Histogram" + if (!is.na(key.title)) + title(key.title) par(cex=0.5) - mtext(side=2,"Count", line=2) + if (is.null(key.ylab)) + key.ylab <- "Count" + if (!is.na(key.ylab)) + mtext(side=2,key.ylab, line=par("mgp")[1], padj=0.5) } else title("Color Key") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |