r-gregmisc-users Mailing List for R gregmisc package (Page 39)
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: <gg...@us...> - 2006-11-30 21:36:44
|
Revision: 1034 http://svn.sourceforge.net/r-gregmisc/?rev=1034&view=rev Author: ggorjan Date: 2006-11-30 13:36:40 -0800 (Thu, 30 Nov 2006) Log Message: ----------- description of mapLevels methods Added Paths: ----------- trunk/gdata/inst/doc/mapLevels.pdf trunk/gdata/inst/doc/mapLevels.tex Added: trunk/gdata/inst/doc/mapLevels.pdf =================================================================== (Binary files differ) Property changes on: trunk/gdata/inst/doc/mapLevels.pdf ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/gdata/inst/doc/mapLevels.tex =================================================================== --- trunk/gdata/inst/doc/mapLevels.tex (rev 0) +++ trunk/gdata/inst/doc/mapLevels.tex 2006-11-30 21:36:40 UTC (rev 1034) @@ -0,0 +1,255 @@ +\documentclass[a4paper]{report} +\usepackage{Rnews} +\usepackage[round]{natbib} +\bibliographystyle{abbrvnat} + +\begin{document} + +\begin{article} + +\title{Mapping levels of a factor} +\subtitle{The gdata package} +\author{by Gregor Gorjanc} + +\maketitle + +\section{Introduction} + +Factors use levels attribute to store information on mapping between +internal integer codes and character values i.e. levels. First level is +mapped to internal integer code 1 and so on. Although some users do not +like factors, their use is more efficient in terms of storage than for +character vectors. Additionally, there are many functions in base \R{} that +provide additional value for factors. Sometimes users need to work with +internal integer codes and mapping them back to factor, especially when +interfacing external programs. Mapping information is also of interest if +there are many factors that should have the same set of levels. This note +describes \code{mapLevels} function, which is an utility function for +mapping the levels of a factor in \pkg{gdata} \footnote{from version 2.3.1} +package \citep{WarnesGdata}. + +\section{Description with examples} + +Function \code{mapLevels()} is an (S3) generic function and works on +\code{factor} and \code{character} atomic classes. It also works on +\code{list} and \code{data.frame} objects with previously mentioned atomic +classes. Function \code{mapLevels} produces a so called ``map'' with names +and values. Names are levels, while values can be internal integer codes or +(possibly other) levels. This will be clarified later on. Class of this +``map'' is \code{levelsMap}, if \code{x} in \code{mapLevels()} was atomic +or \code{listLevelsMap} otherwise - for \code{list} and \code{data.frame} +classes. The following example shows the creation and printout of such a +``map''. + +\begin{smallverbatim} +> library(gdata) +> (fac <- factor(c("B", "A", "Z", "D"))) +[1] B A Z D +Levels: A B D Z +> (map <- mapLevels(x=fac)) +A B D Z +1 2 3 4 +\end{smallverbatim} + +If we have to work with internal integer codes, we can transform factor to +integer and still get ``back the original factor'' with ``map'' used as +argument in \code{mapLevels<-} function as shown bellow. \code{mapLevels<-} +is also an (S3) generic function and works on same classes as +\code{mapLevels} plus \code{integer} atomic class. + +\begin{smallverbatim} +> (int <- as.integer(fac)) +[1] 2 1 4 3 +> mapLevels(x=int) <- map +> int +[1] B A Z D +Levels: A B D Z +> identical(fac, int) +[1] TRUE +\end{smallverbatim} + +Internally ``map'' (\code{levelsMap} class) is a \code{list} (see bellow), +but its print method unlists it for ease of inspection. ``Map'' from +example has all components of length 1. This is not mandatory as +\code{mapLevels<-} function is only a wrapper around workhorse function +\code{levels<-} and the later can accept \code{list} with components of +various lengths. + +\begin{smallverbatim} +> str(map) +List of 4 + $ A: int 1 + $ B: int 2 + $ D: int 3 + $ Z: int 4 + - attr(*, "class")= chr "levelsMap" +\end{smallverbatim} + +Although not of primary importance, this ``map'' can also be used to remap +factor levels as shown bellow. Components ``later'' in the map take over +the ``previous'' ones. Since this is not optimal I would rather recommend +other approaches for ``remapping'' the levels of a \code{factor}, say +\code{recode} in \pkg{car} package \citep{FoxCar}. + +\begin{smallverbatim} +> map[[2]] <- as.integer(c(1, 2)) +> map +A B B D Z +1 1 2 3 4 +> int <- as.integer(fac) +> mapLevels(x=int) <- map +> int +[1] B B Z D +Levels: A B D Z +\end{smallverbatim} + +Up to now examples showed ``map'' with internal integer codes for values +and levels for names. I call this integer ``map''. On the other hand +character ``map'' uses levels for values and (possibly other) levels for +names. This feature is a bit odd at first sight, but can be used to easily +unify levels and internal integer codes across several factors. Imagine +you have a factor that is for some reason split into two factors \code{f1} +and \code{f2} and that each factor does not have all levels. This is not +uncommon situation. + +\begin{smallverbatim} +> (f1 <- factor(c("A", "D", "C"))) +[1] A D C +Levels: A C D +> (f2 <- factor(c("B", "D", "C"))) +[1] B D C +Levels: B C D +\end{smallverbatim} + +If we work with this factors, we need to be careful as they do not have the +same set of levels. This can be solved with appropriately specifying +\code{levels} argument in creation of factors i.e. \code{levels=c("A", "B", + "C", "D")} or with proper use of \code{levels<-} function. I say proper +as it is very tempting to use: + +\begin{smallverbatim} +> fTest <- f1 +> levels(fTest) <- c("A", "B", "C", "D") +> fTest +[1] A C B +Levels: A B C D +\end{smallverbatim} + +Above example extends set of levels, but also changes level of 2nd and 3rd +element in \code{fTest}! Proper use of \code{levels<-} (as shown in +\code{levels} help page) would be: + +\begin{smallverbatim} +> fTest <- f1 +> levels(fTest) <- list(A="A", B="B", C="C", D="D") +> fTest +[1] A D C +Levels: A B C D +\end{smallverbatim} + +Function \code{mapLevels} with character ``map'' can help us in such +scenarios to unify levels and internal integer codes across several +factors. Again the workhorse under this process is \code{levels<-} function +from base \R{}! Function \code{mapLevels<-} just controls the assignment of +(integer or character) ``map'' to \code{x}. Levels in \code{x} that match +``map'' values (internal integer codes or levels) are changed to ``map'' +names (possibly other levels) as shown in \code{levels} help page. Levels +that do not match are converted to \code{NA}. Integer ``map'' can be +applied to \code{integer} or \code{factor}, while character ``map'' can be +applied to \code{character} or \code{factor}. Result of \code{mapLevels<-} +is always a \code{factor} with possibly ``remapped'' levels. + +To get one joint character ``map'' for several factors, we need to +put factors in a \code{list} or \code{data.frame} and use arguments +\code{codes=FALSE} and \code{combine=TRUE}. Such map can then be used to +unify levels and internal integer codes. + +\begin{smallverbatim} +> (bigMap <- mapLevels(x=list(f1, f2), codes=FALSE, ++ combine=TRUE)) + A B C D +"A" "B" "C" "D" +> mapLevels(f1) <- bigMap +> mapLevels(f2) <- bigMap +> f1 +[1] A D C +Levels: A B C D +> f2 +[1] B D C +Levels: A B C D +> cbind(as.character(f1), as.integer(f1), ++ as.character(f2), as.integer(f2)) + [,1] [,2] [,3] [,4] +[1,] "A" "1" "B" "2" +[2,] "D" "4" "D" "4" +[3,] "C" "3" "C" "3" +\end{smallverbatim} + +If we do not specify \code{combine=TRUE} (which is the default behaviour) +and \code{x} is a \code{list} or \code{data.frame}, \code{mapLevels} +returns ``map'' of class \code{listLevelsMap}. This is internally a +\code{list} of ``maps'' (\code{levelsMap} objects). Both +\code{listLevelsMap} and \code{levelsMap} objects can be passed to +\code{mapLevels<-} for \code{list}/\code{data.frame}. Recycling occurs when +length of \code{listLevelsMap} is not the same as number of +components/columns of a \code{list}/\code{data.frame}. + +Additional convenience methods are also implemented to ease the work with +``maps'': + +\begin{itemize} + +\item \code{is.levelsMap}, \code{is.listLevelsMap}, \code{as.levelsMap} and + \code{as.listLevelsMap} for testing and coercion of user defined + ``maps'', + +\item \code{"["} for subsetting, + +\item \code{c} for combining \code{levelsMap} or \code{listLevelsMap} + objects; argument \code{recursive=TRUE} can be used to coerce + \code{listLevelsMap} to \code{levelsMap}, for example \code{c(llm1, llm2, + recursive=TRUE)} and + +\item \code{unique} and \code{sort} for \code{levelsMap}. + +\end{itemize} + +\section{Summary} + +Functions \code{mapLevels} and \code{mapLevels<-} can help users to map +internal integer codes to factor levels and unify levels as well as +internal integer codes among several factors. I welcome any comments or +suggestions. + +% \bibliography{refs} +\begin{thebibliography}{1} +\providecommand{\natexlab}[1]{#1} +\providecommand{\url}[1]{\texttt{#1}} +\expandafter\ifx\csname urlstyle\endcsname\relax + \providecommand{\doi}[1]{doi: #1}\else + \providecommand{\doi}{doi: \begingroup \urlstyle{rm}\Url}\fi + +\bibitem[Fox(2006)]{FoxCar} +J.~Fox. +\newblock \emph{car: Companion to Applied Regression}, 2006. +\newblock URL \url{http://socserv.socsci.mcmaster.ca/jfox/}. +\newblock R package version 1.1-1. + +\bibitem[Warnes.(2006)]{WarnesGdata} +G.~R. Warnes. +\newblock \emph{gdata: Various R programming tools for data manipulation}, + 2006. +\newblock URL + \url{http://cran.r-project.org/src/contrib/Descriptions/gdata.html}. +\newblock R package version 2.3.1. Includes R source code and/or documentation + contributed by Ben Bolker, Gregor Gorjanc and Thomas Lumley. + +\end{thebibliography} + +\address{Gregor Gorjanc\\ + University of Ljubljana, Slovenia\\ +\email{gre...@bf...}} + +\end{article} + +\end{document} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gg...@us...> - 2006-11-30 21:32:18
|
Revision: 1033 http://svn.sourceforge.net/r-gregmisc/?rev=1033&view=rev Author: ggorjan Date: 2006-11-30 13:32:08 -0800 (Thu, 30 Nov 2006) Log Message: ----------- description of unknown methods Added Paths: ----------- trunk/gdata/inst/doc/unknown.pdf trunk/gdata/inst/doc/unknown.tex Added: trunk/gdata/inst/doc/unknown.pdf =================================================================== (Binary files differ) Property changes on: trunk/gdata/inst/doc/unknown.pdf ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/gdata/inst/doc/unknown.tex =================================================================== --- trunk/gdata/inst/doc/unknown.tex (rev 0) +++ trunk/gdata/inst/doc/unknown.tex 2006-11-30 21:32:08 UTC (rev 1033) @@ -0,0 +1,301 @@ +\documentclass[a4paper]{report} +\usepackage{Rnews} +\usepackage[round]{natbib} +\bibliographystyle{abbrvnat} + +\begin{document} + +\begin{article} + +\title{Working with unknown values} +\subtitle{The gdata package} +\author{by Gregor Gorjanc} + +\maketitle + +Published as \cite{Gorjanc}. + +\section{Introduction} + +Unknown or missing values can be represented in various ways. For example +SAS uses \code{.} (dot), while \R{} uses \code{NA}, which we can read as +Not Available. When we import data into \R{}, say via \code{read.table} or +its derivatives, conversion of blank fields to \code{NA} (according to +\code{read.table} help) is done for \code{logical}, \code{integer}, +\code{numeric} and \code{complex} classes. Additionally, \code{na.strings} +argument can be used to specify values that should also be converted to +\code{NA}. Inversely there is an argument \code{na} in \code{write.table} +and its derivatives to define value that will replace \code{NA} in exported +data. There are also other ways to import/export data into \R{} as +described in ``R Data Import/Export'' Manual \citep{RImportExportManual}, +however all approaches lack the possibility to define unknown value(s) for +particular column. It is possible that unknown value in one column is a +valid value in another column. For example I have seen many datasets where +values as 0, -9, 999 and specific dates are used as column specific unknown +values in one dataset. + +This note represents set of functions in \pkg{gdata}\footnote{from version + 2.3.1} package \citep{WarnesGdata}: \code{isUnknown}, \code{unknownToNA} +and \code{NAToUnknown}, which can help with testing for unknown values and +conversions between unknown values and \code{NA}. All three functions are +generic (S3) and were tested (at the time of writing) to work with: +\code{integer}, \code{numeric}, \code{character}, \code{factor}, +\code{Date}, \code{POSIXct}, \code{POSIXlt}, \code{list}, \code{data.frame} +and \code{matrix} classes. + +\section{Description with examples} + +The following examples show simple usage of this functions on +\code{numeric} and \code{factor} classes, where value \code{0} (beside +\code{NA}) should be treated as unknown value: + +\begin{smallverbatim} +> library(gdata) +> xNum <- c(0, 6, 0, 7, 8, 9, NA) +> isUnknown(x=xNum) +[1] FALSE FALSE FALSE FALSE FALSE FALSE TRUE +\end{smallverbatim} + +The default unknown value in \code{isUnknown} is \code{NA}, which means +that output is the same to \code{is.na} - at least for atomic +classes. However, we can pass argument \code{unknown} to define which +values should be treated as unknown. + +\begin{smallverbatim} +> isUnknown(x=xNum, unknown=0) +[1] TRUE FALSE TRUE FALSE FALSE FALSE FALSE +\end{smallverbatim} + +This skipped \code{NA}, but we can get expected answer after appropriately +adding \code{NA} into argument \code{unknown}. + +\begin{smallverbatim} +> isUnknown(x=xNum, unknown=c(0, NA)) +[1] TRUE FALSE TRUE FALSE FALSE FALSE TRUE +\end{smallverbatim} + +Now, we can change all unknown values to \code{NA} with \code{unknownToNA}. +There is clearly no need to add \code{NA} here. This step is very handy +after importing data from external source, where many different unknown +values might be used. Argument \code{warning=TRUE} can be used, if there is +a need to be warned about ``original'' \code{NA}s. + +\begin{smallverbatim} +> xNum2 <- unknownToNA(x=xNum, unknown=0) +[1] NA 6 NA 7 8 9 NA +\end{smallverbatim} + +Prior to export from \R{}, we might want to change unknown value (\code{NA} +in \R{}) to some other value. Function \code{NAToUnknown} can be used for +this. + +\begin{smallverbatim} +> NAToUnknown(x=xNum2, unknown=999) +[1] 999 6 999 7 8 9 999 +\end{smallverbatim} + +Converting \code{NA} to value that already exists in \code{x} issues an +error, however \code{force=TRUE} can be used to overcome this if +needed. But be warned that there is no way back from this step. + +\begin{smallverbatim} +> NAToUnknown(x=xNum2, unknown=7, force=TRUE) +[1] 7 6 7 7 8 9 7 +\end{smallverbatim} + +Examples bellow show all peculiarities with \code{factor} class. +\code{unknownToNA} removes \code{unknown} value from levels and inversely +\code{NAToUnknown} adds it with a warning. Additionally, \code{"NA"} is +properly distinguished from \code{NA}. It can also be seen that argument +\code{unknown} in functions \code{isUnknown} and \code{unknownToNA} need +not match class of \code{x} (otherwise factor should be used) as the test +is internally done with \code{\%in\%}, which nicely resolves coercing +issues. + +\begin{smallverbatim} +> xFac <- factor(c(0, "BA", "RA", "BA", NA, "NA")) +[1] 0 BA RA BA <NA> NA +Levels: 0 BA NA RA +> isUnknown(x=xFac) +[1] FALSE FALSE FALSE FALSE TRUE FALSE +> isUnknown(x=xFac, unknown=0) +[1] TRUE FALSE FALSE FALSE FALSE FALSE +> isUnknown(x=xFac, unknown=c(0, NA)) +[1] TRUE FALSE FALSE FALSE TRUE FALSE +> isUnknown(x=xFac, unknown=c(0, "NA")) +[1] TRUE FALSE FALSE FALSE FALSE TRUE +> isUnknown(x=xFac, unknown=c(0, "NA", NA)) +[1] TRUE FALSE FALSE FALSE TRUE TRUE + +> xFac <- unknownToNA(x=xFac, unknown=0) +[1] <NA> BA RA BA <NA> NA +Levels: BA NA RA +> xFac <- NAToUnknown(x=xFac, unknown=0) +[1] 0 BA RA BA 0 NA +Levels: 0 BA NA RA +Warning message: +new level is introduced: 0 +\end{smallverbatim} + +These two examples with numeric an factor classes are fairly simple and we +could get the same results with one or two lines of \R{} code. The real +benefit of presented set of functions is in \code{list} and +\code{data.frame} methods, where \code{data.frame} methods are merely +wrappers for \code{list} methods. + +We need additional flexibility for \code{list}/\code{data.frame} methods, +due to possibility of having multiple unknown values that can be different +among \code{list} components or \code{data.frame} columns. For these two +methods, argument \code{unknown} can be either a \code{vector} or +\code{list}, both possibly named. Of course, greater flexibility (defining +multiple unknown values per component/column) can be achieved with +a \code{list}. + +When \code{vector}/\code{list} passed to argument \code{unknown} is not +named, first value/component of a \code{vector}/\code{list} matches first +component/column of a \code{list}/\code{data.frame}. This can be quite +error prone, especially with \code{vectors}. Therefore, I encourage use of +a \code{list}. In case \code{vector}/\code{list} passed to argument +\code{unknown} is named, names are matched to names of \code{list} or +\code{data.frame}. If lengths of \code{unknown} and \code{list} or +\code{data.frame} do not match, recycling occurs. + +Example bellow shows usage of described functions on a list, that is +composed of previously defined and modified numeric (\code{xNum}) and +factor (\code{xFac}) classes. First function \code{isUnknown} is used with +\code{0} as unknown value. Note that we get \code{FALSE} for \code{NA}s as +has been the case in the first example. + +\begin{smallverbatim} +> xList <- list(a=xNum, b=xFac) +$a +[1] 0 6 0 7 8 9 NA + +$b +[1] 0 BA RA BA 0 NA +Levels: 0 BA NA RA +> isUnknown(x=xList, unknown=0) +$a +[1] TRUE FALSE TRUE FALSE FALSE FALSE FALSE + +$b +[1] TRUE FALSE FALSE FALSE TRUE FALSE +\end{smallverbatim} + +We need to add \code{NA} as unknown value. However, we do not get the +expected result this way! + +\begin{smallverbatim} +> isUnknown(x=xList, unknown=c(0, NA)) +$a +[1] TRUE FALSE TRUE FALSE FALSE FALSE FALSE + +$b +[1] FALSE FALSE FALSE FALSE FALSE FALSE +\end{smallverbatim} + +This is due to matching of values in argument \code{unknown} and components +in a \code{list} i.e. \code{0} is used for component \code{a} and \code{NA} +for component \code{b}. Therefore, it is less error prone and more +flexible to pass \code{list} (preferably named one) to argument +\code{unknown} as shown bellow. + +\begin{smallverbatim} +> xList1 <- unknownToNA(x=xList, ++ unknown=list(b=c(0, "NA"), a=0)) +$a +[1] NA 6 NA 7 8 9 NA + +$b +[1] <NA> BA RA BA <NA> <NA> +Levels: BA RA +\end{smallverbatim} + +Changing \code{NA}s to some other value (only one per component/column) can +be now something like this: + +\begin{smallverbatim} +> NAToUnknown(x=xList1, unknown=list(b="no", a=0)) +$a +[1] 0 6 0 7 8 9 0 + +$b +[1] no BA RA BA no no +Levels: BA no RA + +Warning message: +new level is introduced: no +\end{smallverbatim} + +Named component \code{.default} of a \code{list} passed to argument +\code{unknown} has a special meaning as it will match component/column with +that name and any other not defined in \code{unknown}. As such it is very +useful if the number of components/columns with the same unknown value(s) +is large. Imagine a wide \code{data.frame} named \code{df}. Now +\code{.default} can be used to define unknown value for several columns: + +\begin{smallverbatim} +> df <- unknownToNA(x=df, ++ unknown=(.default=0, ++ col1=999, ++ col2="unknown")) +\end{smallverbatim} + +If there is a need to work only on some components/columns you can of +course ``skip'' columns with standard \R{} mechanisms i.e. +with subsetting \code{list} or \code{data.frame} objects. + +\begin{smallverbatim} +> cols <- c("col1", "col2") +> df[, cols] <- unknownToNA(x=df[, cols], ++ unknown=(col1=999, ++ col2="unknown")) +\end{smallverbatim} + +\section{Summary} + +Functions \code{isUnknown}, \code{unknownToNA} and \code{NAToUnknown} +provide a nice interface to work with various representations of +unknown/missing values. Their use is meant primarily for shaping the data +after importing to or before exporting from \R{}. I welcome any comments or +suggestions. + +% \bibliography{refs} + +\begin{thebibliography}{1} +\providecommand{\natexlab}[1]{#1} +\providecommand{\url}[1]{\texttt{#1}} +\expandafter\ifx\csname urlstyle\endcsname\relax + \providecommand{\doi}[1]{doi: #1}\else + \providecommand{\doi}{doi: \begingroup \urlstyle{rm}\Url}\fi + +\bibitem[Gorjanc(2007)]{Gorjanc} +G.~Gorjanc. +\newblock Working with unknown values: the gdata package. +\newblock \emph{R News}, 1\penalty0 (1):\penalty0 ?--?, ? 2007. +\newblock URL \url{http://CRAN.R-project.org/doc/Rnews/Rnews_2007-?.pdf}. + +\bibitem[{R Development Core Team}(2006)]{RImportExportManual} +{R Development Core Team}. +\newblock \emph{R Data Import/Export}, 2006. +\newblock URL \url{http://cran.r-project.org/manuals.html}. +\newblock ISBN 3-900051-10-0. + +\bibitem[Warnes.(2006)]{WarnesGdata} +G.~R. Warnes. +\newblock \emph{gdata: Various R programming tools for data manipulation}, + 2006. +\newblock URL + \url{http://cran.r-project.org/src/contrib/Descriptions/gdata.html}. +\newblock R package version 2.3.1. Includes R source code and/or documentation + contributed by Ben Bolker, Gregor Gorjanc and Thomas Lumley. + +\end{thebibliography} + +\address{Gregor Gorjanc\\ + University of Ljubljana, Slovenia\\ +\email{gre...@bf...}} + +\end{article} + +\end{document} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2006-11-29 00:26:59
|
Revision: 1032 http://svn.sourceforge.net/r-gregmisc/?rev=1032&view=rev Author: warnes Date: 2006-11-28 16:26:56 -0800 (Tue, 28 Nov 2006) Log Message: ----------- Add dummy manual page to make 'R CMD check' happy Added Paths: ----------- trunk/gregmisc/man/ trunk/gregmisc/man/First.lib.Rd Added: trunk/gregmisc/man/First.lib.Rd =================================================================== --- trunk/gregmisc/man/First.lib.Rd (rev 0) +++ trunk/gregmisc/man/First.lib.Rd 2006-11-29 00:26:56 UTC (rev 1032) @@ -0,0 +1,22 @@ +\name{.First.lib} +\alias{.First.lib} +\title{Load all packages formerly part of the 'gregmisc' bundle} +\description{ + Load all packages formerly part of the 'gregmisc' bundle +} +\usage{ +.First.lib(libname, pkgname) +} +\arguments{ + \item{libname}{ignored} + \item{pkgname}{ignored} +} +\value{ + Nothing of interest +} +\author{ Gregory R. Warnes \email{wa...@bs...}} +\seealso{ \code{\link[base]{.First.lib}}} +\examples{ +## Should never be directly executed ## +} +\keyword{ misc } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2006-11-29 00:21:15
|
Revision: 1031 http://svn.sourceforge.net/r-gregmisc/?rev=1031&view=rev Author: warnes Date: 2006-11-28 16:21:14 -0800 (Tue, 28 Nov 2006) Log Message: ----------- Update for new release Modified Paths: -------------- trunk/gregmisc/DESCRIPTION Modified: trunk/gregmisc/DESCRIPTION =================================================================== --- trunk/gregmisc/DESCRIPTION 2006-11-29 00:20:20 UTC (rev 1030) +++ trunk/gregmisc/DESCRIPTION 2006-11-29 00:21:14 UTC (rev 1031) @@ -1,7 +1,7 @@ Package: gregmisc Title: Greg's Miscellaneous Functions Description: Various functions to manipulate data. -Depends: R (>= 1.9.0), gdata, gmodels, gplots, gtools +Depends: gdata, gmodels, gplots, gtools Description: The former gregmisc bundle is a repository for a variety of useful functions. The gregmisc package was recently split into a set of more focused packages: gdata, gmodels, gplots, gtools. @@ -9,8 +9,7 @@ way to access the original combined functionality. To this end, it simply depends on all of the new packages so that these will installed/loaded when this package is installed/loaded. -Version: 2.1.0 -Date: 2005-03-09 +Version: 2.1.1 Author: Gregory R. Warnes. -Maintainer: wa...@bs...> +Maintainer: Gregory R. Warnes <wa...@bs...> License: GPL (version 2 or later) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2006-11-29 00:20:23
|
Revision: 1030 http://svn.sourceforge.net/r-gregmisc/?rev=1030&view=rev Author: warnes Date: 2006-11-28 16:20:20 -0800 (Tue, 28 Nov 2006) Log Message: ----------- Remove extraneous subdirectory Modified Paths: -------------- trunk/gregmisc/DESCRIPTION Added Paths: ----------- trunk/gregmisc/R/ Removed Paths: ------------- trunk/gregmisc/TODO trunk/gregmisc/gregmisc/ Modified: trunk/gregmisc/DESCRIPTION =================================================================== --- trunk/gregmisc/DESCRIPTION 2006-11-29 00:11:16 UTC (rev 1029) +++ trunk/gregmisc/DESCRIPTION 2006-11-29 00:20:20 UTC (rev 1030) @@ -1,35 +1,16 @@ -Bundle: gregmisc -Contains: gtools gdata gmodels gplots gregmisc +Package: gregmisc Title: Greg's Miscellaneous Functions -BundleDescription: The gregmisc bundle is a repository for a variety of - useful functions. See the individual packages for more - details. -Version: 2.0.6 -Date: 2005-04-04 -Author: Gregory R. Warnes. Includes R source code and documentation - contributed by - - Ben Bolker, - - Lodewijk Bonebakker, - - Bendix Carstensen, - - R. Gentleman, - - Kjetil Halvorsen, - - W. Huber - - Nitin Jain, - - Andy Liaw, - - Don MacQueen, - - M. Maechler, - - Arni Magnusson, - - Jim Rogers, - - Marc Schwartz, - - William Venables, - - Ian Wilson, - and others (let me know if I missed you!), as well as the Perl - modules - - "IO-stringy" (copyright 1996 by Eryq, and 1999,2001 by - ZeeGee Software Inc), - - OLE::Storage_Lite (copyright 2000,2001 by Kawai Takanori), - - Spreadsheet::ParseExcel (copyright 2000-2002 by Kawai - Takanori ) - under the terms of the GNU General Public Licence (GPL). -Maintainer: Gregory R. Warnes <wa...@bs...> +Description: Various functions to manipulate data. +Depends: R (>= 1.9.0), gdata, gmodels, gplots, gtools +Description: The former gregmisc bundle is a repository for a variety of + useful functions. The gregmisc package was recently split into + a set of more focused packages: gdata, gmodels, gplots, gtools. + The purpose of this 'new' gregmisc is to provide an easy + way to access the original combined functionality. To this + end, it simply depends on all of the new packages so that + these will installed/loaded when this package is installed/loaded. +Version: 2.1.0 +Date: 2005-03-09 +Author: Gregory R. Warnes. +Maintainer: wa...@bs...> License: GPL (version 2 or later) Copied: trunk/gregmisc/R (from rev 1017, trunk/gregmisc/gregmisc/R) Deleted: trunk/gregmisc/TODO =================================================================== --- trunk/gregmisc/TODO 2006-11-29 00:11:16 UTC (rev 1029) +++ trunk/gregmisc/TODO 2006-11-29 00:20:20 UTC (rev 1030) @@ -1,7 +0,0 @@ - -- Modify csv2xls.pl to accept a sheet name in place of a sheet number - (worksheets may not occupy sequential sheet numbers in the file, making - it hard to pull the right one out by number.) - -- Recode gtools::running() to improve performance. See - http://tolstoy.newcastle.edu.au/R/help/04/10/5161.html. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2006-11-29 00:11:20
|
Revision: 1029 http://svn.sourceforge.net/r-gregmisc/?rev=1029&view=rev Author: warnes Date: 2006-11-28 16:11:16 -0800 (Tue, 28 Nov 2006) Log Message: ----------- Update for 2.13.1 Modified Paths: -------------- trunk/gmodels/NEWS Modified: trunk/gmodels/NEWS =================================================================== --- trunk/gmodels/NEWS 2006-11-29 00:05:57 UTC (rev 1028) +++ trunk/gmodels/NEWS 2006-11-29 00:11:16 UTC (rev 1029) @@ -3,8 +3,17 @@ Bug Fixes: +- Problem: R CMD check errors under development version of R 2.5.0 + Solution: + - Add additional packages to 'Suggests' list in DESCRIPTION + - Remove extra trailing comma in function calls + - fix various code/doc inconsistencies + - Problem: estimable() was failing for lmer objects. - Solution: Add estimable.lmer() to the exported methods list in NAMESPACE + Solution: + - Create a generic estimable() + - Move old function to estimable.default() + - Add estimable.lmer() to the exported methods list in NAMESPACE Version 2.13.0 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2006-11-29 00:05:59
|
Revision: 1028 http://svn.sourceforge.net/r-gregmisc/?rev=1028&view=rev Author: warnes Date: 2006-11-28 16:05:57 -0800 (Tue, 28 Nov 2006) Log Message: ----------- Correct declartion of S3 methods for estimable() Modified Paths: -------------- trunk/gmodels/NAMESPACE Modified: trunk/gmodels/NAMESPACE =================================================================== --- trunk/gmodels/NAMESPACE 2006-11-29 00:05:31 UTC (rev 1027) +++ trunk/gmodels/NAMESPACE 2006-11-29 00:05:57 UTC (rev 1028) @@ -24,7 +24,7 @@ S3method(fit.contrast, lme) S3method(fit.contrast, lmer) -S3method(estimable, lm) +S3method(estimable, default) S3method(estimable, lmer) S3method(print, glh.test) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2006-11-29 00:05:32
|
Revision: 1027 http://svn.sourceforge.net/r-gregmisc/?rev=1027&view=rev Author: warnes Date: 2006-11-28 16:05:31 -0800 (Tue, 28 Nov 2006) Log Message: ----------- Add additional suggested packages Modified Paths: -------------- trunk/gmodels/DESCRIPTION Modified: trunk/gmodels/DESCRIPTION =================================================================== --- trunk/gmodels/DESCRIPTION 2006-11-29 00:04:54 UTC (rev 1026) +++ trunk/gmodels/DESCRIPTION 2006-11-29 00:05:31 UTC (rev 1027) @@ -6,7 +6,7 @@ Maintainer: Gregory R. Warnes <wa...@bs...> Description: Various R programming tools for model fitting Depends: R (>= 1.9.0) -Suggests: gplots +Suggests: gplots, Matrix, nlme, lme4, coda Imports: MASS, gdata License: GPL (version 2 or later). Contributions from Randall C Johnson are Copyright (2005) SAIC-Frederick, Inc. Funded by This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2006-11-29 00:04:56
|
Revision: 1026 http://svn.sourceforge.net/r-gregmisc/?rev=1026&view=rev Author: warnes Date: 2006-11-28 16:04:54 -0800 (Tue, 28 Nov 2006) Log Message: ----------- - Add generic - Fix code vs. doc inconsistiencies Modified Paths: -------------- trunk/gmodels/R/estimable.R trunk/gmodels/man/estimable.Rd Modified: trunk/gmodels/R/estimable.R =================================================================== --- trunk/gmodels/R/estimable.R 2006-11-28 22:38:11 UTC (rev 1025) +++ trunk/gmodels/R/estimable.R 2006-11-29 00:04:54 UTC (rev 1026) @@ -1,12 +1,10 @@ # $Id$ -estimable <- function (obj, cm, beta0, conf.int=NULL, joint.test=FALSE, - show.beta0, ...) +estimable <- function (obj, cm, beta0, conf.int=NULL, show.beta0, ...) { UseMethod("estimable") } -estimable.default <- function (obj, cm, beta0, conf.int=NULL, joint.test=FALSE, - show.beta0, ...) +estimable.default <- function (obj, cm, beta0, conf.int=NULL, show.beta0, joint.test=FALSE, ...) { if (is.matrix(cm) || is.data.frame(cm)) { @@ -202,8 +200,8 @@ print(as.data.frame(retval)) } -estimable.lmer <- function (obj, cm, beta0, conf.int=NULL, - show.beta0, sim.lmer=TRUE, n.sim=1000, ...) +estimable.lmer <- function (obj, cm, beta0, conf.int=NULL, show.beta0, + sim.lmer=TRUE, n.sim=1000, ...) { if (is.matrix(cm) || is.data.frame(cm)) { Modified: trunk/gmodels/man/estimable.Rd =================================================================== --- trunk/gmodels/man/estimable.Rd 2006-11-28 22:38:11 UTC (rev 1025) +++ trunk/gmodels/man/estimable.Rd 2006-11-29 00:04:54 UTC (rev 1026) @@ -2,16 +2,21 @@ % \name{estimable} \alias{estimable} +\alias{estimable.default} \alias{estimable.lmer} %\alias{.wald} %\alias{.to.est} \title{Contrasts and estimable linear functions of model coefficients} -\description{Compute and test contrasts and other estimable linear +\description{ + Compute and test contrasts and other estimable linear functions of model coefficients for for lm, glm, lme, lmer, and geese - objects} + objects +} \usage{ -estimable(obj, cm, beta0, conf.int=NULL, joint.test=FALSE, show.beta0) -\method{estimable}{lmer}(obj, cm, beta0, conf.int = NULL, show.beta0, sim.lmer = TRUE, n.sim = 1000) %%%%%%%%%%% added this line +estimable(obj, cm, beta0, conf.int=NULL, show.beta0, ...) +\method{estimable}{default} (obj, cm, beta0, conf.int=NULL, show.beta0, joint.test=FALSE, ...) +\method{estimable}{lmer}(obj, cm, beta0, conf.int=NULL, + show.beta0, sim.lmer=TRUE, n.sim=1000, ...) %.wald(obj, cm,beta0=rep(0, ifelse(is.null(nrow(cm)), 1, nrow(cm)))) %.to.est(obj, params) } @@ -30,9 +35,13 @@ \item{show.beta0}{Logical value. If TRUE a column for beta0 will be included in the output table. Defaults to TRUE when beta0 is specified, FALSE otherwise.} - \item{sim.lmer}{Logical value. If TRUE p-values and confidence %%% - intervals will be estimated using \code{\Link[Matrix]{mcmcsamp}}.} %%% Added these sections - \item{n.sim}{Number of MCMC samples to take in \code{\Link[Matrix]{mcmcsamp}}.}%%% + \item{sim.lmer}{Logical value. If TRUE p-values and confidence + intervals will be estimated using \code{\Link[Matrix]{mcmcsamp}}. + } + \item{n.sim}{Number of MCMC samples to take in + \code{\Link[Matrix]{mcmcsamp}}. + } + \item{...}{ignored} } \details{ \code{estimable} computes an estimate, test statitic, significance This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2006-11-28 22:38:12
|
Revision: 1025 http://svn.sourceforge.net/r-gregmisc/?rev=1025&view=rev Author: warnes Date: 2006-11-28 14:38:11 -0800 (Tue, 28 Nov 2006) Log Message: ----------- Remove extraneous comma that causes errors in R 2.5.0 Modified Paths: -------------- trunk/gmodels/R/ci.R trunk/gmodels/R/estimable.R trunk/gmodels/R/fast.prcomp.R Modified: trunk/gmodels/R/ci.R =================================================================== --- trunk/gmodels/R/ci.R 2006-11-28 00:59:53 UTC (rev 1024) +++ trunk/gmodels/R/ci.R 2006-11-28 22:38:11 UTC (rev 1025) @@ -12,7 +12,7 @@ Estimate=est, "CI lower"=ci.low, "CI upper"=ci.high, - "Std. Error"=stderr, + "Std. Error"=stderr ) retval Modified: trunk/gmodels/R/estimable.R =================================================================== --- trunk/gmodels/R/estimable.R 2006-11-28 00:59:53 UTC (rev 1024) +++ trunk/gmodels/R/estimable.R 2006-11-28 22:38:11 UTC (rev 1025) @@ -1,7 +1,12 @@ # $Id$ +estimable <- function (obj, cm, beta0, conf.int=NULL, joint.test=FALSE, + show.beta0, ...) + { + UseMethod("estimable") + } -estimable <- function (obj, cm, beta0, conf.int=NULL, joint.test=FALSE, - show.beta0) +estimable.default <- function (obj, cm, beta0, conf.int=NULL, joint.test=FALSE, + show.beta0, ...) { if (is.matrix(cm) || is.data.frame(cm)) { @@ -198,7 +203,7 @@ } estimable.lmer <- function (obj, cm, beta0, conf.int=NULL, - show.beta0, sim.lmer=TRUE, n.sim=1000) + show.beta0, sim.lmer=TRUE, n.sim=1000, ...) { if (is.matrix(cm) || is.data.frame(cm)) { Modified: trunk/gmodels/R/fast.prcomp.R =================================================================== --- trunk/gmodels/R/fast.prcomp.R 2006-11-28 00:59:53 UTC (rev 1024) +++ trunk/gmodels/R/fast.prcomp.R 2006-11-28 22:38:11 UTC (rev 1025) @@ -30,7 +30,7 @@ s$d <- s$d/sqrt(max(1, nrow(x) - 1)) dimnames(s$vt) <- list(paste("PC", seq(len = nrow(s$vt)), sep = ""), - colnames(x), ) + colnames(x) ) r <- list(sdev = s$d, rotation = t(s$vt) ) if (retx) r$x <- x %*% t(s$vt) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2006-11-28 00:59:58
|
Revision: 1024 http://svn.sourceforge.net/r-gregmisc/?rev=1024&view=rev Author: warnes Date: 2006-11-27 16:59:53 -0800 (Mon, 27 Nov 2006) Log Message: ----------- Crate tag Added Paths: ----------- tags/gtools_2.3.0/ Copied: tags/gtools_2.3.0 (from rev 1023, trunk/gtools) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2006-11-28 00:53:58
|
Revision: 1023 http://svn.sourceforge.net/r-gregmisc/?rev=1023&view=rev Author: warnes Date: 2006-11-27 16:53:57 -0800 (Mon, 27 Nov 2006) Log Message: ----------- Replace F with FALSE in smartbind example. Modified Paths: -------------- trunk/gtools/man/smartbind.Rd Modified: trunk/gtools/man/smartbind.Rd =================================================================== --- trunk/gtools/man/smartbind.Rd 2006-11-27 22:42:21 UTC (rev 1022) +++ trunk/gtools/man/smartbind.Rd 2006-11-28 00:53:57 UTC (rev 1023) @@ -56,7 +56,7 @@ X <- data.frame(A=sample(letters,s,replace=TRUE), B=letters[1:s], C=rnorm(s) ) - colnames(X) <- c("A",sample(names,2,replace=F)) + colnames(X) <- c("A",sample(names,2,replace=FALSE)) Z[[i]] <- X } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2006-11-27 22:43:54
|
Revision: 1022 http://svn.sourceforge.net/r-gregmisc/?rev=1022&view=rev Author: warnes Date: 2006-11-27 14:42:21 -0800 (Mon, 27 Nov 2006) Log Message: ----------- Replace T with TRUE in smartbind example Modified Paths: -------------- trunk/gtools/man/smartbind.Rd Modified: trunk/gtools/man/smartbind.Rd =================================================================== --- trunk/gtools/man/smartbind.Rd 2006-11-27 21:40:56 UTC (rev 1021) +++ trunk/gtools/man/smartbind.Rd 2006-11-27 22:42:21 UTC (rev 1022) @@ -53,7 +53,7 @@ Z <- list() for(i in 1:n) { - X <- data.frame(A=sample(letters,s,replace=T), + X <- data.frame(A=sample(letters,s,replace=TRUE), B=letters[1:s], C=rnorm(s) ) colnames(X) <- c("A",sample(names,2,replace=F)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2006-11-27 21:41:00
|
Revision: 1021 http://svn.sourceforge.net/r-gregmisc/?rev=1021&view=rev Author: warnes Date: 2006-11-27 13:40:56 -0800 (Mon, 27 Nov 2006) Log Message: ----------- Temprary remove to reset binary flag Added Paths: ----------- trunk/gtools/data/ELISA.rda Added: trunk/gtools/data/ELISA.rda =================================================================== (Binary files differ) Property changes on: trunk/gtools/data/ELISA.rda ___________________________________________________________________ Name: svn:executable + * Name: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2006-11-27 21:40:35
|
Revision: 1020 http://svn.sourceforge.net/r-gregmisc/?rev=1020&view=rev Author: warnes Date: 2006-11-27 13:40:30 -0800 (Mon, 27 Nov 2006) Log Message: ----------- Temprary remove to reset binary flag Removed Paths: ------------- trunk/gtools/data/ELISA.rda Deleted: trunk/gtools/data/ELISA.rda =================================================================== --- trunk/gtools/data/ELISA.rda 2006-11-27 21:34:07 UTC (rev 1019) +++ trunk/gtools/data/ELISA.rda 2006-11-27 21:40:30 UTC (rev 1020) @@ -1,30 +0,0 @@ -RDX2 -X - |
From: <wa...@us...> - 2006-11-27 21:34:11
|
Revision: 1019 http://svn.sourceforge.net/r-gregmisc/?rev=1019&view=rev Author: warnes Date: 2006-11-27 13:34:07 -0800 (Mon, 27 Nov 2006) Log Message: ----------- Add smartbind() to list of exported functions, and add corresponding documentation file. Modified Paths: -------------- trunk/gtools/DESCRIPTION trunk/gtools/NAMESPACE trunk/gtools/NEWS trunk/gtools/R/smartbind.R Added Paths: ----------- trunk/gtools/man/smartbind.Rd Modified: trunk/gtools/DESCRIPTION =================================================================== --- trunk/gtools/DESCRIPTION 2006-11-27 20:52:33 UTC (rev 1018) +++ trunk/gtools/DESCRIPTION 2006-11-27 21:34:07 UTC (rev 1019) @@ -1,8 +1,8 @@ Package: gtools Title: Various R programming tools Description: Various R programming tools -Depends: R (>= 1.9.0) -Version: 2.2.4 +Depends: R +Version: 2.3.0 Author: Gregory R. Warnes. Includes R source code and/or documentation contributed by Ben Bolker and Thomas Lumley Maintainer: Gregory R. Warnes <wa...@bs...> Modified: trunk/gtools/NAMESPACE =================================================================== --- trunk/gtools/NAMESPACE 2006-11-27 20:52:33 UTC (rev 1018) +++ trunk/gtools/NAMESPACE 2006-11-27 21:34:07 UTC (rev 1019) @@ -24,6 +24,7 @@ running, scat, setTCPNoDelay, + smartbind, sprint, strmacro ) Modified: trunk/gtools/NEWS =================================================================== --- trunk/gtools/NEWS 2006-11-27 20:52:33 UTC (rev 1018) +++ trunk/gtools/NEWS 2006-11-27 21:34:07 UTC (rev 1019) @@ -1,11 +1,19 @@ -CHANGES IN gtools 2.2.3 ------------------------ +gtools 2.3.0 +------------ +- Update email address for Greg + +- Add new 'smartbind' function, which combines data frames + efficiently, even if they have different column names. + +gtools 2.2.3 +------------ + - setTCPNoDelay now compiles & works properly on Windows -CHANGES IN gtools 2.2.2 ------------------------ +gtools 2.2.2 +------------ - src/setTCPNoDelay.c: Add C source code for setTCPNoDelay. @@ -14,8 +22,8 @@ - Updated Greg's email address. -CHANGES IN gtools 2.2.1 ------------------------ +gtools 2.2.1 +------------ - New function 'addLast' that adds functions to R's .Last() so that they will be executed when R is terminating. @@ -23,8 +31,8 @@ - New function setTCPNoDelay() that allows the TCP_NODELAY flag to be changed on socket objects. -CHANGES IN gtools 2.1.0 ------------------------ +gtools 2.1.0 +------------ - Added assert.R (and documentation) Modified: trunk/gtools/R/smartbind.R =================================================================== --- trunk/gtools/R/smartbind.R 2006-11-27 20:52:33 UTC (rev 1018) +++ trunk/gtools/R/smartbind.R 2006-11-27 21:34:07 UTC (rev 1019) @@ -10,7 +10,13 @@ data <- list(...) if(is.null(names(data))) names(data) <- as.character(1:length(data)) - data <- lapply(data, function(x) if(is.matrix(x) || is.data.frame(x)) x else data.frame(as.list(x)) ) + data <- lapply(data, + function(x) + if(is.matrix(x) || is.data.frame(x)) + x + else + data.frame(as.list(x)) + ) #retval <- new.env() retval <- list() @@ -33,7 +39,10 @@ { if( !(col %in% names(retval))) { - if(verbose) cat("Start:", start, " End:", end, " Column:", col, "\n", sep="") + if(verbose) cat("Start:", start, + " End:", end, + " Column:", col, + "\n", sep="") if(class(block[,col])=="factor") newclass <- "character" else @@ -53,38 +62,3 @@ return(retval) } -testfun <- function(n=10,s=10) - { - names <- unlist(outer(LETTERS,letters, paste, sep="")) - - Z <- list() - for(i in 1:n) - { - X <- data.frame(A=sample(letters,s,replace=T), - B=1:s, - C=rnorm(s) ) - names(X) <- c("A",sample(names[1:s*2],2,replace=F)) - Z[[i]] <- X - } - - - - #ut2 <- unix.time( - # retval2 <- do.call("rbind",Z) - # ) - # - #cat("rbind used",ut2[3], "seconds.\n") - - - ut1 <- unix.time( - retval1 <- do.call("smartbind",Z) - ) - - cat("smartbind used",ut1[3], "seconds.\n") - - - invisible(retval1) - } - - - Added: trunk/gtools/man/smartbind.Rd =================================================================== --- trunk/gtools/man/smartbind.Rd (rev 0) +++ trunk/gtools/man/smartbind.Rd 2006-11-27 21:34:07 UTC (rev 1019) @@ -0,0 +1,74 @@ +\name{smartbind} +\alias{smartbind} +\title{Efficient rbind of data framesy, even if the column names don't match} +\description{ + Efficient rbind of data frames, even if the column names don't match +} +\usage{ +smartbind(...) +} +\arguments{ + \item{\dots}{Data frames to combine} +} +\value{ + The returned data frame will contain: + \item{columns}{all columns present in any provided data frame} + \item{rows}{a set of rows from each provided data frame, with values + in columns not present in the given data frame filled with missing + (\code{NA}) values.} + The data type of columns will be preserved, as long as all data frames + with a given column name agree on the data type of that column. If + the data frames disagree, the column will be converted into a + character strings. The user will need to coerce such character + columns into an appropriate type. +} +\author{Gregory R. Warnes \email{wa...@bs...}} +\seealso{ \code{\link{rbind}}, \code{\link{cbind}} } +\examples{ + + df1 <- data.frame(A=1:10, B=LETTERS[1:10], C=rnorm(10) ) + df2 <- data.frame(A=11:20, D=rnorm(10), E=letters[1:10] ) + + # rbind would fail +\dontrun{ + rbind(df1, df2) + # Error in match.names(clabs, names(xi)) : names do not match previous + # names: + # D, E +} + # but smartbind combines them, appropriately creating NA entries + smartbind(df1, df2) + +\dontshow{ + n=10 # number of data frames to create + s=10 # number of rows in each data frame + + # create a bunch of column names + names <- LETTERS[2:5] + + # create a list 'Z' containing 'n' data frames, each with 3 columns + # and 's' rows. The first column is always named 'A', but the other + # two have a names randomly selected from 'names' + + Z <- list() + for(i in 1:n) + { + X <- data.frame(A=sample(letters,s,replace=T), + B=letters[1:s], + C=rnorm(s) ) + colnames(X) <- c("A",sample(names,2,replace=F)) + Z[[i]] <- X + } + + # Error in match.names(clabs, names(xi)) : names do not match + # previous names: E + + # But smartbind will 'do the right thing' + df <- do.call("smartbind",Z) + df +} +} +% Add one or more standard keywords, see file 'KEYWORDS' in the +% R documentation directory. +\keyword{manip} + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2006-11-27 20:52:35
|
Revision: 1018 http://svn.sourceforge.net/r-gregmisc/?rev=1018&view=rev Author: warnes Date: 2006-11-27 12:52:33 -0800 (Mon, 27 Nov 2006) Log Message: ----------- Update my email address Modified Paths: -------------- trunk/gtools/DESCRIPTION Modified: trunk/gtools/DESCRIPTION =================================================================== --- trunk/gtools/DESCRIPTION 2006-11-27 20:48:53 UTC (rev 1017) +++ trunk/gtools/DESCRIPTION 2006-11-27 20:52:33 UTC (rev 1018) @@ -2,9 +2,8 @@ Title: Various R programming tools Description: Various R programming tools Depends: R (>= 1.9.0) -Version: 2.2.3 -Date: 2005-12-21 +Version: 2.2.4 Author: Gregory R. Warnes. Includes R source code and/or documentation contributed by Ben Bolker and Thomas Lumley -Maintainer: Nitin Jain <nit...@pf...> +Maintainer: Gregory R. Warnes <wa...@bs...> License: LGPL 2.1 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2006-11-27 20:48:54
|
Revision: 1017 http://svn.sourceforge.net/r-gregmisc/?rev=1017&view=rev Author: warnes Date: 2006-11-27 12:48:53 -0800 (Mon, 27 Nov 2006) Log Message: ----------- Create tag for gmodels version 2.13.1 Added Paths: ----------- tags/gmodels_2.13.1/ Copied: tags/gmodels_2.13.1 (from rev 1016, trunk/gmodels) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2006-11-27 20:45:59
|
Revision: 1016 http://svn.sourceforge.net/r-gregmisc/?rev=1016&view=rev Author: warnes Date: 2006-11-27 12:45:56 -0800 (Mon, 27 Nov 2006) Log Message: ----------- Update for 2.13.1 Modified Paths: -------------- trunk/gmodels/DESCRIPTION trunk/gmodels/NEWS Modified: trunk/gmodels/DESCRIPTION =================================================================== --- trunk/gmodels/DESCRIPTION 2006-11-27 20:36:28 UTC (rev 1015) +++ trunk/gmodels/DESCRIPTION 2006-11-27 20:45:56 UTC (rev 1016) @@ -1,5 +1,5 @@ Package: gmodels -Version: 2.13.0 +Version: 2.13.1 Title: Various R programming tools for model fitting Author: Gregory R. Warnes. Includes R source code and/or documentation contributed by Ben Bolker, Thomas Lumley, and Randall C Johnson. Modified: trunk/gmodels/NEWS =================================================================== --- trunk/gmodels/NEWS 2006-11-27 20:36:28 UTC (rev 1015) +++ trunk/gmodels/NEWS 2006-11-27 20:45:56 UTC (rev 1016) @@ -1,6 +1,19 @@ -CHANGES IN GMODELS 2.12.0 -------------------------- +Version 2.13.1 +-------------- +Bug Fixes: + +- Problem: estimable() was failing for lmer objects. + Solution: Add estimable.lmer() to the exported methods list in NAMESPACE + + +Version 2.13.0 +-------------- + + +Version 2.12.0 +-------------- + - Updated Greg's email address. - Add support for lmer (lme version 4) objects to ci(), estimable(), @@ -14,11 +27,11 @@ estimable(reg, c( 0, 1, 0, -1)) which should make estimable() much easier to use for large models. -CHANGES IN GMODELS 2.1.0 ------------------------- +Version 2.1.0 +------------- -CHANGES IN GMODELS 2.0.8 ------------------------ +Version 2.0.8 +------------- - Added DESCRIPTION and removed DESCRIPTION.in This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2006-11-27 20:36:32
|
Revision: 1015 http://svn.sourceforge.net/r-gregmisc/?rev=1015&view=rev Author: warnes Date: 2006-11-27 12:36:28 -0800 (Mon, 27 Nov 2006) Log Message: ----------- Add missing export of methods for estimable() Modified Paths: -------------- trunk/gmodels/DESCRIPTION trunk/gmodels/NAMESPACE Modified: trunk/gmodels/DESCRIPTION =================================================================== --- trunk/gmodels/DESCRIPTION 2006-11-20 23:48:54 UTC (rev 1014) +++ trunk/gmodels/DESCRIPTION 2006-11-27 20:36:28 UTC (rev 1015) @@ -1,10 +1,9 @@ Package: gmodels -Version: 2.12.0-3 -Date: 2006-04-27 +Version: 2.13.0 Title: Various R programming tools for model fitting Author: Gregory R. Warnes. Includes R source code and/or documentation contributed by Ben Bolker, Thomas Lumley, and Randall C Johnson. -Maintainer: Nitin Jain <nit...@pf...> +Maintainer: Gregory R. Warnes <wa...@bs...> Description: Various R programming tools for model fitting Depends: R (>= 1.9.0) Suggests: gplots Modified: trunk/gmodels/NAMESPACE =================================================================== --- trunk/gmodels/NAMESPACE 2006-11-20 23:48:54 UTC (rev 1014) +++ trunk/gmodels/NAMESPACE 2006-11-27 20:36:28 UTC (rev 1015) @@ -24,12 +24,12 @@ S3method(fit.contrast, lme) S3method(fit.contrast, lmer) +S3method(estimable, lm) +S3method(estimable, lmer) + S3method(print, glh.test) S3method(summary, glh.test) -S3method(fit.contrast,lm) -S3method(fit.contrast,lme) - importFrom(MASS, ginv) importFrom(gdata, frameApply) importFrom(gdata, nobs) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2006-11-20 23:51:32
|
Revision: 1014 http://svn.sourceforge.net/r-gregmisc/?rev=1014&view=rev Author: warnes Date: 2006-11-20 15:48:54 -0800 (Mon, 20 Nov 2006) Log Message: ----------- Updates after review for RNews submission Modified Paths: -------------- trunk/ssize/inst/doc/ssize.Rnw Modified: trunk/ssize/inst/doc/ssize.Rnw =================================================================== --- trunk/ssize/inst/doc/ssize.Rnw 2006-11-16 13:05:05 UTC (rev 1013) +++ trunk/ssize/inst/doc/ssize.Rnw 2006-11-20 23:48:54 UTC (rev 1014) @@ -3,83 +3,87 @@ %\VignetteKeywords{Expression Analysis, Sample Size} %\VignettePackage{ssize} - %\documentclass[letter]{report} \documentclass[a4paper]{report} +\usepackage{Rnews} \usepackage{/Library/Frameworks/R.framework/Resources/share/texmf/Sweave} -\usepackage{Rnews} \usepackage[round]{natbib} +\usepackage{here} \begin{document} + +\setkeys{Gin}{width=0.9\textwidth} + \begin{article} \title{Sample Size Estimation for Microarray Experiments Using the \code{ssize} package.} \author{Gregory R. Warnes \\ email:\code{wa...@bs...}} -\subtitle{ ~ } +%\subtitle{ ~ } \maketitle \section*{abstract} -RNA Expression Microarray technology is widely applied in biomedical -and pharmaceutical research. The huge number of RNA concentrations +mRNA Expression Microarray technology is widely applied in biomedical +and pharmaceutical research. The huge number of mRNA concentrations estimated for each sample make it difficult to apply traditional sample size calculation techniques and has left most practitioners to rely on rule-of-thumb techniques. In this paper, we briefly describe and then demonstrate a simple method for performing and visualizing sample size calculations for microarray experiments as -implemented in the \code{ssize} R package, which is available from -the Bioconductor project (\url{http://www.bioconductor.org}) web -site. +implemented in the \code{ssize} R package. \section*{Note} This document is a simplified version of the manuscript \begin{quote} Warnes, G. R., Liu, P. (2006) Sample Size Estimation for Microarray - Experiments, Technical Report, Department of Biostatisticsa and + Experiments, Technical Report, Department of Biostatistics and Computational Biology, University of Rochester. \end{quote} which has been available as a pre-publication manuscript since 2004. Please refer to that document for a detailed discussion of the sample -size estimation method. +size estimation method and an evaluation of its performance. \section*{Introduction} High-throughput microarray experiments allow the measurement of expression levels for tens of thousands of genes simultaneously. These experiments have been used in many disciplines of biological -research, including as neuroscience \citep{Mandel03}, -pharmacogenomic research, genetic disease and cancer diagnosis -\citep{Heller02}. As a tool for estimating gene expression and -single nucleotide polymorphism (SNP) genotyping, microarrays produce -huge amounts of data which are providing important new insights. +research, including neuroscience \citep{Mandel03}, pharmacogenomic +research, genetic disease and cancer diagnosis \citep{Heller02}. As a +tool for estimating gene expression and single nucleotide polymorphism +(SNP) genotyping, microarrays produce huge amounts of data which can +providing important new insights. Microarray experiments are rather costly in terms of materials (RNA sample, reagents, chip, etc), laboratory manpower, and data analysis effort. It is critical, therefore, to perform proper experimental -design, including sample size estimation, before carrying out -microarray experiments. Since tens of thousands of variables (gene -expressions) may be measured on each individual chip, it is -essential to take into account multiple testing and dependency among -variables when calculating sample size. +design, including sample size estimation, before carrying out these +experiments. Since tens of thousands of variables (gene expressions) +may be measured on each individual chip, it is essential appropriately +take into account multiple testing and dependency among variables when +calculating sample size. \section*{Method} \subsection*{Overview} -\citet{Warnes05} provides a simple method for computing sample size -for micrarray experiments, and reports on a sereies of simulations -demonstrating the performinace of the method. The key component of -this method is the generation of cumulative plot of the proportion -of genes achieving a desired power as a function of sample size, -based on simple gene-by-gene calculations. While this mechanism can -be used to select a sample size numerically based on pre-specified -conditions, its real utility is as a visual tool for helping clients -to understand the trade off between sample size and power. In our -consulting work, this latter use as a visual tool has been +\citet{Warnes05} provide a simple method for computing sample size for +microarray experiments, and reports on a series of simulations +demonstrating its performance. Surprisingly, despite its simplicity, +the method performs exceptionally well even for data with very high +correlation between measurements. + +The key component of this method is the generation of a cumulative +plot of the proportion of genes achieving a desired power as a +function of sample size, based on simple gene-by-gene calculations. +While this mechanism can be used to select a sample size numerically +based on pre-specified conditions, its real utility is as a visual +tool for understanding the trade off between sample size and power. +In our consulting work, this latter use as a visual tool has been exceptionally valuable in helping scientific clients to make the difficult trade offs between experiment cost and statistical power. @@ -112,8 +116,11 @@ \begin{enumerate} \item{Estimate standard deviation ($\sigma$) for each gene based on - \emph{control samples} from existing studies performed on the - same biological system.} + \emph{control samples} from existing studies performed on the same + biological system. (While samples from the study to be performed + are not, of course, generally available, control samples from + other studies using the same biological system are often readily + available.) } \item{Specify values for \begin{enumerate} @@ -162,7 +169,7 @@ the relationship between power for all genes and required sample size in a single display. A sample size can thus be selected for a proposed microarray experiment based on user-defined criterion. For -the plot in Figure \ref{fig:CumNPlot}, for example, requiring $70\%$ +the plot in Figure \ref{fig:CumNPlot}, for example, requiring $80\%$ of genes to achieve the $80\%$ power yields a sample size of 10. Similar plots can be generated by fixing the sample size and @@ -171,75 +178,11 @@ such plots are shown in Figures \ref{fig:CumPowerPlot} and \ref{fig:CumFoldChangePlot}. +\subsection{Functions} -\section*{Example} +There are three pairs of functions available in the \code{ssize} package. -First, we need to load the \code{ssize} library: - -<<results=hide>>= -library(ssize) -library(xtable) -library(gdata) # for nobs() -options(width=30) -@ - -As part of the \code{ssize} library, I've provided an example data -set containing gene expression values for smooth muscle cells from a -control group of untreated healthy volunteers processed using -Affymetrix U95 chips and normalized per the Robust Multi-array -Average (RMA) method of \citet{Irizarry03}. - -<<>>= -data(exp.sd) -#str(exp.sd) -@ - -This data was calculated via something like - \begin{verbatim} -library(affy) -setwd("~/GT_methods_050316/WORK") -load("probeset_data.Rda") -expression.values <- exprs(probeset.data) -covariate.data <- pData(probeset.data) -controls <- expression.values[, - covariate.data$GROUP=="Control"] #$ -exp.sd <- apply(controls, 1, sd) -\end{verbatim} - - -Lets see what the distribution looks like: - -%\begin{figure}[h!] -% \centering -% \caption{Distribution of exp.sd} -% \label{exp.sd.hist} -%\end{figure} - -<<fig=TRUE,width=12,height=12>>= - xlab <- c("Standard Deviation", " (for data on the log scale)") - hist(exp.sd,n=20, col="cyan", border="blue", main="", xlab=xlab) - dens <- density(exp.sd) - scaled.y <- dens$y*par("usr")[4]/max(dens$y) - lines(dens$x,scaled.y ,col="red",lwd=2) #$ - title("Histogram of Standard Deviations") -@ - - -Note that this distribution is right skewed, even though it is on -the $\log_2$ scale. - -To make the computations run faster, we'll only use the standard -deviations for the first 1000 genes on the chip. Everything will -work if you skip this, but it will take longer. - -<<>>= -exp.sd <- exp.sd[1:1000] -@ - -There are 6 functions available in the \code{ssize} package. - -\begin{verbatim} pow(sd, n, delta, sig.level, alpha.correct = "Bonferonni") power.plot(x, xlab = "Power", @@ -259,15 +202,14 @@ alpha.correct = "Bonferonni") delta.plot (x, xlab = "Fold Change", ylab = "Proportion of Genes with " - "Power >= 80\% at Fold Change=delta", + "Power >= 80\% at\\n" + "Fold Change=delta", marks = c(1.5, 2, 2.5, 3, 4, 6, 10), ...) \end{verbatim} -You will note that there are three pairs. - \begin{description} -\item[pow, power.sd] compute and display a cumulative plot of the +\item[pow, power.plot] compute and display a cumulative plot of the fraction of genes achieving a specified power for a fixed sample size (\code{n}), effect size (\code{delta}), and significance level (\code{sig.level}). @@ -284,47 +226,90 @@ \end{description} -So, now lets see the functions in action. -First, lets define the values for which we will be investigating: + + +\section*{Example} + +First, we need to load the \code{ssize} library: + +<<results=hide>>= +library(ssize) +library(xtable) +library(gdata) # for nobs() +options(width=30) +@ + +The \code{ssize} library provides an example data set containing gene +expression values for smooth muscle cells from a control group of +untreated healthy volunteers processed using Affymetrix U95 chips and +normalized per the Robust Multi-array Average (RMA) method of +\citet{Irizarry03}. + <<>>= +# Load the example data +data(exp.sd) + +# Use only the first 1000, +# so examples run faster +exp.sd <- exp.sd[1:1000] +@ + +This data was calculated via: +\begin{verbatim} +library(affy) +load("probeset_data.Rda") +expression.values <- exprs(probeset.data) +covariate.data <- pData(probeset.data) +controls <- expression.values[, + covariate.data$GROUP=="Control"] #$ +exp.sd <- apply(controls, 1, sd) +\end{verbatim} + +Lets see what the distribution looks like: +<<label=SDPlot,fig=TRUE,include=F,results=hide,width=12,height=12>>= +par(cex=2) +xlab <- c("Standard Deviation", "(for data on the log scale)") +hist(exp.sd,n=40, col="cyan", border="blue", main="", xlab=xlab, log="x") +dens <- density(exp.sd) +scaled.y <- dens$y*par("usr")[4]/max(dens$y) +lines(dens$x,scaled.y ,col="red",lwd=2) #$ +@ +\begin{figure}[H] + \caption{Standard deviations for of logged example data} + \label{fig:SDPlot} + \begin{center} + \includegraphics{ssize-SDPlot} + \end{center} +\end{figure} + + +As is often the case, this distribution is extremely right skewed, +even though the standard deviations were computed on the $\log_2$ +scale. + + +So, now lets see the functions in action. First, define the parameter +values we will be investigating: +<<>>= n<-6 fold.change<-2.0 power<-0.8 sig.level<-0.05 @ +Now, the functions provided by the \code{ssize} package can be used to +address several questions: + \begin{enumerate} -\item What is the power for 6 patients per group with $\delta=1.0$, - $\alpha=0.05$? - -<<fig=TRUE,width=12,height=12>>= -all.power <- pow(sd=exp.sd, n=n, delta=log2(fold.change), - sig.level=sig.level) - -power.plot(all.power, lwd=2, col="blue") -xmax <- par("usr")[2]-0.05; ymax <- par("usr")[4]-0.05 -legend(x=xmax, y=ymax, - legend= strsplit( paste("n=",n,",", - "fold change=",fold.change,",", - "alpha=", sig.level, ",", - "# genes=", nobs(exp.sd), sep=''), "," )[[1]], - xjust=1, yjust=1, cex=1.0) -title("Power to Detect 2-Fold Change") -@ -%\begin{figure}[h!] -% \caption{Effect of Sample Size on Power} \label{fig:CumNPlot} -% \centering -%\end{figure} - \item What is the necessary per-group sample size for $80\%$ power when $\delta=1.0$, and $\alpha=0.05$? - -<<fig=TRUE,width=12,height=12>>= +<<label=CumNPlot,fig=TRUE,include=F>>= all.size <- ssize(sd=exp.sd, delta=log2(fold.change), sig.level=sig.level, power=power) +par(cex=1.3) ssize.plot(all.size, lwd=2, col="magenta", xlim=c(1,20)) xmax <- par("usr")[2]-1; ymin <- par("usr")[3] + 0.05 @@ -333,43 +318,90 @@ "alpha=", sig.level, ",", "power=",power,",", "# genes=", nobs(exp.sd), sep=''), "," )[[1]], - xjust=1, yjust=0, cex=1.0) + xjust=1, yjust=0, cex=0.90) title("Sample Size to Detect 2-Fold Change") @ -%\begin{figure}[h!] -% \caption{Sample size required to detect a 2-fold treatment effect.} -% \label{fig:CumPowerPlot} -% \centering -%\end{figure} +\begin{figure}[H] + \caption{Sample size required to detect a 2-fold treatment effect.} + \label{fig:CumPowerPlot} + \begin{center} + \includegraphics{ssize-CumNPlot} + \end{center} +\end{figure} %\clearpage -\item What is necessary fold change to achieve $80\%$ with $n=6$ -patients per group, when $\delta=1.0$ and $\alpha=0.05$? +This plot illustrates that a sample size of 10 is required to ensure +that at least 80\% of genes have power greater than 80\%. It also +shows that a sample size of 6 is sufficient if only 60\% of the genes +need to achieve 80\% power. -%\begin{figure}[h!] -% \caption[Given Sample Size, Fold Change (Effect Size) Necessary to -% Achieving a Specified Power]{Given sample size, this plot allows -% visualization of the fraction of genes achieving the specified -% power for different fold changes.} -% \label{fig:CumFoldChangePlot} -% \centering -%\end{figure} +\item What is the power for 6 patients per group with $\delta=1.0$, + and $\alpha=0.05$? -<<fig=TRUE,width=12,height=12>>= +<<label=CumPowerPlot,fig=TRUE,include=F>>= +all.power <- pow(sd=exp.sd, n=n, delta=log2(fold.change), + sig.level=sig.level) + +par(cex=1.3) +power.plot(all.power, lwd=2, col="blue") +xmax <- par("usr")[2]-0.05; ymax <- par("usr")[4]-0.05 +legend(x=xmax, y=ymax, + legend= strsplit( paste("n=",n,",", + "fold change=",fold.change,",", + "alpha=", sig.level, ",", + "# genes=", nobs(exp.sd), sep=''), "," )[[1]], + xjust=1, yjust=1, cex=0.90) +title("Power to Detect 2-Fold Change") +@ +\begin{figure}[H] + \caption{Effect of Sample Size on Power} + \label{fig:CumNPlot} + \begin{center} + \includegraphics{ssize-CumPowerPlot} + \end{center} +\end{figure} + +This plot shows that only 52\% of genes achieve at 80\% power at this +sample size and significance level. + +\item How large does a fold-change need to be for 80\% of genes to +achieve 80\% power for an experiment for $n=6$ patients per group and +$\alpha=0.05$? + +<<label=CumFoldChangePlot,fig=TRUE,include=F>>= all.delta <- delta(sd=exp.sd, power=power, n=n, sig.level=sig.level) -delta.plot(all.delta, lwd=2, col="magenta", xlim=c(1,10)) +par(cex=1.3, mar=c(5.1,5.1,4,2)) +delta.plot(all.delta, lwd=2, col="magenta", xlim=c(1,10), + ylab = paste("Proportion of Genes with ", + "Power >= 80\% \n", + "at Fold Change of \delta") +) xmax <- par("usr")[2]-1; ymin <- par("usr")[3] + 0.05 legend(x=xmax, y=ymin, legend= strsplit( paste("n=",n,",", "alpha=", sig.level, ",", "power=",power,",", "# genes=", nobs(exp.sd), sep=''), "," )[[1]], - xjust=1, yjust=0, cex=1.0) + xjust=1, yjust=0, cex=0.90) title("Fold Change to Achieve 80\% Power") @ +\begin{figure}[H] + \caption[Given Sample Size, Fold Change (Effect Size) Necessary to + Achieving a Specified Power]{Given sample size, this plot allows + visualization of the fraction of genes achieving the specified + power for different fold changes.} + \label{fig:CumFoldChangePlot} + \begin{center} + \includegraphics{ssize-CumFoldChangePlot} + \end{center} +\end{figure} +This plot shows that for a fold change of 2.0, only 60\% of genes +achieve 80\% power, while a fold change of 3.0 will be detected with +80\% power for 80\% of genes. + \end{enumerate} \section*{Modifications} @@ -439,9 +471,10 @@ A direct approach to false discovery rates, {\it Journal of Royal Statistical Society B}, {\bf 64:3}, 479-498. -\bibitem[Warnes and Liu, 2005]{Warnes05} Warnes, G. R., Liu, P. (2005) +\bibitem[Warnes and Liu, 2006]{Warnes05} Warnes, G. R., Liu, P. (2006) Sample Size Estimation for Microarray Experiments, \emph{submitted - to} {\it Biometrics}. + to} Technical Report, Department of Biostatistics and + Computational Biology, University of Rochester. \bibitem[Yang {\it et~al.}, 2003]{Yang03} Yang, M. C. K., Yang, J. J., McIndoe, R. A., She, J. X. (2003) Microarray experimental This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gg...@us...> - 2006-11-16 13:05:18
|
Revision: 1013 http://svn.sourceforge.net/r-gregmisc/?rev=1013&view=rev Author: ggorjan Date: 2006-11-16 05:05:05 -0800 (Thu, 16 Nov 2006) Log Message: ----------- seems that c.factor was not a good idea and there were better examples posted on r-devel list Removed Paths: ------------- trunk/gdata/R/c.factor.R trunk/gdata/man/c.factor.Rd Deleted: trunk/gdata/R/c.factor.R =================================================================== --- trunk/gdata/R/c.factor.R 2006-11-14 22:25:06 UTC (rev 1012) +++ trunk/gdata/R/c.factor.R 2006-11-16 13:05:05 UTC (rev 1013) @@ -1,18 +0,0 @@ -# $Id$ - -c.factor <- function(..., - recursive=FALSE # ignored - ) -{ - dots <- list(...) # recursive below is not related to one above! - mapCha <- c(mapLevels(dots, codes=FALSE), recursive=TRUE) - class(mapCha) <- "levelsMap" - dots <- unlist(lapply(dots, "mapLevels<-", mapCha)) - mapLevels(dots) <- mapLevels(as.character(mapCha)) - dots -} - - - - - Deleted: trunk/gdata/man/c.factor.Rd =================================================================== --- trunk/gdata/man/c.factor.Rd 2006-11-14 22:25:06 UTC (rev 1012) +++ trunk/gdata/man/c.factor.Rd 2006-11-16 13:05:05 UTC (rev 1013) @@ -1,35 +0,0 @@ -%% $Id$ - -\name{c.factor} -\alias{c.factor} -\title{Combine factors, properly handling levels} -\description{ - This method for \code{c} combines factors while properly preserves level - information. -} -\usage{ -c.factor(..., recursive = FALSE) -} -\arguments{ - \item{\dots}{ factors to be combined } - \item{recursive}{ ignored } -} -\details{ - -} -\value{ - A single factor object. The levels on the new object are created by - concatinating the levels of the provided factors, with any duplicate - level names merged, and with the factor coding modified appropriately. -} -\author{Gregor Gorjan} -\seealso{ \code{\link[base]{c}} } -\examples{ -f1 <- factor(letters[1:10]) -f2 <- factor(letters[5:14]) - -c(f1,f2) - -} -\keyword{manip} - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gg...@us...> - 2006-11-14 22:25:08
|
Revision: 1012 http://svn.sourceforge.net/r-gregmisc/?rev=1012&view=rev Author: ggorjan Date: 2006-11-14 14:25:06 -0800 (Tue, 14 Nov 2006) Log Message: ----------- Removed executable property Property Changed: ---------------- trunk/gdata/man/combine.Rd trunk/gdata/man/frameApply.Rd trunk/gmodels/R/ci.R trunk/gmodels/R/fast.prcomp.R trunk/gmodels/man/ci.Rd trunk/gplots/R/bandplot.R trunk/gplots/R/boxplot.n.R trunk/gplots/R/lowess.R trunk/gplots/R/plot.lm.R trunk/gplots/R/plotCI.R trunk/gplots/R/plotmeans.R trunk/gplots/R/residplot.R trunk/gplots/R/wapply.R trunk/gplots/man/boxplot.n.Rd trunk/gplots/man/plotCI.Rd trunk/gplots/man/plotmeans.Rd trunk/gtools/R/combinations.R trunk/gtools/R/running.R trunk/gtools/man/ELISA.Rd trunk/gtools/man/combinations.Rd Property changes on: trunk/gdata/man/combine.Rd ___________________________________________________________________ Name: svn:executable - * Property changes on: trunk/gdata/man/frameApply.Rd ___________________________________________________________________ Name: svn:executable - * Property changes on: trunk/gmodels/R/ci.R ___________________________________________________________________ Name: svn:executable - * Property changes on: trunk/gmodels/R/fast.prcomp.R ___________________________________________________________________ Name: svn:executable - * Property changes on: trunk/gmodels/man/ci.Rd ___________________________________________________________________ Name: svn:executable - * Property changes on: trunk/gplots/R/bandplot.R ___________________________________________________________________ Name: svn:executable - * Property changes on: trunk/gplots/R/boxplot.n.R ___________________________________________________________________ Name: svn:executable - * Property changes on: trunk/gplots/R/lowess.R ___________________________________________________________________ Name: svn:executable - * Property changes on: trunk/gplots/R/plot.lm.R ___________________________________________________________________ Name: svn:executable - * Property changes on: trunk/gplots/R/plotCI.R ___________________________________________________________________ Name: svn:executable - * Property changes on: trunk/gplots/R/plotmeans.R ___________________________________________________________________ Name: svn:executable - * Property changes on: trunk/gplots/R/residplot.R ___________________________________________________________________ Name: svn:executable - * Property changes on: trunk/gplots/R/wapply.R ___________________________________________________________________ Name: svn:executable - * Property changes on: trunk/gplots/man/boxplot.n.Rd ___________________________________________________________________ Name: svn:executable - * Property changes on: trunk/gplots/man/plotCI.Rd ___________________________________________________________________ Name: svn:executable - * Property changes on: trunk/gplots/man/plotmeans.Rd ___________________________________________________________________ Name: svn:executable - * Property changes on: trunk/gtools/R/combinations.R ___________________________________________________________________ Name: svn:executable - * Property changes on: trunk/gtools/R/running.R ___________________________________________________________________ Name: svn:executable - * Property changes on: trunk/gtools/man/ELISA.Rd ___________________________________________________________________ Name: svn:executable - * Property changes on: trunk/gtools/man/combinations.Rd ___________________________________________________________________ Name: svn:executable - * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2006-11-14 18:44:34
|
Revision: 1005 http://svn.sourceforge.net/r-gregmisc/?rev=1005&view=rev Author: warnes Date: 2006-11-14 09:56:21 -0800 (Tue, 14 Nov 2006) Log Message: ----------- Correct problem with labeled correlation matrix example. Thanks to Jean Vidal for reporting the error.. Modified Paths: -------------- trunk/gplots/man/heatmap.2.Rd Modified: trunk/gplots/man/heatmap.2.Rd =================================================================== --- trunk/gplots/man/heatmap.2.Rd 2006-11-10 23:51:57 UTC (rev 1004) +++ trunk/gplots/man/heatmap.2.Rd 2006-11-14 17:56:21 UTC (rev 1005) @@ -285,7 +285,7 @@ distfun=function(c) as.dist(1 - c), trace="none") ## The Correlation matrix with same reordering: - hM <- format(round(cU[hU[[1]], hU[[2]]], 2)) + hM <- format(round(cU, 2)) hM # now with the correlation matrix on the plot itself This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2006-11-14 18:44:34
|
Revision: 1006 http://svn.sourceforge.net/r-gregmisc/?rev=1006&view=rev Author: warnes Date: 2006-11-14 09:57:22 -0800 (Tue, 14 Nov 2006) Log Message: ----------- Update version number and maintainer Modified Paths: -------------- trunk/gplots/DESCRIPTION Modified: trunk/gplots/DESCRIPTION =================================================================== --- trunk/gplots/DESCRIPTION 2006-11-14 17:56:21 UTC (rev 1005) +++ trunk/gplots/DESCRIPTION 2006-11-14 17:57:22 UTC (rev 1006) @@ -4,9 +4,8 @@ Depends: R (>= 1.9.0), gtools, gdata, stats Recommends: datasets Suggests: gtools, gdata -Version: 2.3.0 -Date: 2006-03-07 +Version: 2.3.1 Author: Gregory R. Warnes. Includes R source code and/or documentation contributed by Ben Bolker and Thomas Lumley -Maintainer: Nitin Jain <nit...@pf...> +Maintainer: Gregory R. Warnes <wa...@bs...> License: GPL (version 2 or later) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |