Thread: [R-gregmisc-users] SF.net SVN: r-gregmisc:[1789] trunk/gdata (Page 3)
Brought to you by:
warnes
From: <wa...@us...> - 2014-04-05 14:26:54
|
Revision: 1789 http://sourceforge.net/p/r-gregmisc/code/1789 Author: warnes Date: 2014-04-05 14:26:49 +0000 (Sat, 05 Apr 2014) Log Message: ----------- Move vignettes from inst/doc/ to vignettes/ Added Paths: ----------- trunk/gdata/vignettes/ trunk/gdata/vignettes/mapLevels.Rnw trunk/gdata/vignettes/unknown.Rnw Removed Paths: ------------- trunk/gdata/inst/doc/mapLevels.Rnw trunk/gdata/inst/doc/unknown.Rnw Deleted: trunk/gdata/inst/doc/mapLevels.Rnw =================================================================== --- trunk/gdata/inst/doc/mapLevels.Rnw 2014-04-05 13:57:10 UTC (rev 1788) +++ trunk/gdata/inst/doc/mapLevels.Rnw 2014-04-05 14:26:49 UTC (rev 1789) @@ -1,229 +0,0 @@ - -%\VignetteIndexEntry{Mapping levels of a factor} -%\VignettePackage{gdata} -%\VignetteKeywords{levels, factor, manip} - -\documentclass[a4paper]{report} -\usepackage{Rnews} -\usepackage[round]{natbib} -\bibliographystyle{abbrvnat} - -\usepackage{Sweave} -\SweaveOpts{strip.white=all, keep.source=TRUE} - -\begin{document} - -\begin{article} - -\title{Mapping levels of a factor} -\subtitle{The \pkg{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''. - -<<ex01>>= -library(gdata) -(fac <- factor(c("B", "A", "Z", "D"))) -(map <- mapLevels(x=fac)) -@ - -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. - -<<ex02>>= -(int <- as.integer(fac)) -mapLevels(x=int) <- map -int -identical(fac, int) -@ - -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. - -<<ex03>>= -str(map) -@ - -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}. - -<<ex04>>= -map[[2]] <- as.integer(c(1, 2)) -map -int <- as.integer(fac) -mapLevels(x=int) <- map -int -@ - -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. - -<<ex05>>= -(f1 <- factor(c("A", "D", "C"))) -(f2 <- factor(c("B", "D", "C"))) -@ - -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: - -<<ex06>>= -fTest <- f1 -levels(fTest) <- c("A", "B", "C", "D") -fTest -@ - -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: - -<<ex07>>= -fTest <- f1 -levels(fTest) <- list(A="A", B="B", - C="C", D="D") -fTest -@ - -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. - -<<ex08>>= -(bigMap <- mapLevels(x=list(f1, f2), - codes=FALSE, - combine=TRUE)) -mapLevels(f1) <- bigMap -mapLevels(f2) <- bigMap -f1 -f2 -cbind(as.character(f1), as.integer(f1), - as.character(f2), as.integer(f2)) -@ - -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} Deleted: trunk/gdata/inst/doc/unknown.Rnw =================================================================== --- trunk/gdata/inst/doc/unknown.Rnw 2014-04-05 13:57:10 UTC (rev 1788) +++ trunk/gdata/inst/doc/unknown.Rnw 2014-04-05 14:26:49 UTC (rev 1789) @@ -1,272 +0,0 @@ - -%\VignetteIndexEntry{Working with Unknown Values} -%\VignettePackage{gdata} -%\VignetteKeywords{unknown, missing, manip} - -\documentclass[a4paper]{report} -\usepackage{Rnews} -\usepackage[round]{natbib} -\bibliographystyle{abbrvnat} - -\usepackage{Sweave} -\SweaveOpts{strip.white=all, keep.source=TRUE} - -\begin{document} - -\begin{article} - -\title{Working with Unknown Values} -\subtitle{The \pkg{gdata} package} -\author{by Gregor Gorjanc} - -\maketitle - -This vignette has been 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, the -\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 the {\emph R Data Import/Export} manual -\citep{RImportExportManual}. However, all approaches lack the possibility -to define unknown value(s) for some particular column. It is possible that -an unknown value in one column is a valid value in another column. For -example, I have seen many datasets where values such as 0, -9, 999 and -specific dates are used as column specific unknown values. - -This note describes a set of functions in package \pkg{gdata}\footnote{ - package version 2.3.1} \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 these functions on -\code{numeric} and \code{factor} classes, where value \code{0} (beside -\code{NA}) should be treated as an unknown value: - -<<ex01>>= -library("gdata") -xNum <- c(0, 6, 0, 7, 8, 9, NA) -isUnknown(x=xNum) -@ - -The default unknown value in \code{isUnknown} is \code{NA}, which means -that output is the same as \code{is.na} --- at least for atomic -classes. However, we can pass the argument \code{unknown} to define which -values should be treated as unknown: - -<<ex02>>= -isUnknown(x=xNum, unknown=0) -@ - -This skipped \code{NA}, but we can get the expected answer after -appropriately adding \code{NA} into the argument \code{unknown}: - -<<ex03>>= -isUnknown(x=xNum, unknown=c(0, NA)) -@ - -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 an 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: - -<<ex04>>= -(xNum2 <- unknownToNA(x=xNum, unknown=0)) -@ - -Prior to export from \R{}, we might want to change unknown values -(\code{NA} in \R{}) to some other value. Function \code{NAToUnknown} can be -used for this: - -<<ex05>>= -NAToUnknown(x=xNum2, unknown=999) -@ - -Converting \code{NA} to a value that already exists in \code{x} issues an -error, but \code{force=TRUE} can be used to overcome this if needed. But be -warned that there is no way back from this step: - -<<ex06>>= -NAToUnknown(x=xNum2, unknown=7, force=TRUE) -@ - -Examples below show all peculiarities with class \code{factor}. -\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 the -argument \code{unknown} in functions \code{isUnknown} and -\code{unknownToNA} need not match the class of \code{x} (otherwise factor -should be used) as the test is internally done with \code{\%in\%}, which -nicely resolves coercing issues. - -<<ex07>>= -(xFac <- factor(c(0, "BA", "RA", "BA", NA, "NA"))) -isUnknown(x=xFac) -isUnknown(x=xFac, unknown=0) -isUnknown(x=xFac, unknown=c(0, NA)) -isUnknown(x=xFac, unknown=c(0, "NA")) -isUnknown(x=xFac, unknown=c(0, "NA", NA)) - -(xFac <- unknownToNA(x=xFac, unknown=0)) -(xFac <- NAToUnknown(x=xFac, unknown=0)) -@ - -These two examples with classes \code{numeric} and \code{factor} are fairly -simple and we could get the same results with one or two lines of \R{} -code. The real benefit of the set of functions presented here 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 possibly having multiple unknown values that can be different among -\code{list} components or \code{data.frame} columns. For these two methods, -the 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 a \code{vector}/\code{list} object passed to the argument -\code{unknown} is not named, the first value/component of a -\code{vector}/\code{list} matches the first component/column of a -\code{list}/\code{data.frame}. This can be quite error prone, especially -with \code{vectors}. Therefore, I encourage the 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. - -The example below illustrates the application of the described functions to -a list which 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 an unknown value. Note that we -get \code{FALSE} for \code{NA}s as has been the case in the first example. - -<<ex08>>= -(xList <- list(a=xNum, b=xFac)) -isUnknown(x=xList, unknown=0) -@ - -We need to add \code{NA} as an unknown value. However, we do not get the -expected result this way! - -<<ex09>>= -isUnknown(x=xList, unknown=c(0, NA)) -@ - -This is due to matching of values in the 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 a \code{list} (preferably a named list) to the -argument \code{unknown}, as shown below. - -<<ex10>>= -(xList1 <- unknownToNA(x=xList, - unknown=list(b=c(0, "NA"), - a=0))) -@ - -Changing \code{NA}s to some other value (only one per component/column) can -be accomplished as follows: - -<<ex11>>= -NAToUnknown(x=xList1, - unknown=list(b="no", a=0)) -@ - -A named component \code{.default} of a \code{list} passed to argument -\code{unknown} has a special meaning as it will match a 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. Consider a wide \code{data.frame} named \code{df}. Now -\code{.default} can be used to define unknown value for several columns: - -<<ex12, echo=FALSE>>= -df <- data.frame(col1=c(0, 1, 999, 2), - col2=c("a", "b", "c", "unknown"), - col3=c(0, 1, 2, 3), - col4=c(0, 1, 2, 2)) -@ - -<<ex13>>= -tmp <- list(.default=0, - col1=999, - col2="unknown") -(df2 <- unknownToNA(x=df, - unknown=tmp)) -@ - -If there is a need to work only on some components/columns you can of -course ``skip'' columns with standard \R{} mechanisms, i.e., -by subsetting \code{list} or \code{data.frame} objects: - -<<ex14>>= -df2 <- df -cols <- c("col1", "col2") -tmp <- list(col1=999, - col2="unknown") -df2[, cols] <- unknownToNA(x=df[, cols], - unknown=tmp) -df2 -@ - -\section{Summary} - -Functions \code{isUnknown}, \code{unknownToNA} and \code{NAToUnknown} -provide a useful 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}, 7\penalty0 (1):\penalty0 24--26, 2007. -\newblock URL \url{http://CRAN.R-project.org/doc/Rnews/Rnews_2007-1.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} Copied: trunk/gdata/vignettes/mapLevels.Rnw (from rev 1786, trunk/gdata/inst/doc/mapLevels.Rnw) =================================================================== --- trunk/gdata/vignettes/mapLevels.Rnw (rev 0) +++ trunk/gdata/vignettes/mapLevels.Rnw 2014-04-05 14:26:49 UTC (rev 1789) @@ -0,0 +1,229 @@ + +%\VignetteIndexEntry{Mapping levels of a factor} +%\VignettePackage{gdata} +%\VignetteKeywords{levels, factor, manip} + +\documentclass[a4paper]{report} +\usepackage{Rnews} +\usepackage[round]{natbib} +\bibliographystyle{abbrvnat} + +\usepackage{Sweave} +\SweaveOpts{strip.white=all, keep.source=TRUE} + +\begin{document} + +\begin{article} + +\title{Mapping levels of a factor} +\subtitle{The \pkg{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''. + +<<ex01>>= +library(gdata) +(fac <- factor(c("B", "A", "Z", "D"))) +(map <- mapLevels(x=fac)) +@ + +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. + +<<ex02>>= +(int <- as.integer(fac)) +mapLevels(x=int) <- map +int +identical(fac, int) +@ + +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. + +<<ex03>>= +str(map) +@ + +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}. + +<<ex04>>= +map[[2]] <- as.integer(c(1, 2)) +map +int <- as.integer(fac) +mapLevels(x=int) <- map +int +@ + +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. + +<<ex05>>= +(f1 <- factor(c("A", "D", "C"))) +(f2 <- factor(c("B", "D", "C"))) +@ + +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: + +<<ex06>>= +fTest <- f1 +levels(fTest) <- c("A", "B", "C", "D") +fTest +@ + +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: + +<<ex07>>= +fTest <- f1 +levels(fTest) <- list(A="A", B="B", + C="C", D="D") +fTest +@ + +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. + +<<ex08>>= +(bigMap <- mapLevels(x=list(f1, f2), + codes=FALSE, + combine=TRUE)) +mapLevels(f1) <- bigMap +mapLevels(f2) <- bigMap +f1 +f2 +cbind(as.character(f1), as.integer(f1), + as.character(f2), as.integer(f2)) +@ + +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} Copied: trunk/gdata/vignettes/unknown.Rnw (from rev 1786, trunk/gdata/inst/doc/unknown.Rnw) =================================================================== --- trunk/gdata/vignettes/unknown.Rnw (rev 0) +++ trunk/gdata/vignettes/unknown.Rnw 2014-04-05 14:26:49 UTC (rev 1789) @@ -0,0 +1,272 @@ + +%\VignetteIndexEntry{Working with Unknown Values} +%\VignettePackage{gdata} +%\VignetteKeywords{unknown, missing, manip} + +\documentclass[a4paper]{report} +\usepackage{Rnews} +\usepackage[round]{natbib} +\bibliographystyle{abbrvnat} + +\usepackage{Sweave} +\SweaveOpts{strip.white=all, keep.source=TRUE} + +\begin{document} + +\begin{article} + +\title{Working with Unknown Values} +\subtitle{The \pkg{gdata} package} +\author{by Gregor Gorjanc} + +\maketitle + +This vignette has been 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, the +\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 the {\emph R Data Import/Export} manual +\citep{RImportExportManual}. However, all approaches lack the possibility +to define unknown value(s) for some particular column. It is possible that +an unknown value in one column is a valid value in another column. For +example, I have seen many datasets where values such as 0, -9, 999 and +specific dates are used as column specific unknown values. + +This note describes a set of functions in package \pkg{gdata}\footnote{ + package version 2.3.1} \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 these functions on +\code{numeric} and \code{factor} classes, where value \code{0} (beside +\code{NA}) should be treated as an unknown value: + +<<ex01>>= +library("gdata") +xNum <- c(0, 6, 0, 7, 8, 9, NA) +isUnknown(x=xNum) +@ + +The default unknown value in \code{isUnknown} is \code{NA}, which means +that output is the same as \code{is.na} --- at least for atomic +classes. However, we can pass the argument \code{unknown} to define which +values should be treated as unknown: + +<<ex02>>= +isUnknown(x=xNum, unknown=0) +@ + +This skipped \code{NA}, but we can get the expected answer after +appropriately adding \code{NA} into the argument \code{unknown}: + +<<ex03>>= +isUnknown(x=xNum, unknown=c(0, NA)) +@ + +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 an 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: + +<<ex04>>= +(xNum2 <- unknownToNA(x=xNum, unknown=0)) +@ + +Prior to export from \R{}, we might want to change unknown values +(\code{NA} in \R{}) to some other value. Function \code{NAToUnknown} can be +used for this: + +<<ex05>>= +NAToUnknown(x=xNum2, unknown=999) +@ + +Converting \code{NA} to a value that already exists in \code{x} issues an +error, but \code{force=TRUE} can be used to overcome this if needed. But be +warned that there is no way back from this step: + +<<ex06>>= +NAToUnknown(x=xNum2, unknown=7, force=TRUE) +@ + +Examples below show all peculiarities with class \code{factor}. +\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 the +argument \code{unknown} in functions \code{isUnknown} and +\code{unknownToNA} need not match the class of \code{x} (otherwise factor +should be used) as the test is internally done with \code{\%in\%}, which +nicely resolves coercing issues. + +<<ex07>>= +(xFac <- factor(c(0, "BA", "RA", "BA", NA, "NA"))) +isUnknown(x=xFac) +isUnknown(x=xFac, unknown=0) +isUnknown(x=xFac, unknown=c(0, NA)) +isUnknown(x=xFac, unknown=c(0, "NA")) +isUnknown(x=xFac, unknown=c(0, "NA", NA)) + +(xFac <- unknownToNA(x=xFac, unknown=0)) +(xFac <- NAToUnknown(x=xFac, unknown=0)) +@ + +These two examples with classes \code{numeric} and \code{factor} are fairly +simple and we could get the same results with one or two lines of \R{} +code. The real benefit of the set of functions presented here 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 possibly having multiple unknown values that can be different among +\code{list} components or \code{data.frame} columns. For these two methods, +the 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 a \code{vector}/\code{list} object passed to the argument +\code{unknown} is not named, the first value/component of a +\code{vector}/\code{list} matches the first component/column of a +\code{list}/\code{data.frame}. This can be quite error prone, especially +with \code{vectors}. Therefore, I encourage the 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. + +The example below illustrates the application of the described functions to +a list which 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 an unknown value. Note that we +get \code{FALSE} for \code{NA}s as has been the case in the first example. + +<<ex08>>= +(xList <- list(a=xNum, b=xFac)) +isUnknown(x=xList, unknown=0) +@ + +We need to add \code{NA} as an unknown value. However, we do not get the +expected result this way! + +<<ex09>>= +isUnknown(x=xList, unknown=c(0, NA)) +@ + +This is due to matching of values in the 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 a \code{list} (preferably a named list) to the +argument \code{unknown}, as shown below. + +<<ex10>>= +(xList1 <- unknownToNA(x=xList, + unknown=list(b=c(0, "NA"), + a=0))) +@ + +Changing \code{NA}s to some other value (only one per component/column) can +be accomplished as follows: + +<<ex11>>= +NAToUnknown(x=xList1, + unknown=list(b="no", a=0)) +@ + +A named component \code{.default} of a \code{list} passed to argument +\code{unknown} has a special meaning as it will match a 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. Consider a wide \code{data.frame} named \code{df}. Now +\code{.default} can be used to define unknown value for several columns: + +<<ex12, echo=FALSE>>= +df <- data.frame(col1=c(0, 1, 999, 2), + col2=c("a", "b", "c", "unknown"), + col3=c(0, 1, 2, 3), + col4=c(0, 1, 2, 2)) +@ + +<<ex13>>= +tmp <- list(.default=0, + col1=999, + col2="unknown") +(df2 <- unknownToNA(x=df, + unknown=tmp)) +@ + +If there is a need to work only on some components/columns you can of +course ``skip'' columns with standard \R{} mechanisms, i.e., +by subsetting \code{list} or \code{data.frame} objects: + +<<ex14>>= +df2 <- df +cols <- c("col1", "col2") +tmp <- list(col1=999, + col2="unknown") +df2[, cols] <- unknownToNA(x=df[, cols], + unknown=tmp) +df2 +@ + +\section{Summary} + +Functions \code{isUnknown}, \code{unknownToNA} and \code{NAToUnknown} +provide a useful 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}, 7\penalty0 (1):\penalty0 24--26, 2007. +\newblock URL \url{http://CRAN.R-project.org/doc/Rnews/Rnews_2007-1.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...> - 2014-04-05 16:59:47
|
Revision: 1793 http://sourceforge.net/p/r-gregmisc/code/1793 Author: warnes Date: 2014-04-05 16:59:43 +0000 (Sat, 05 Apr 2014) Log Message: ----------- The issue Brian pointed out was an error in the isUnknown() code, not an error in the unit tests! Modified Paths: -------------- trunk/gdata/R/unknown.R trunk/gdata/tests/unitTests/runit.unknown.R Modified: trunk/gdata/R/unknown.R =================================================================== --- trunk/gdata/R/unknown.R 2014-04-05 15:55:48 UTC (rev 1792) +++ trunk/gdata/R/unknown.R 2014-04-05 16:59:43 UTC (rev 1793) @@ -29,7 +29,14 @@ } else { unknown <- as.character(x=unknown, ...) } - isUnknown.default(x=as.character(x), unknown=unknown) + + if(is.list(x) && !inherits(x=x, what="POSIXlt")) { + x <- lapply(x, FUN=as.character, ...) + } else { + x <- as.character(x=x, ...) + } + + isUnknown.default(x=as.character(x), unknown=as.character(unknown)) } isUnknown.list <- function(x, unknown=NA, ...) { Modified: trunk/gdata/tests/unitTests/runit.unknown.R =================================================================== --- trunk/gdata/tests/unitTests/runit.unknown.R 2014-04-05 15:55:48 UTC (rev 1792) +++ trunk/gdata/tests/unitTests/runit.unknown.R 2014-04-05 16:59:43 UTC (rev 1793) @@ -249,42 +249,7 @@ ## Date-time classes checkIdentical(isUnknown(xDateUnk, unknown=dateUnk), xDateTest) checkIdentical(isUnknown(xDate1Unk, unknown=dateUnk), xDate1Test) - - #### - ## Per Brian Ripley on 2014-01-15: - ## - ## On platforms where POSIXlt has a gmtoff component, it does not - ## need to be set. So - ## - ## > z$gmtoff - ## [1] 3600 NA - ## > xPOSIXltUnk$gmtoff - ## [1] 3600 3600 - ## - ## (or sometimes 0, not NA). - ## - ## So although identical() correctly reports that they differ, this - ## is allowed for optional components. - ## - ## It would also be wrong to use identical() to compare isdst - ## components: isdst = -1 means unknown. - ## - ## Replaced: - ## checkIdentical(isUnknown(xPOSIXltUnk, unknown=POSIXltUnk), xPOSIXltTest) - ## With: - tmp_isUnknown <- isUnknown(xPOSIXltUnk, unknown=POSIXltUnk) - tmp_xPOSIXltTest <- xPOSIXlt - - tmp_isUnknown$gmtoff <- NULL # Remove $gmtoff to avoid comparison - tmp_xPOSIXltTest$gmtoff <- NULL - - tmp_isUnknownisdst <- NULL # Remove $isdst to avoid comparison - tmp_xPOSIXltTest$isdst <- NULL - - checkIdentical(tmp_isUnknown, tmp_xPOSIXltTest) - ## - #### - + checkIdentical(isUnknown(xPOSIXltUnk, unknown=POSIXltUnk), xPOSIXltTest) checkIdentical(isUnknown(xPOSIXlt1Unk, unknown=POSIXltUnk), xPOSIXlt1Test) checkIdentical(isUnknown(xPOSIXctUnk, unknown=POSIXctUnk), xPOSIXctTest) checkIdentical(isUnknown(xPOSIXct1Unk, unknown=POSIXctUnk), xPOSIXct1Test) @@ -366,41 +331,9 @@ ## Date-time classes checkIdentical(unknownToNA(xDateUnk, unknown=dateUnk), xDate) + checkIdentical(unknownToNA(xPOSIXltUnk, unknown=POSIXltUnk), xPOSIXlt) checkIdentical(unknownToNA(xPOSIXctUnk, unknown=POSIXctUnk), xPOSIXct) - #### - ## Per Brian Ripley on 2014-01-15: - ## - ## On platforms where POSIXlt has a gmtoff component, it does not need to be set. So - ## - ## > z$gmtoff - ## [1] 3600 NA - ## > xPOSIXltUnk$gmtoff - ## [1] 3600 3600 - ## - ## (or sometimes 0, not NA). - ## - ## So although identical() correctly reports that they differ, this - ## is allowed for optional components. - ## - ## It would also be wrong to use identical() to compare isdst - ## components: isdst = -1 means unknown. - ## - ## Replaced: - ## checkIdentical(unknownToNA(xPOSIXltUnk, unknown=POSIXltUnk), xPOSIXlt) - ## With: - tmp_unknownToNA <- unknownToNA(xPOSIXltUnk, unknown=POSIXltUnk) - tmp_xPOSIXlt <- xPOSIXlt - - tmp_unknownToNA$gmtoff <- NULL # Remove $gmtoff to avoid comparison - tmp_xPOSIXlt$gmtoff <- NULL - - tmp_unknownToNA$isdst <- NULL # Remove $isdst to avoid comparison - tmp_xPOSIXlt$isdst <- NULL - - checkIdentical(tmp_unknownToNA, tmp_xPOSIXlt) - #### - ## --- lists and data.frames --- ## with vector of single unknown values This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2014-08-28 02:08:44
|
Revision: 1877 http://sourceforge.net/p/r-gregmisc/code/1877 Author: warnes Date: 2014-08-28 02:08:37 +0000 (Thu, 28 Aug 2014) Log Message: ----------- Update for release Modified Paths: -------------- trunk/gdata/DESCRIPTION trunk/gdata/inst/NEWS Modified: trunk/gdata/DESCRIPTION =================================================================== --- trunk/gdata/DESCRIPTION 2014-08-28 02:01:52 UTC (rev 1876) +++ trunk/gdata/DESCRIPTION 2014-08-28 02:08:37 UTC (rev 1877) @@ -4,8 +4,8 @@ Depends: R (>= 2.13.0) SystemRequirements: perl Imports: gtools -Version: 2.13.3 -Date: 2014-04-04 +Version: 2.14.0 +Date: 2014-08-27 Author: Gregory R. Warnes, Ben Bolker, Gregor Gorjanc, Gabor Grothendieck, Ales Korosec, Thomas Lumley, Don MacQueen, Arni Magnusson, Jim Rogers, and others Modified: trunk/gdata/inst/NEWS =================================================================== --- trunk/gdata/inst/NEWS 2014-08-28 02:01:52 UTC (rev 1876) +++ trunk/gdata/inst/NEWS 2014-08-28 02:08:37 UTC (rev 1877) @@ -1,12 +1,27 @@ +Changes in 2.14.0 (2014-08-27) +------------------------------ + +Bug Fixes: + +- read.xls() can now properly process XLSX files with up to 16385 columns (the + maximum generated by Microsoft Excel). + +Other changes: + +- Updated perl libraries and code underlying read.xls() to the latest + version, including switching from Spreadsheet::XLSX to + Spreadsheet::ParseXLSX. + + Changes in 2.13.3 (2014-04-04) ------------------------------ -Bug Fixes +Bug Fixes: - Unit tests were incorrectly checking for equality of optional POSIXlt components. (Bug reported by Brian Ripley). -Other Changes +Other Changes: - 'aggregate.table' is now defunct. See '?gdata-defunct' for details. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2014-08-28 05:17:33
|
Revision: 1881 http://sourceforge.net/p/r-gregmisc/code/1881 Author: warnes Date: 2014-08-28 05:17:28 +0000 (Thu, 28 Aug 2014) Log Message: ----------- Add tests and corresponding test files for 1900 and 1904 based XLX/XLSX files Modified Paths: -------------- trunk/gdata/tests/test.read.xls.R Added Paths: ----------- trunk/gdata/inst/xls/ExampleExcelFile_1900.xls trunk/gdata/inst/xls/ExampleExcelFile_1900.xlsx trunk/gdata/inst/xls/ExampleExcelFile_1904.xls trunk/gdata/inst/xls/ExampleExcelFile_1904.xlsx Added: trunk/gdata/inst/xls/ExampleExcelFile_1900.xls =================================================================== (Binary files differ) Index: trunk/gdata/inst/xls/ExampleExcelFile_1900.xls =================================================================== --- trunk/gdata/inst/xls/ExampleExcelFile_1900.xls 2014-08-28 04:56:57 UTC (rev 1880) +++ trunk/gdata/inst/xls/ExampleExcelFile_1900.xls 2014-08-28 05:17:28 UTC (rev 1881) Property changes on: trunk/gdata/inst/xls/ExampleExcelFile_1900.xls ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/vnd.ms-excel \ No newline at end of property Added: trunk/gdata/inst/xls/ExampleExcelFile_1900.xlsx =================================================================== (Binary files differ) Index: trunk/gdata/inst/xls/ExampleExcelFile_1900.xlsx =================================================================== --- trunk/gdata/inst/xls/ExampleExcelFile_1900.xlsx 2014-08-28 04:56:57 UTC (rev 1880) +++ trunk/gdata/inst/xls/ExampleExcelFile_1900.xlsx 2014-08-28 05:17:28 UTC (rev 1881) Property changes on: trunk/gdata/inst/xls/ExampleExcelFile_1900.xlsx ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/vnd.openxmlformats-officedocument.spreadsheetml.sheet \ No newline at end of property Added: trunk/gdata/inst/xls/ExampleExcelFile_1904.xls =================================================================== (Binary files differ) Index: trunk/gdata/inst/xls/ExampleExcelFile_1904.xls =================================================================== --- trunk/gdata/inst/xls/ExampleExcelFile_1904.xls 2014-08-28 04:56:57 UTC (rev 1880) +++ trunk/gdata/inst/xls/ExampleExcelFile_1904.xls 2014-08-28 05:17:28 UTC (rev 1881) Property changes on: trunk/gdata/inst/xls/ExampleExcelFile_1904.xls ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/vnd.ms-excel \ No newline at end of property Added: trunk/gdata/inst/xls/ExampleExcelFile_1904.xlsx =================================================================== (Binary files differ) Index: trunk/gdata/inst/xls/ExampleExcelFile_1904.xlsx =================================================================== --- trunk/gdata/inst/xls/ExampleExcelFile_1904.xlsx 2014-08-28 04:56:57 UTC (rev 1880) +++ trunk/gdata/inst/xls/ExampleExcelFile_1904.xlsx 2014-08-28 05:17:28 UTC (rev 1881) Property changes on: trunk/gdata/inst/xls/ExampleExcelFile_1904.xlsx ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/vnd.openxmlformats-officedocument.spreadsheetml.sheet \ No newline at end of property Modified: trunk/gdata/tests/test.read.xls.R =================================================================== --- trunk/gdata/tests/test.read.xls.R 2014-08-28 04:56:57 UTC (rev 1880) +++ trunk/gdata/tests/test.read.xls.R 2014-08-28 05:17:28 UTC (rev 1881) @@ -110,3 +110,22 @@ example.wide.x <- read.xls(wideFileX) stopifnot(dim(example.wide.x)==c(0,16384)) } + +## Check handling of files with dates calulcated relative to +## 1900-01-01 and 1904-01-01 + +file.1900 <- file.path(path.package('gdata'),'xls', 'ExampleExcelFile_1900.xls') +file.1904 <- file.path(path.package('gdata'),'xls', 'ExampleExcelFile_1904.xls') + +example.1900 <- read.xls(file.1900, sheet=3) +example.1904 <- read.xls(file.1904, sheet=3) + +stopifnot( na.omit(example.1900 == example.1904) ) + +fileX.1900 <- file.path(path.package('gdata'),'xls', 'ExampleExcelFile_1900.xlsx') +fileX.1904 <- file.path(path.package('gdata'),'xls', 'ExampleExcelFile_1904.xlsx') + +exampleX.1900 <- read.xls(file.1900, sheet=3) +exampleX.1904 <- read.xls(file.1904, sheet=3) + +stopifnot( na.omit(exampleX.1900 == exampleX.1904) ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2014-08-28 15:01:54
|
Revision: 1883 http://sourceforge.net/p/r-gregmisc/code/1883 Author: warnes Date: 2014-08-28 15:01:51 +0000 (Thu, 28 Aug 2014) Log Message: ----------- Everything works now! Modified Paths: -------------- trunk/gdata/R/trim.R trunk/gdata/inst/NEWS trunk/gdata/inst/perl/xls2csv.pl trunk/gdata/inst/xls/ExampleExcelFile.xls trunk/gdata/inst/xls/ExampleExcelFile.xlsx trunk/gdata/inst/xls/ExampleExcelFile_1900.xls trunk/gdata/inst/xls/ExampleExcelFile_1900.xlsx trunk/gdata/inst/xls/ExampleExcelFile_1904.xls trunk/gdata/inst/xls/ExampleExcelFile_1904.xlsx trunk/gdata/tests/test.read.xls.R trunk/gdata/tests/test.read.xls.Rout.save trunk/gdata/tests/tests.write.fwf.Rout.save Modified: trunk/gdata/R/trim.R =================================================================== --- trunk/gdata/R/trim.R 2014-08-28 05:22:50 UTC (rev 1882) +++ trunk/gdata/R/trim.R 2014-08-28 15:01:51 UTC (rev 1883) @@ -19,7 +19,7 @@ if(recode.factor) { dots <- list(x=s, ...) if(is.null(dots$sort)) dots$sort <- sort - s <- do.call(what=reorder.factor, args=dots) + s <- do.call(what="reorder.factor", args=dots) } s } Modified: trunk/gdata/inst/NEWS =================================================================== --- trunk/gdata/inst/NEWS 2014-08-28 05:22:50 UTC (rev 1882) +++ trunk/gdata/inst/NEWS 2014-08-28 15:01:51 UTC (rev 1883) @@ -6,6 +6,10 @@ - read.xls() can now properly process XLSX files with up to 16385 columns (the maximum generated by Microsoft Excel). +- read.xls() now properly handles XLS/XLSX files that use 1904-01-01 + as the reference value for dates instead of 1900-01-01 (the + default for MS-Excel files created on the Mac). + Other changes: - Updated perl libraries and code underlying read.xls() to the latest Modified: trunk/gdata/inst/perl/xls2csv.pl =================================================================== --- trunk/gdata/inst/perl/xls2csv.pl 2014-08-28 05:22:50 UTC (rev 1882) +++ trunk/gdata/inst/perl/xls2csv.pl 2014-08-28 15:01:51 UTC (rev 1883) @@ -27,9 +27,10 @@ my($row, $col, $sheet, $cell, $usage, $targetfile,$basename, $sheetnumber, $filename, $volume, $directories, $whoami, - $sep, $sepName, $sepLabel, $sepExt, + $sep, $sepName, $sepLabel, $sepExt, $skipBlankLines, %switches, - $parser, $oBook, $formatter + $parser, $oBook, $formatter, + $using_1904_date ); ## @@ -141,6 +142,7 @@ open(FH, "<$ARGV[0]") or die "Unable to open file '$ARGV[0]'.\n"; close(FH); +print "\n"; print "Loading '$ARGV[0]'...\n"; ## First try as a Excel 2007+ 'xml' file eval @@ -158,9 +160,26 @@ } print "Done.\n"; +## Does this file use 1904-01-01 as the reference date instead of +## 1900-01-01? +$using_1904_date = ( $oBook->using_1904_date() == 1 ) || # ParseExcel + ( $oBook->{Flag1904} == 1 ); # ParseXLSX + + +## Show the user some summary information before we start extracting +## date print "\n"; print "Orignal Filename: ", $ARGV[0], "\n"; print "Number of Sheets: ", $oBook->{SheetCount} , "\n"; +if($using_1904_date) + { + print "Date reference : 1904-01-01\n"; + } +else + { + print "Date reference : 1900-01-01\n"; + } + print "\n"; ## Get list all worksheets in the file @@ -245,14 +264,35 @@ my $format = $formatter->FmtString($cell, $oBook); if( defined($cell) ) { - if ($cell->type() eq "Date" && $oBook->{Flag1904} ) + if ($cell->type() eq "Date") # && $using_1904_date ) { + my $is_date = ( $format =~ m/y/ && + $format =~ m/m/ && + $format =~ m/d/ ); + + my $is_time = ( $format =~ m/h[:\]]*m/ || + $format =~ m/m[:\]]*s/ ); + + + if($is_date && $is_time) + { + $format = "yyyy-mm-dd hh:mm:ss.00"; + } + elsif ($is_date) + { + $format = "yyyy-mm-dd"; + } + elsif ($is_time) + { + $format = "hh:mm:ss.00" + } + $_ = ExcelFmt($format, $cell->unformatted(), - $oBook->{Flag1904}); + $using_1904_date); } else - { + { $_=$cell->value(); } @@ -266,7 +306,7 @@ # they are used as field delimiters s/\"/\\\"/g; } - else + else { $_ = ''; } @@ -291,7 +331,7 @@ close OutFile; - print " (Ignored $cumulativeBlankLines blank lines.)\n" + print " (Ignored $cumulativeBlankLines blank lines.)\n" if $skipBlankLines; print "\n"; } Modified: trunk/gdata/inst/xls/ExampleExcelFile.xls =================================================================== (Binary files differ) Modified: trunk/gdata/inst/xls/ExampleExcelFile.xlsx =================================================================== (Binary files differ) Modified: trunk/gdata/inst/xls/ExampleExcelFile_1900.xls =================================================================== (Binary files differ) Modified: trunk/gdata/inst/xls/ExampleExcelFile_1900.xlsx =================================================================== (Binary files differ) Modified: trunk/gdata/inst/xls/ExampleExcelFile_1904.xls =================================================================== (Binary files differ) Modified: trunk/gdata/inst/xls/ExampleExcelFile_1904.xlsx =================================================================== (Binary files differ) Modified: trunk/gdata/tests/test.read.xls.R =================================================================== --- trunk/gdata/tests/test.read.xls.R 2014-08-28 05:22:50 UTC (rev 1882) +++ trunk/gdata/tests/test.read.xls.R 2014-08-28 15:01:51 UTC (rev 1883) @@ -23,19 +23,19 @@ exampleFile <- file.path(path.package('gdata'),'xls', 'ExampleExcelFile.xls') -exampleFile2007 <- file.path(path.package('gdata'),'xls', +exampleFileX <- file.path(path.package('gdata'),'xls', 'ExampleExcelFile.xlsx') # see the number and names of sheets: sheetCount(exampleFile) if( 'XLSX' %in% xlsFormats() ) - sheetCount(exampleFile2007) + sheetCount(exampleFileX) sheetNames(exampleFile) if( 'XLSX' %in% xlsFormats() ) - sheetNames(exampleFile2007) + sheetNames(exampleFileX) example.1 <- read.xls(exampleFile, sheet=1) # default is first worksheet example.1 @@ -46,28 +46,28 @@ example.3 <- read.xls(exampleFile, sheet=3, header=FALSE) # third worksheet by number example.3 -example.4 <- read.xls(exampleFile, sheet=3, header=FALSE) # third worksheet by number +example.4 <- read.xls(exampleFile, sheet=4, header=FALSE) # fourth worksheet by number example.4 if( 'XLSX' %in% xlsFormats() ) { - example.x.1 <- read.xls(exampleFile2007, sheet=1) # default is first worksheet + example.x.1 <- read.xls(exampleFileX, sheet=1) # default is first worksheet print(example.x.1) - example.x.2 <- read.xls(exampleFile2007, sheet=2) # second worksheet by number + example.x.2 <- read.xls(exampleFileX, sheet=2) # second worksheet by number print(example.x.2) - example.x.3 <- read.xls(exampleFile2007, sheet=3, header=FALSE) # third worksheet by number + example.x.3 <- read.xls(exampleFileX, sheet=3, header=FALSE) # third worksheet by number print(example.x.3) - example.x.4 <- read.xls(exampleFile2007, sheet=3, header=FALSE) # third worksheet by number + example.x.4 <- read.xls(exampleFileX, sheet=4, header=FALSE) # fourth worksheet by number print(example.x.4) - data <- read.xls(exampleFile2007, sheet="Sheet Second") # and by name + data <- read.xls(exampleFileX, sheet="Sheet Second") # and by name print(data) # load the third worksheet, skipping the first two non-data lines... - data <- read.xls(exampleFile2007, sheet="Sheet with initial text", skip=2) + data <- read.xls(exampleFileX, sheet="Sheet with initial text", skip=2) print(data) } @@ -79,7 +79,7 @@ if( 'XLSX' %in% xlsFormats() ) { - example.x.skip <- read.xls(exampleFile2007, sheet=2, blank.lines.skip=FALSE) + example.x.skip <- read.xls(exampleFileX, sheet=2, blank.lines.skip=FALSE) example.x.skip } @@ -114,18 +114,30 @@ ## Check handling of files with dates calulcated relative to ## 1900-01-01 and 1904-01-01 -file.1900 <- file.path(path.package('gdata'),'xls', 'ExampleExcelFile_1900.xls') -file.1904 <- file.path(path.package('gdata'),'xls', 'ExampleExcelFile_1904.xls') +file.1900 <- file.path(path.package('gdata'),'xls', 'ExampleExcelFile_1900.xls' ) +file.1904 <- file.path(path.package('gdata'),'xls', 'ExampleExcelFile_1904.xls' ) +fileX.1900 <- file.path(path.package('gdata'),'xls', 'ExampleExcelFile_1900.xlsx') +fileX.1904 <- file.path(path.package('gdata'),'xls', 'ExampleExcelFile_1904.xlsx') -example.1900 <- read.xls(file.1900, sheet=3) -example.1904 <- read.xls(file.1904, sheet=3) +example.1900 <- read.xls(file.1900, sheet=3, header=FALSE) +example.1900 -stopifnot( na.omit(example.1900 == example.1904) ) +example.1904 <- read.xls(file.1904, sheet=3, header=FALSE) +example.1904 -fileX.1900 <- file.path(path.package('gdata'),'xls', 'ExampleExcelFile_1900.xlsx') -fileX.1904 <- file.path(path.package('gdata'),'xls', 'ExampleExcelFile_1904.xlsx') +exampleX.1900 <- read.xls(file.1900, sheet=3, header=FALSE) +exampleX.1900 -exampleX.1900 <- read.xls(file.1900, sheet=3) -exampleX.1904 <- read.xls(file.1904, sheet=3) +exampleX.1904 <- read.xls(file.1904, sheet=3, header=FALSE) +exampleX.1904 -stopifnot( na.omit(exampleX.1900 == exampleX.1904) ) +# all colmns should be identical +stopifnot( na.omit(example.1900 == exampleX.1900) ) +stopifnot( na.omit(example.1904 == exampleX.1904) ) + +# column 8 will differ by 1462 due to different date baselines (1900 vs 1904) +stopifnot( na.omit(example.1900 [,-8] == example.1904 [,-8]) ) +stopifnot( na.omit(exampleX.1900[,-8] == exampleX.1904[,-8]) ) + +stopifnot( na.omit(example.1900 [,8] - example.1904 [,8]) == 1462 ) +stopifnot( na.omit(exampleX.1900[,8] - exampleX.1904[,8]) == 1462 ) Modified: trunk/gdata/tests/test.read.xls.Rout.save =================================================================== --- trunk/gdata/tests/test.read.xls.Rout.save 2014-08-28 05:22:50 UTC (rev 1882) +++ trunk/gdata/tests/test.read.xls.Rout.save 2014-08-28 15:01:51 UTC (rev 1883) @@ -1,7 +1,7 @@ -R version 3.0.1 (2013-05-16) -- "Good Sport" -Copyright (C) 2013 The R Foundation for Statistical Computing -Platform: i686-pc-linux-gnu (32-bit) +R version 3.1.0 Patched (2014-05-26 r65771) -- "Spring Dance" +Copyright (C) 2014 The R Foundation for Statistical Computing +Platform: x86_64-apple-darwin13.1.0 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. @@ -507,7 +507,7 @@ > exampleFile <- file.path(path.package('gdata'),'xls', + 'ExampleExcelFile.xls') > -> exampleFile2007 <- file.path(path.package('gdata'),'xls', +> exampleFileX <- file.path(path.package('gdata'),'xls', + 'ExampleExcelFile.xlsx') > > # see the number and names of sheets: @@ -515,7 +515,7 @@ [1] 4 > > if( 'XLSX' %in% xlsFormats() ) -+ sheetCount(exampleFile2007) ++ sheetCount(exampleFileX) [1] 4 > > sheetNames(exampleFile) @@ -523,7 +523,7 @@ [3] "Sheet with a very long name!" "Sheet with initial text" > > if( 'XLSX' %in% xlsFormats() ) -+ sheetNames(exampleFile2007) ++ sheetNames(exampleFileX) [1] "Sheet First" "Sheet Second" [3] "Sheet with a very long name!" "Sheet with initial text" > @@ -548,51 +548,67 @@ > > example.3 <- read.xls(exampleFile, sheet=3, header=FALSE) # third worksheet by number > example.3 - V1 V2 V3 V4 V5 V6 -1 1 2001-01-01 1:01 0.2058182 NA A -2 2 2002-02-02 2:02 0.2910708 NA B -3 3 2003-03-03 3:03 0.3564875 -0.84147098 C -4 4 2004-04-04 4:04 0.4116363 0.70807342 -5 5 2005-05-05 5:05 0.4602234 0.50136797 A -6 6 2006-06-06 6:06 NA 0.25136984 B -7 7 2007-07-07 7:07 0.5445436 0.06318679 B -8 8 2008-08-08 8:08 0.5821416 NA C -9 9 2009-09-09 9:09 0.6174545 0.00000000 A -10 10 2010-10-10 10:10 0.6508541 0.00000000 A + V1 V2 V3 V4 V5 V6 V7 +1 1 2001-01-01 01:01:00.00 0.2058182 NA A 2001-01-01 01:01:01.01 +2 2 2002-02-02 02:02:00.00 0.2910708 NA B 2002-02-02 02:02:02.02 +3 3 2003-03-03 03:03:00.00 0.3564875 -0.84147098 C 2003-03-03 03:03:03.03 +4 4 2004-04-04 04:04:00.00 0.4116363 0.70807342 2004-04-04 04:04:04.04 +5 5 2005-05-05 05:05:00.00 0.4602234 0.50136797 A 2005-05-05 05:05:05.05 +6 6 2006-06-06 06:06:00.00 NA 0.25136984 B 2006-06-06 06:06:06.06 +7 7 2007-07-07 07:07:00.00 0.5445436 0.06318679 B 2007-07-07 07:07:07.07 +8 8 2008-08-08 08:08:00.00 0.5821416 NA C 2008-08-08 08:08:08.08 +9 9 2009-09-09 09:09:00.00 0.6174545 0.00000000 A 2009-09-09 09:09:09.09 +10 10 2010-10-10 10:10:00.00 0.6508541 0.00000000 A 2010-10-10 10:10:10.10 + V8 +1 36892.04 +2 37289.08 +3 37683.13 +4 38081.17 +5 38477.21 +6 38874.25 +7 39270.30 +8 39668.34 +9 40065.38 +10 40461.42 > -> example.4 <- read.xls(exampleFile, sheet=3, header=FALSE) # third worksheet by number +> example.4 <- read.xls(exampleFile, sheet=4, header=FALSE) # fourth worksheet by number > example.4 - V1 V2 V3 V4 V5 V6 -1 1 2001-01-01 1:01 0.2058182 NA A -2 2 2002-02-02 2:02 0.2910708 NA B -3 3 2003-03-03 3:03 0.3564875 -0.84147098 C -4 4 2004-04-04 4:04 0.4116363 0.70807342 -5 5 2005-05-05 5:05 0.4602234 0.50136797 A -6 6 2006-06-06 6:06 NA 0.25136984 B -7 7 2007-07-07 7:07 0.5445436 0.06318679 B -8 8 2008-08-08 8:08 0.5821416 NA C -9 9 2009-09-09 9:09 0.6174545 0.00000000 A -10 10 2010-10-10 10:10 0.6508541 0.00000000 A + V1 +1 This line contains text that would need to be skipped to get to the data +2 +3 +4 +5 +6 +7 + V2 V3 V4 V5 V6 V7 +1 +2 This line too! +3 D E F G Factor +4 FirstRow 1 <NA> <NA> <NA> Red +5 SecondRow 2 1 <NA> <NA> Green +6 ThirdRow 3 2 1 <NA> Red +7 FourthRow 4 3 2 1 Black > > if( 'XLSX' %in% xlsFormats() ) + { -+ example.x.1 <- read.xls(exampleFile2007, sheet=1) # default is first worksheet ++ example.x.1 <- read.xls(exampleFileX, sheet=1) # default is first worksheet + print(example.x.1) + -+ example.x.2 <- read.xls(exampleFile2007, sheet=2) # second worksheet by number ++ example.x.2 <- read.xls(exampleFileX, sheet=2) # second worksheet by number + print(example.x.2) + -+ example.x.3 <- read.xls(exampleFile2007, sheet=3, header=FALSE) # third worksheet by number ++ example.x.3 <- read.xls(exampleFileX, sheet=3, header=FALSE) # third worksheet by number + print(example.x.3) + -+ example.x.4 <- read.xls(exampleFile2007, sheet=3, header=FALSE) # third worksheet by number ++ example.x.4 <- read.xls(exampleFileX, sheet=4, header=FALSE) # fourth worksheet by number + print(example.x.4) + -+ data <- read.xls(exampleFile2007, sheet="Sheet Second") # and by name ++ data <- read.xls(exampleFileX, sheet="Sheet Second") # and by name + print(data) + + # load the third worksheet, skipping the first two non-data lines... -+ data <- read.xls(exampleFile2007, sheet="Sheet with initial text", skip=2) ++ data <- read.xls(exampleFileX, sheet="Sheet with initial text", skip=2) + print(data) + } A B C @@ -608,28 +624,44 @@ 2 SecondRow 2 1 NA NA Green 3 ThirdRow 3 2 1 NA Red 4 FourthRow 4 3 2 1 Black - V1 V2 V3 V4 V5 V6 -1 1 2001-01-01 1:01 0.2058182 NA A -2 2 2002-02-02 2:02 0.2910708 NA B -3 3 2003-03-03 3:03 0.3564875 -0.84147098 C -4 4 2004-04-04 4:04 0.4116363 0.70807342 -5 5 2005-05-05 5:05 0.4602234 0.50136797 A -6 6 2006-06-06 6:06 NA 0.25136984 B -7 7 2007-07-07 7:07 0.5445436 0.06318679 B -8 8 2008-08-08 8:08 0.5821416 NA C -9 9 2009-09-09 9:09 0.6174545 0.00000000 A -10 10 2010-10-10 10:10 0.6508541 0.00000000 A - V1 V2 V3 V4 V5 V6 -1 1 2001-01-01 1:01 0.2058182 NA A -2 2 2002-02-02 2:02 0.2910708 NA B -3 3 2003-03-03 3:03 0.3564875 -0.84147098 C -4 4 2004-04-04 4:04 0.4116363 0.70807342 -5 5 2005-05-05 5:05 0.4602234 0.50136797 A -6 6 2006-06-06 6:06 NA 0.25136984 B -7 7 2007-07-07 7:07 0.5445436 0.06318679 B -8 8 2008-08-08 8:08 0.5821416 NA C -9 9 2009-09-09 9:09 0.6174545 0.00000000 A -10 10 2010-10-10 10:10 0.6508541 0.00000000 A + V1 V2 V3 V4 V5 V6 V7 +1 1 2001-01-01 01:01:00.00 0.2058182 NA A 2001-01-01 01:01:01.01 +2 2 2002-02-02 02:02:00.00 0.2910708 NA B 2002-02-02 02:02:02.02 +3 3 2003-03-03 03:03:00.00 0.3564875 -0.84147098 C 2003-03-03 03:03:03.03 +4 4 2004-04-04 04:04:00.00 0.4116363 0.70807342 2004-04-04 04:04:04.04 +5 5 2005-05-05 05:05:00.00 0.4602234 0.50136797 A 2005-05-05 05:05:05.05 +6 6 2006-06-06 06:06:00.00 NA 0.25136984 B 2006-06-06 06:06:06.06 +7 7 2007-07-07 07:07:00.00 0.5445436 0.06318679 B 2007-07-07 07:07:07.07 +8 8 2008-08-08 08:08:00.00 0.5821416 NA C 2008-08-08 08:08:08.08 +9 9 2009-09-09 09:09:00.00 0.6174545 0.00000000 A 2009-09-09 09:09:09.09 +10 10 2010-10-10 10:10:00.00 0.6508541 0.00000000 A 2010-10-10 10:10:10.10 + V8 +1 36892.04 +2 37289.08 +3 37683.13 +4 38081.17 +5 38477.21 +6 38874.25 +7 39270.30 +8 39668.34 +9 40065.38 +10 40461.42 + V1 +1 This line contains text that would need to be skipped to get to the data +2 +3 +4 +5 +6 +7 + V2 V3 V4 V5 V6 V7 +1 +2 This line too! +3 D E F G Factor +4 FirstRow 1 <NA> <NA> <NA> Red +5 SecondRow 2 1 <NA> <NA> Green +6 ThirdRow 3 2 1 <NA> Red +7 FourthRow 4 3 2 1 Black X D E. F G Factor 1 FirstRow 1 NA NA NA Red 2 SecondRow 2 1 NA NA Green @@ -655,7 +687,7 @@ > > if( 'XLSX' %in% xlsFormats() ) + { -+ example.x.skip <- read.xls(exampleFile2007, sheet=2, blank.lines.skip=FALSE) ++ example.x.skip <- read.xls(exampleFileX, sheet=2, blank.lines.skip=FALSE) + example.x.skip + } X D E. F G Factor @@ -668,7 +700,7 @@ > > ## Check handing of fileEncoding for latin-1 characters > -> latin1File <- file.path(path.package('gdata'),'xls', 'latin-1.xls') +> latin1File <- file.path(path.package('gdata'),'xls', 'latin-1.xls' ) > latin1FileX <- file.path(path.package('gdata'),'xls', 'latin-1.xlsx') > > example.latin1 <- read.xls(latin1File, fileEncoding='latin1') @@ -679,7 +711,139 @@ + } > > +> ## Check handling of very wide file > +> wideFile <- file.path(path.package('gdata'),'xls', 'wide.xls' ) +> wideFileX <- file.path(path.package('gdata'),'xls', 'wide.xlsx') +> +> example.wide <- read.xls(wideFile) +> stopifnot(dim(example.wide)==c(0,256)) +> +> if( 'XLSX' %in% xlsFormats() ) ++ { ++ example.wide.x <- read.xls(wideFileX) ++ stopifnot(dim(example.wide.x)==c(0,16384)) ++ } +> +> ## Check handling of files with dates calulcated relative to +> ## 1900-01-01 and 1904-01-01 +> +> file.1900 <- file.path(path.package('gdata'),'xls', 'ExampleExcelFile_1900.xls' ) +> file.1904 <- file.path(path.package('gdata'),'xls', 'ExampleExcelFile_1904.xls' ) +> fileX.1900 <- file.path(path.package('gdata'),'xls', 'ExampleExcelFile_1900.xlsx') +> fileX.1904 <- file.path(path.package('gdata'),'xls', 'ExampleExcelFile_1904.xlsx') +> +> example.1900 <- read.xls(file.1900, sheet=3, header=FALSE) +> example.1900 + V1 V2 V3 V4 V5 V6 V7 +1 1 2001-01-01 01:01:00.00 0.2058182 NA A 2001-01-01 01:01:01.01 +2 2 2002-02-02 02:02:00.00 0.2910708 NA B 2002-02-02 02:02:02.02 +3 3 2003-03-03 03:03:00.00 0.3564875 -0.84147098 C 2003-03-03 03:03:03.03 +4 4 2004-04-04 04:04:00.00 0.4116363 0.70807342 2004-04-04 04:04:04.04 +5 5 2005-05-05 05:05:00.00 0.4602234 0.50136797 A 2005-05-05 05:05:05.05 +6 6 2006-06-06 06:06:00.00 NA 0.25136984 B 2006-06-06 06:06:06.06 +7 7 2007-07-07 07:07:00.00 0.5445436 0.06318679 B 2007-07-07 07:07:07.07 +8 8 2008-08-08 08:08:00.00 0.5821416 NA C 2008-08-08 08:08:08.08 +9 9 2009-09-09 09:09:00.00 0.6174545 0.00000000 A 2009-09-09 09:09:09.09 +10 10 2010-10-10 10:10:00.00 0.6508541 0.00000000 A 2010-10-10 10:10:10.10 + V8 +1 36892.04 +2 37289.08 +3 37683.13 +4 38081.17 +5 38477.21 +6 38874.25 +7 39270.30 +8 39668.34 +9 40065.38 +10 40461.42 +> +> example.1904 <- read.xls(file.1904, sheet=3, header=FALSE) +> example.1904 + V1 V2 V3 V4 V5 V6 V7 +1 1 2001-01-01 01:01:00.00 0.2058182 NA A 2001-01-01 01:01:01.01 +2 2 2002-02-02 02:02:00.00 0.2910708 NA B 2002-02-02 02:02:02.02 +3 3 2003-03-03 03:03:00.00 0.3564875 -0.84147098 C 2003-03-03 03:03:03.03 +4 4 2004-04-04 04:04:00.00 0.4116363 0.70807342 2004-04-04 04:04:04.04 +5 5 2005-05-05 05:05:00.00 0.4602234 0.50136797 A 2005-05-05 05:05:05.05 +6 6 2006-06-06 06:06:00.00 NA 0.25136984 B 2006-06-06 06:06:06.06 +7 7 2007-07-07 07:07:00.00 0.5445436 0.06318679 B 2007-07-07 07:07:07.07 +8 8 2008-08-08 08:08:00.00 0.5821416 NA C 2008-08-08 08:08:08.08 +9 9 2009-09-09 09:09:00.00 0.6174545 0.00000000 A 2009-09-09 09:09:09.09 +10 10 2010-10-10 10:10:00.00 0.6508541 0.00000000 A 2010-10-10 10:10:10.10 + V8 +1 35430.04 +2 35827.08 +3 36221.13 +4 36619.17 +5 37015.21 +6 37412.25 +7 37808.30 +8 38206.34 +9 38603.38 +10 38999.42 +> +> exampleX.1900 <- read.xls(file.1900, sheet=3, header=FALSE) +> exampleX.1900 + V1 V2 V3 V4 V5 V6 V7 +1 1 2001-01-01 01:01:00.00 0.2058182 NA A 2001-01-01 01:01:01.01 +2 2 2002-02-02 02:02:00.00 0.2910708 NA B 2002-02-02 02:02:02.02 +3 3 2003-03-03 03:03:00.00 0.3564875 -0.84147098 C 2003-03-03 03:03:03.03 +4 4 2004-04-04 04:04:00.00 0.4116363 0.70807342 2004-04-04 04:04:04.04 +5 5 2005-05-05 05:05:00.00 0.4602234 0.50136797 A 2005-05-05 05:05:05.05 +6 6 2006-06-06 06:06:00.00 NA 0.25136984 B 2006-06-06 06:06:06.06 +7 7 2007-07-07 07:07:00.00 0.5445436 0.06318679 B 2007-07-07 07:07:07.07 +8 8 2008-08-08 08:08:00.00 0.5821416 NA C 2008-08-08 08:08:08.08 +9 9 2009-09-09 09:09:00.00 0.6174545 0.00000000 A 2009-09-09 09:09:09.09 +10 10 2010-10-10 10:10:00.00 0.6508541 0.00000000 A 2010-10-10 10:10:10.10 + V8 +1 36892.04 +2 37289.08 +3 37683.13 +4 38081.17 +5 38477.21 +6 38874.25 +7 39270.30 +8 39668.34 +9 40065.38 +10 40461.42 +> +> exampleX.1904 <- read.xls(file.1904, sheet=3, header=FALSE) +> exampleX.1904 + V1 V2 V3 V4 V5 V6 V7 +1 1 2001-01-01 01:01:00.00 0.2058182 NA A 2001-01-01 01:01:01.01 +2 2 2002-02-02 02:02:00.00 0.2910708 NA B 2002-02-02 02:02:02.02 +3 3 2003-03-03 03:03:00.00 0.3564875 -0.84147098 C 2003-03-03 03:03:03.03 +4 4 2004-04-04 04:04:00.00 0.4116363 0.70807342 2004-04-04 04:04:04.04 +5 5 2005-05-05 05:05:00.00 0.4602234 0.50136797 A 2005-05-05 05:05:05.05 +6 6 2006-06-06 06:06:00.00 NA 0.25136984 B 2006-06-06 06:06:06.06 +7 7 2007-07-07 07:07:00.00 0.5445436 0.06318679 B 2007-07-07 07:07:07.07 +8 8 2008-08-08 08:08:00.00 0.5821416 NA C 2008-08-08 08:08:08.08 +9 9 2009-09-09 09:09:00.00 0.6174545 0.00000000 A 2009-09-09 09:09:09.09 +10 10 2010-10-10 10:10:00.00 0.6508541 0.00000000 A 2010-10-10 10:10:10.10 + V8 +1 35430.04 +2 35827.08 +3 36221.13 +4 36619.17 +5 37015.21 +6 37412.25 +7 37808.30 +8 38206.34 +9 38603.38 +10 38999.42 +> +> # all colmns should be identical +> stopifnot( na.omit(example.1900 == exampleX.1900) ) +> stopifnot( na.omit(example.1904 == exampleX.1904) ) +> +> # column 8 will differ by 1462 due to different date baselines (1900 vs 1904) +> stopifnot( na.omit(example.1900 [,-8] == example.1904 [,-8]) ) +> stopifnot( na.omit(exampleX.1900[,-8] == exampleX.1904[,-8]) ) +> +> stopifnot( na.omit(example.1900 [,8] - example.1904 [,8]) == 1462 ) +> stopifnot( na.omit(exampleX.1900[,8] - exampleX.1904[,8]) == 1462 ) +> > proc.time() user system elapsed - 10.072 1.468 12.094 + 12.406 0.727 13.299 Modified: trunk/gdata/tests/tests.write.fwf.Rout.save =================================================================== --- trunk/gdata/tests/tests.write.fwf.Rout.save 2014-08-28 05:22:50 UTC (rev 1882) +++ trunk/gdata/tests/tests.write.fwf.Rout.save 2014-08-28 15:01:51 UTC (rev 1883) @@ -1,7 +1,7 @@ -R version 3.0.1 (2013-05-16) -- "Good Sport" -Copyright (C) 2013 The R Foundation for Statistical Computing -Platform: i686-pc-linux-gnu (32-bit) +R version 3.1.0 Patched (2014-05-26 r65771) -- "Spring Dance" +Copyright (C) 2014 The R Foundation for Statistical Computing +Platform: x86_64-apple-darwin13.1.0 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. @@ -231,4 +231,4 @@ > > proc.time() user system elapsed - 1.464 0.152 1.631 + 0.388 0.041 0.422 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2015-04-10 03:15:49
|
Revision: 1922 http://sourceforge.net/p/r-gregmisc/code/1922 Author: warnes Date: 2015-04-10 03:15:42 +0000 (Fri, 10 Apr 2015) Log Message: ----------- Update files for gdata 2.15.0 Modified Paths: -------------- trunk/gdata/DESCRIPTION trunk/gdata/NAMESPACE trunk/gdata/inst/NEWS Modified: trunk/gdata/DESCRIPTION =================================================================== --- trunk/gdata/DESCRIPTION 2015-04-09 19:46:55 UTC (rev 1921) +++ trunk/gdata/DESCRIPTION 2015-04-10 03:15:42 UTC (rev 1922) @@ -1,11 +1,11 @@ Package: gdata -Title: Various R programming tools for data manipulation +Title: Various R Programming Tools for Data Manipulation Description: Various R programming tools for data manipulation Depends: R (>= 2.13.0) SystemRequirements: perl Imports: gtools -Version: 2.14.0 -Date: 2014-08-27 +Version: 2.15.0 +Date: 2015-04-06 Author: Gregory R. Warnes, Ben Bolker, Gregor Gorjanc, Gabor Grothendieck, Ales Korosec, Thomas Lumley, Don MacQueen, Arni Magnusson, Jim Rogers, and others Modified: trunk/gdata/NAMESPACE =================================================================== --- trunk/gdata/NAMESPACE 2015-04-09 19:46:55 UTC (rev 1921) +++ trunk/gdata/NAMESPACE 2015-04-10 03:15:42 UTC (rev 1922) @@ -14,11 +14,14 @@ duplicated2, elem, env, + first, frameApply, installXLSXsupport, interleave, is.what, keep, + last, + left, ll, ls.funs, lowerTriangle, @@ -31,6 +34,7 @@ remove.vars, reorder.factor, resample, + right, sheetCount, sheetNames, startsWith, @@ -151,3 +155,13 @@ S3method(trim, factor) S3method(trim, list) S3method(trim, data.frame) + +## first, last, left, right +S3method(first, default) +S3method(first, list ) +S3method(last, default) +S3method(last, list ) +S3method(left, data.frame) +S3method(left, matrix) +S3method(right, data.frame) +S3method(right, matrix) Modified: trunk/gdata/inst/NEWS =================================================================== --- trunk/gdata/inst/NEWS 2015-04-09 19:46:55 UTC (rev 1921) +++ trunk/gdata/inst/NEWS 2015-04-10 03:15:42 UTC (rev 1922) @@ -1,3 +1,15 @@ +Changes in 2.15.0 (2015-04-06) +------------------------------ + +New features: + +- New functions first() and last() to retrun the first or last + element of a vector or list. + +- New functions left() and right() to return the leftmost or + rightmost n (default to 6) columns of a matrix or dataframe. + + Changes in 2.14.0 (2014-08-27) ------------------------------ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2015-04-14 21:53:00
|
Revision: 1926 http://sourceforge.net/p/r-gregmisc/code/1926 Author: warnes Date: 2015-04-14 21:52:53 +0000 (Tue, 14 Apr 2015) Log Message: ----------- Add 'scientific' argument to write.fwf to allow control of whether numeric values can be displated using scientific notation. Modified Paths: -------------- trunk/gdata/R/write.fwf.R trunk/gdata/man/write.fwf.Rd Modified: trunk/gdata/R/write.fwf.R =================================================================== --- trunk/gdata/R/write.fwf.R 2015-04-14 20:52:26 UTC (rev 1925) +++ trunk/gdata/R/write.fwf.R 2015-04-14 21:52:53 UTC (rev 1926) @@ -20,6 +20,7 @@ width=NULL, eol="\n", qmethod=c("escape", "double"), + scientific=TRUE, ...) { ## --- Setup --- @@ -29,6 +30,14 @@ if(length(na) > 1) stop("only single value can be defined for 'na'") + if(!scientific) + { + option.scipen <- getOption("scipen") + on.exit( function() options("scipen"=option.scipen) ) + options("scipen"=100) + } + + if(rownames) { x <- cbind(rownames(x), x) rowColVal <- ifelse(!is.null(rowCol), rowCol, "row") Modified: trunk/gdata/man/write.fwf.Rd =================================================================== --- trunk/gdata/man/write.fwf.Rd 2015-04-14 20:52:26 UTC (rev 1925) +++ trunk/gdata/man/write.fwf.Rd 2015-04-14 21:52:53 UTC (rev 1926) @@ -23,7 +23,7 @@ write.fwf(x, file="", append=FALSE, quote=FALSE, sep=" ", na="", rownames=FALSE, colnames=TRUE, rowCol=NULL, justify="left", formatInfo=FALSE, quoteInfo=TRUE, width=NULL, eol="\n", - qmethod=c("escape", "double"), \dots) + qmethod=c("escape", "double"), scientific=TRUE, \dots) } @@ -54,6 +54,8 @@ '"escape"' (default), in which case the quote character is escaped in C style by a backslash, or '"double"', in which case it is doubled. You can specify just the initial letter.} + \item{scientific}{logical, if TRUE, allow numeric values to be + formatted using scientific notation.} \item{\dots}{further arguments to \code{\link{format.info}} and \code{\link{format}} } @@ -61,10 +63,10 @@ \details{ -*F*ixed *w*idth *f*ormat is not used widely anymore. Use some other -format (say *c*omma *s*eparated *v*alues; see \code{\link{read.csv}}) if -you can. However, if you need fixed width format then \code{write.fwf} -can help you. +While *F*ixed *w*idth *f*ormat is no longer widely used, it remains +common in some disciplines. When possible, we recommend using +standardized format (e.g. *c*omma *s*eparated *v*alues; see +\code{\link{read.csv}}) when possible. Output is similar to \code{print(x)} or \code{format(x)}. Formatting is done completely by \code{\link{format}} on a column basis. Columns in @@ -217,15 +219,22 @@ ## Force wider columns write.fwf(x=testData[, 1:5], width=20) + ## Show effect of 'scienfic' option + testData$num3 <- testData$num3 * 1e8 + write.fwf(testData, scientific=TRUE) + write.fwf(testData, scientific=FALSE) + testData$num3 <- testData$num3 / 1e8 + ## Write to file and report format and fixed width information file <- tempfile() formatInfo <- write.fwf(x=testData, file=file, formatInfo=TRUE) + formatInfo ## Read exported data back to R (note +1 due to separator) ## ... without header read.fwf(file=file, widths=formatInfo$width + 1, header=FALSE, skip=1, strip.white=TRUE) - + ## ... with header - via postimport modfication tmp <- read.fwf(file=file, widths=formatInfo$width + 1, skip=1, strip.white=TRUE) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2015-04-22 22:32:08
|
Revision: 1932 http://sourceforge.net/p/r-gregmisc/code/1932 Author: warnes Date: 2015-04-22 22:32:01 +0000 (Wed, 22 Apr 2015) Log Message: ----------- Correct behavior of reorder.factor() when argument 'X' is supplied by delgating to stats:::reorder.default() Modified Paths: -------------- trunk/gdata/R/reorder.R Added Paths: ----------- trunk/gdata/tests/test.reorder.factor.R trunk/gdata/tests/test.reorder.factor.Rout.save Modified: trunk/gdata/R/reorder.R =================================================================== --- trunk/gdata/R/reorder.R 2015-04-22 21:35:19 UTC (rev 1931) +++ trunk/gdata/R/reorder.R 2015-04-22 22:32:01 UTC (rev 1932) @@ -12,6 +12,9 @@ { constructor <- if (order) ordered else factor + if(!missing(X)) + return( NextMethod(x)) + if (!missing(new.order)) { if (is.numeric(new.order)) Added: trunk/gdata/tests/test.reorder.factor.R =================================================================== --- trunk/gdata/tests/test.reorder.factor.R (rev 0) +++ trunk/gdata/tests/test.reorder.factor.R 2015-04-22 22:32:01 UTC (rev 1932) @@ -0,0 +1,11 @@ +## Test results before and after loading gdata + +m <- factor(c('a','b','c')) + +( m1 <- reorder(m, X=c(3, 2, 1)) ) + +library(gdata) + +( m2 <- reorder(m, X=c(3, 2, 1)) ) + +stopifnot(identical(m1,m2)) Added: trunk/gdata/tests/test.reorder.factor.Rout.save =================================================================== --- trunk/gdata/tests/test.reorder.factor.Rout.save (rev 0) +++ trunk/gdata/tests/test.reorder.factor.Rout.save 2015-04-22 22:32:01 UTC (rev 1932) @@ -0,0 +1,60 @@ + +R version 3.1.2 (2014-10-31) -- "Pumpkin Helmet" +Copyright (C) 2014 The R Foundation for Statistical Computing +Platform: x86_64-unknown-linux-gnu (64-bit) + +R is free software and comes with ABSOLUTELY NO WARRANTY. +You are welcome to redistribute it under certain conditions. +Type 'license()' or 'licence()' for distribution details. + + Natural language support but running in an English locale + +R is a collaborative project with many contributors. +Type 'contributors()' for more information and +'citation()' on how to cite R or R packages in publications. + +Type 'demo()' for some demos, 'help()' for on-line help, or +'help.start()' for an HTML browser interface to help. +Type 'q()' to quit R. + +> ## Test results before and after loading gdata +> +> m <- factor(c('a','b','c')) +> +> ( m1 <- reorder(m, X=c(3, 2, 1)) ) +[1] a b c +attr(,"scores") +a b c +3 2 1 +Levels: c b a +> +> library(gdata) +gdata: read.xls support for 'XLS' (Excel 97-2004) files ENABLED. + +gdata: read.xls support for 'XLSX' (Excel 2007+) files ENABLED. + +Attaching package: ‘gdata’ + +The following object is masked from ‘package:stats’: + + nobs + +The following object is masked from ‘package:utils’: + + object.size + +Warning message: +S3 methods ‘print.object_size’, ‘c.object_size’ were declared in NAMESPACE but not found +> +> ( m2 <- reorder(m, X=c(3, 2, 1)) ) +[1] a b c +attr(,"scores") +a b c +3 2 1 +Levels: c b a +> +> stopifnot(identical(m1,m2)) +> +> proc.time() + user system elapsed + 0.512 0.070 0.638 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2015-04-22 22:35:00
|
Revision: 1933 http://sourceforge.net/p/r-gregmisc/code/1933 Author: warnes Date: 2015-04-22 22:34:53 +0000 (Wed, 22 Apr 2015) Log Message: ----------- Modify gdaata:object.size to generate S3 objects of class 'object_sizes' (note the final 's') to avoid conflicts with methods in utils for object_size. Modified Paths: -------------- trunk/gdata/NAMESPACE trunk/gdata/R/object.size.R Modified: trunk/gdata/NAMESPACE =================================================================== --- trunk/gdata/NAMESPACE 2015-04-22 22:32:01 UTC (rev 1932) +++ trunk/gdata/NAMESPACE 2015-04-22 22:34:53 UTC (rev 1933) @@ -52,7 +52,7 @@ xlsFormats, ## Object size stuff - object.size, as.object_size, is.object_size, humanReadable, + object.size, as.object_sizes, is.object_sizes, humanReadable, ## getDateTime stuff getYear, getMonth, getDay, getHour, getMin, getSec, @@ -129,8 +129,8 @@ S3method(nobs, lm) # now provided by stats package ## Object size stuff -S3method(print, object_size) -S3method(c, object_size) +S3method(print, object_sizes) +S3method(c, object_sizes) ## unknown stuff S3method(isUnknown, default) Modified: trunk/gdata/R/object.size.R =================================================================== --- trunk/gdata/R/object.size.R 2015-04-22 22:32:01 UTC (rev 1932) +++ trunk/gdata/R/object.size.R 2015-04-22 22:34:53 UTC (rev 1933) @@ -4,15 +4,15 @@ ### $Id$ ### Time-stamp: <2008-12-30 08:05:43 ggorjan> ###------------------------------------------------------------------------ - object.size <- function(...) { structure(sapply(list(...), utils::object.size), - class=c("object_size", "numeric")) + class=c("object_sizes", "numeric")) } -print.object_size <- function(x, quote=FALSE, humanReadable, ...) +print.object_sizes <- function(x, quote=FALSE, units, + humanReadable, ...) { xOrig <- x if(missing(humanReadable)) { @@ -28,37 +28,31 @@ invisible(xOrig) } -is.object_size <- function(x) inherits(x, what="object_size") +is.object_sizes <- function(x) inherits(x, what="object_sizes") -as.object_size <- function(x) +as.object_sizes <- function(x) { if(!is.numeric(x)) stop("'x' must be numeric/integer") - class(x) <- c("object_size", "numeric") + class(x) <- c("object_sizes", "numeric") x } -c.object_size <- function(..., recursive=FALSE) +c.object_sizes <- function(..., recursive=FALSE) { x <- NextMethod() - if(is.numeric(x)) class(x) <- c("object_size", "numeric") + if(is.numeric(x)) class(x) <- c("object_sizes", "numeric") x } -humanReadable <- function(x, standard="SI", digits=1, width=3, sep=" ") +humanReadable <- function(x, standard="SI", units, digits=1, width=3, sep=" ") { ## --- Setup --- - if(any(x < 0)) stop("'x' must be positive") - if(standard == "SI") { - suffix <- c("B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB") - base <- 1000 - } else { - suffix <- c("B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB") - base <- 1024 - } + suffix.decimal <- c("B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB") + suffix.binary <- c("B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB") + + ## --- Functions --- - ## --- Apply --- - .applyHuman <- function(x, base, suffix, digits, width, sep) { ## Which suffix should we use? @@ -85,8 +79,29 @@ paste(x, suffix[i], sep=sep) } - sapply(X=x, FUN=".applyHuman", base=base, suffix=suffix, digits=digits, - width=width, sep=sep) + ## -- Work + + if(any(x < 0)) stop("'x' must be positive") + if(standard == "SI") { + suffix <- suffix.decimal + base <- 10^3 + } else { + suffix <- suffix.binary + base <- 2^10 + } + + if(!missing(units)) + { + units <- match.arg( units, suffix ) + power <- which( units %in% suffix ) -1 + X <- x/(base^power) + X <- format.default(round(x=x, digits=digits), nsmall=digits) + X <- paste(X, units) + X + } + else + sapply(X=x, FUN=".applyHuman", base=base, suffix=suffix, digits=digits, + width=width, sep=sep) } ###------------------------------------------------------------------------ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2015-04-22 23:15:01
|
Revision: 1936 http://sourceforge.net/p/r-gregmisc/code/1936 Author: warnes Date: 2015-04-22 23:14:54 +0000 (Wed, 22 Apr 2015) Log Message: ----------- Fix 'units' argument of humanReadable() Modified Paths: -------------- trunk/gdata/DESCRIPTION trunk/gdata/R/object.size.R trunk/gdata/man/humanReadable.Rd Added Paths: ----------- trunk/gdata/R/humanReadable.R Modified: trunk/gdata/DESCRIPTION =================================================================== --- trunk/gdata/DESCRIPTION 2015-04-22 22:44:46 UTC (rev 1935) +++ trunk/gdata/DESCRIPTION 2015-04-22 23:14:54 UTC (rev 1936) @@ -4,8 +4,8 @@ Depends: R (>= 2.13.0) SystemRequirements: perl Imports: gtools -Version: 2.15.0 -Date: 2015-04-06 +Version: 2.16.0 +Date: 2015-04-21 Author: Gregory R. Warnes, Ben Bolker, Gregor Gorjanc, Gabor Grothendieck, Ales Korosec, Thomas Lumley, Don MacQueen, Arni Magnusson, Jim Rogers, and others Added: trunk/gdata/R/humanReadable.R =================================================================== --- trunk/gdata/R/humanReadable.R (rev 0) +++ trunk/gdata/R/humanReadable.R 2015-04-22 23:14:54 UTC (rev 1936) @@ -0,0 +1,61 @@ +humanReadable <- function(x, standard=c("SI", "IEC"), units, digits=1, width=3, sep=" ") +{ + ## --- Setup --- + + suffix.decimal <- c("B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB") + suffix.binary <- c("B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB") + + standard <- match.arg(standard) + + ## --- Functions --- + + .applyHuman <- function(x, base, suffix, digits, width, sep) + { + ## Which suffix should we use? + n <- length(suffix) + for(i in 1:n) { + if(x >= base) { + if(i < n) x <- x / base + } else { + break + } + } + ## Formatting + if(is.null(width)) { ## the same formatting for all + x <- format(round(x=x, digits=digits), nsmall=digits) + } else { ## similar to ls, du, and df + lenX <- nchar(x) + if(lenX > width) { + digitsMy <- width - (lenX - (lenX - (nchar(round(x)) + 1))) + digits <- ifelse(digitsMy > digits, digits, digitsMy) + } + if(i == 1) digits <- 0 + x <- round(x, digits=digits) + } + paste(x, suffix[i], sep=sep) + } + + ## -- Work + + if(any(x < 0)) stop("'x' must be positive") + if(standard == "SI") { + suffix <- suffix.decimal + base <- 10^3 + } else { + suffix <- suffix.binary + base <- 2^10 + } + + if(!missing(units)) + { + units <- match.arg( units, suffix ) + power <- match(units, suffix ) -1 + X <- x/(base^power) + X <- format.default(round(x=X, digits=digits), nsmall=digits) + X <- paste(X, units) + X + } + else + sapply(X=x, FUN=".applyHuman", base=base, suffix=suffix, digits=digits, + width=width, sep=sep) +} Modified: trunk/gdata/R/object.size.R =================================================================== --- trunk/gdata/R/object.size.R 2015-04-22 22:44:46 UTC (rev 1935) +++ trunk/gdata/R/object.size.R 2015-04-22 23:14:54 UTC (rev 1936) @@ -104,5 +104,6 @@ width=width, sep=sep) } + ###------------------------------------------------------------------------ ### object.size.R ends here Modified: trunk/gdata/man/humanReadable.Rd =================================================================== --- trunk/gdata/man/humanReadable.Rd 2015-04-22 22:44:46 UTC (rev 1935) +++ trunk/gdata/man/humanReadable.Rd 2015-04-22 23:14:54 UTC (rev 1936) @@ -19,15 +19,14 @@ } \usage{ - -humanReadable(x, standard="SI", digits=1, width=3, sep=" ") - +humanReadable(x, standard=c("SI","IEC"), units, digits=1, width=3, sep=" ") } \arguments{ \item{x}{integer, byte size} - \item{standard}{character, "SI" for powers of 1000 or anything else for + \item{standard}{character, either "SI" for powers of 1000 or "IEC" for powers of 1024, see details} + \item{units}{character, unit to use for all values (optional)} \item{digits}{integer, number of digits after decimal point} \item{width}{integer, width of number string} \item{sep}{character, separator between number and unit} @@ -104,6 +103,14 @@ \examples{ +# Simple example: maximum addressible size of 32 bit pointer +humanReadable(2^32-1, standard="SI") +humanReadable(2^32-1, standard="IEC") + +humanReadable(2^32-1, standard="SI", unit="MB") +humanReadable(2^32-1, standard="IEC", unit="MiB") + + baseSI <- 10 powerSI <- seq(from=3, to=27, by=3) SI0 <- (baseSI)^powerSI @@ -117,12 +124,22 @@ IEC1 <- IEC0 - IEC0 / c(2, runif(n=k, min=1.01, max=5.99)) IEC2 <- IEC0 + IEC0 / c(2, runif(n=k, min=1.01, max=5.99)) +# Auto units cbind(humanReadable(x=SI1, width=NULL, digits=3), humanReadable(x=SI0, width=NULL, digits=2), humanReadable(x=SI2, width=NULL, digits=1), humanReadable(x=IEC1, standard="IEC", width=7, digits=3), humanReadable(x=IEC0, standard="IEC", width=7, digits=2), humanReadable(x=IEC2, standard="IEC", width=7, digits=1)) + +# Single unit +cbind(humanReadable(x=SI1, units="GB", width=NULL, digits=3), + humanReadable(x=SI0, units="GB", width=NULL, digits=2), + humanReadable(x=SI2, units="GB", width=NULL, digits=1), + humanReadable(x=IEC1, units="GiB", standard="IEC", width=7, digits=3), + humanReadable(x=IEC0, units="GiB", standard="IEC", width=7, digits=2), + humanReadable(x=IEC2, units="GiB", standard="IEC", width=7, digits=1)) + } \keyword{misc} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2015-04-25 05:54:38
|
Revision: 1957 http://sourceforge.net/p/r-gregmisc/code/1957 Author: warnes Date: 2015-04-25 05:54:28 +0000 (Sat, 25 Apr 2015) Log Message: ----------- Complete work on object.size(), object_sizes methods, and humanReadable. Modified Paths: -------------- trunk/gdata/NAMESPACE trunk/gdata/R/humanReadable.R trunk/gdata/R/object.size.R trunk/gdata/man/humanReadable.Rd trunk/gdata/man/object.size.Rd Added Paths: ----------- trunk/gdata/tests/test.humanReadable.R trunk/gdata/tests/test.humanReadable.Rout.save Modified: trunk/gdata/NAMESPACE =================================================================== --- trunk/gdata/NAMESPACE 2015-04-25 02:52:53 UTC (rev 1956) +++ trunk/gdata/NAMESPACE 2015-04-25 05:54:28 UTC (rev 1957) @@ -129,8 +129,11 @@ S3method(nobs, lm) # now provided by stats package ## Object size stuff -S3method(print, object_sizes) -S3method(c, object_sizes) +S3method(c, object_sizes) +S3method(as, object_sizes) +S3method(format, object_sizes) +S3method(is, object_sizes) +S3method(print, object_sizes) ## unknown stuff S3method(isUnknown, default) Modified: trunk/gdata/R/humanReadable.R =================================================================== --- trunk/gdata/R/humanReadable.R 2015-04-25 02:52:53 UTC (rev 1956) +++ trunk/gdata/R/humanReadable.R 2015-04-25 05:54:28 UTC (rev 1957) @@ -1,61 +1,89 @@ -humanReadable <- function(x, standard=c("SI", "IEC"), units, digits=1, width=3, sep=" ") +humanReadable <- function(x, + units="auto", + standard=c("IEC", "SI", "Unix"), + digits=1, + width=NULL, + sep=" ", + justify = c("right", "left"), + ... + ) { ## --- Setup --- - suffix.decimal <- c("B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB") - suffix.binary <- c("B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB") + suffix.SI <- c("B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB") + suffix.IEC <- c("B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB") + suffix.Unix <- c("B" , "K", "M", "G", "T", "P", "E", "Z", "Y") standard <- match.arg(standard) - + if(length(justify)==1) justfy <- c(justify, justify) + ## --- Functions --- .applyHuman <- function(x, base, suffix, digits, width, sep) { ## Which suffix should we use? n <- length(suffix) - for(i in 1:n) { - if(x >= base) { - if(i < n) x <- x / base - } else { - break - } - } + i <- pmax(pmin(floor(log(x, base)), n-1),0) + if(!is.finite(i)) i <- 0 + x <- x / base^i ## Formatting - if(is.null(width)) { ## the same formatting for all - x <- format(round(x=x, digits=digits), nsmall=digits) - } else { ## similar to ls, du, and df - lenX <- nchar(x) - if(lenX > width) { - digitsMy <- width - (lenX - (lenX - (nchar(round(x)) + 1))) - digits <- ifelse(digitsMy > digits, digits, digitsMy) - } - if(i == 1) digits <- 0 - x <- round(x, digits=digits) - } - paste(x, suffix[i], sep=sep) + if(is.null(width)) + ## the same formatting for all + x <- format(round(x=x, digits=digits), nsmall=digits) + else + { + ## similar to ls, du, and df + lenX <- nchar(x) + if(lenX > width) { + digits <- pmax( width - nchar(round(x)) - 1, 0) + } + if(i == 0) digits <- 0 + x <- round(x, digits=digits) + } + c(x, suffix[i+1]) } ## -- Work - + if(any(x < 0)) stop("'x' must be positive") - if(standard == "SI") { - suffix <- suffix.decimal - base <- 10^3 - } else { - suffix <- suffix.binary - base <- 2^10 - } + if(standard == "SI") + { + suffix <- suffix.SI + base <- 10^3 + } + else if (standard=="IEC") + { + suffix <- suffix.IEC + base <- 2^10 + } + else # (standard=="Unix) + { + suffix <- suffix.Unix + base <- 2^10 + } - if(!missing(units)) + if(!missing(units) && units=="bytes") { - units <- match.arg( units, suffix ) + retval <- rbind(x, "bytes") + } + else if(!missing(units) && units!="auto") + { + units <- suffix[match( toupper(units), toupper(suffix) )] power <- match(units, suffix ) -1 X <- x/(base^power) - X <- format.default(round(x=X, digits=digits), nsmall=digits) - X <- paste(X, units) - X + X <- format.default(x=X, digits=digits, nsmall=digits) + retval <- rbind(X, rep(units, length(X))) } else - sapply(X=x, FUN=".applyHuman", base=base, suffix=suffix, digits=digits, - width=width, sep=sep) + retval <- sapply(X=x, FUN=".applyHuman", base=base, suffix=suffix, + digits=digits, width=width, sep=sep) + + if(all(justify == "none")) + paste(trim(retval[1,]), trim(retval[2,]), sep=sep) + else + paste(format(trim(retval[1,]), justify=justify[1]), + format(trim(retval[2,]), justify=justify[2]), + sep=sep) + } + Modified: trunk/gdata/R/object.size.R =================================================================== --- trunk/gdata/R/object.size.R 2015-04-25 02:52:53 UTC (rev 1956) +++ trunk/gdata/R/object.size.R 2015-04-25 05:54:28 UTC (rev 1957) @@ -1,38 +1,79 @@ -### object.size.R ###------------------------------------------------------------------------ ### What: Print object size in human readable format - code -### $Id$ -### Time-stamp: <2008-12-30 08:05:43 ggorjan> ###------------------------------------------------------------------------ -object.size <- function(...) +object.size <- function(...) { structure(sapply(list(...), utils::object.size), class=c("object_sizes", "numeric")) } -print.object_sizes <- function(x, quote=FALSE, units, - humanReadable, ...) -{ - xOrig <- x - if(missing(humanReadable)) { - opt <- getOption("humanReadable") - humanReadable <- ifelse(!is.null(opt), opt, FALSE) - } - if(humanReadable) { - print(humanReadable(x), quote=quote, ...) - } else { - class(x) <- "numeric" - NextMethod() - } - invisible(xOrig) +print.object_sizes <- function(x, + quote=FALSE, + humanReadable=getOption("humanReadable"), + standard="IEC", + units, + digits=1, + width=NULL, + sep=" ", + ...) +{ + print(format(x, + humanReadable=humanReadable, + standard=standard, + units=units, + digits=digits, + width=width, + sep=sep), + quote=quote, + ...) + + + invisible(x) } +format.object_sizes <- function(x, + humanReadable=getOption("humanReadable"), + standard="IEC", + units, + digits=1, + width=NULL, + sep=" ", + ...) +{ + if( !missing(units) ) + { + if (units=="bytes") + paste(x, "bytes") + else + humanReadable(x, + standard=standard, + units=units, + digits=digits, + width=width, + sep=sep + ) + } + else if( is.null(humanReadable) || humanReadable==FALSE ) + paste(x, "bytes") + else + humanReadable(x, + standard=standard, + units=units, + digits=digits, + width=width, + sep=sep) + +} + + + is.object_sizes <- function(x) inherits(x, what="object_sizes") - + as.object_sizes <- function(x) { - if(!is.numeric(x)) stop("'x' must be numeric/integer") + if(!is.numeric(x) || any(x<0)) stop("'x' must be a positive numeric vector") + class(x) <- c("object_sizes", "numeric") x } @@ -44,66 +85,5 @@ x } -humanReadable <- function(x, standard="SI", units, digits=1, width=3, sep=" ") -{ - ## --- Setup --- - - suffix.decimal <- c("B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB") - suffix.binary <- c("B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB") - - ## --- Functions --- - - .applyHuman <- function(x, base, suffix, digits, width, sep) - { - ## Which suffix should we use? - n <- length(suffix) - for(i in 1:n) { - if(x >= base) { - if(i < n) x <- x / base - } else { - break - } - } - ## Formatting - if(is.null(width)) { ## the same formatting for all - x <- format(round(x=x, digits=digits), nsmall=digits) - } else { ## similar to ls, du, and df - lenX <- nchar(x) - if(lenX > width) { - digitsMy <- width - (lenX - (lenX - (nchar(round(x)) + 1))) - digits <- ifelse(digitsMy > digits, digits, digitsMy) - } - if(i == 1) digits <- 0 - x <- round(x, digits=digits) - } - paste(x, suffix[i], sep=sep) - } - - ## -- Work - - if(any(x < 0)) stop("'x' must be positive") - if(standard == "SI") { - suffix <- suffix.decimal - base <- 10^3 - } else { - suffix <- suffix.binary - base <- 2^10 - } - - if(!missing(units)) - { - units <- match.arg( units, suffix ) - power <- which( units %in% suffix ) -1 - X <- x/(base^power) - X <- format.default(round(x=x, digits=digits), nsmall=digits) - X <- paste(X, units) - X - } - else - sapply(X=x, FUN=".applyHuman", base=base, suffix=suffix, digits=digits, - width=width, sep=sep) -} - - ###------------------------------------------------------------------------ ### object.size.R ends here Modified: trunk/gdata/man/humanReadable.Rd =================================================================== --- trunk/gdata/man/humanReadable.Rd 2015-04-25 02:52:53 UTC (rev 1956) +++ trunk/gdata/man/humanReadable.Rd 2015-04-25 05:54:28 UTC (rev 1957) @@ -1,43 +1,44 @@ -% humanReadable.Rd -%-------------------------------------------------------------------------- -% What: Print byte size in human readable format man page -% $Id$ -% Time-stamp: <2008-12-30 13:26:35 ggorjan> -%-------------------------------------------------------------------------- - \name{humanReadable} \alias{humanReadable} -\title{Print byte size in human readable format} +\title{Print Byte Size in Human Readable Format} \description{ -\code{humanReadable} converts byte size in human readable format such as +\code{humanReadable} converts integer byte sizes to a human readable units such as kB, MB, GB, etc. } \usage{ -humanReadable(x, standard=c("SI","IEC"), units, digits=1, width=3, sep=" ") +humanReadable(x, units="auto", standard=c("IEC", "SI", "Unix"), + digits=1, width=NULL, sep=" ", justify=c("right", "left"), + \dots) } \arguments{ \item{x}{integer, byte size} - \item{standard}{character, either "SI" for powers of 1000 or "IEC" for - powers of 1024, see details} - \item{units}{character, unit to use for all values (optional)} + \item{standard}{character, "IEC" for powers of 1024 ('MiB'), "SI" for + powers of 1000 ('MB'), or "Unix" for powers of 1024 ('M'). See + details.} + \item{units}{character, unit to use for all values (optional), one of + "auto", "bytes", or an appropriate unit corresponding to + \code{standard}.} \item{digits}{integer, number of digits after decimal point} \item{width}{integer, width of number string} \item{sep}{character, separator between number and unit} + \item{justify}{two-element vector specifiy the alignment for the number + and unit components of the size. Each element should be one of + "none", "left", "right", or "center"} } \details{ -Basic unit used to store information in computers is a bit. Bits are +The basic unit used to store information in computers is a bit. Bits are represented as zeroes and ones - binary number system. Although, the binary number system is not the same as the decimal number system, decimal prefixes -for binary multiples such as kilo and mega are often used. In the decimal system +for binary multiples such as kilo and mega are often used. In the decimal system kilo represent 1000, which is close to \eqn{1024 = 2^{10}} in the binary system. This sometimes causes problems as it is not clear which powers (2 or 10) are used in a notation like 1 kB. To overcome this problem International Electrotechnical @@ -65,14 +66,30 @@ } where Zi and Yi are GNU extensions to IEC. To get the output in the decimal -system (powers of 1000) use \code{standard="SI"}. Otherwise IEC standard -(powers of 1024) is used. +system (powers of 1000) use \code{standard="SI"}. To obtain IEC standard +(powers of 1024) use \code{standard="IEC"}. +In addition, single-character units are provided that follow (and +extend) the Unix pattern (use \code{standard="Unix"}): + +\tabular{lrcll}{ +Name \tab System \tab Symbol \tab Size \tab Conversion \cr +byte \tab binary \tab B \tab \eqn{2^3} \tab 8 bits \cr +kibibyte \tab binary \tab K \tab \eqn{2^{10}} \tab 1024 bytes \cr +mebibyte \tab binary \tab M \tab \eqn{(2^{10})^2} \tab 1024 kibibytes\cr +gibibyte \tab binary \tab G \tab \eqn{(2^{10})^3} \tab 1024 mebibytes\cr +tebibyte \tab binary \tab T \tab \eqn{(2^{10})^4} \tab 1024 gibibytes\cr +pebibyte \tab binary \tab P \tab \eqn{(2^{10})^5} \tab 1024 tebibytes\cr +exbibyte \tab binary \tab E \tab \eqn{(2^{10})^6} \tab 1024 pebibytes\cr +zebibyte \tab binary \tab Z \tab \eqn{(2^{10})^7} \tab 1024 exbibytes\cr +yottabyte \tab binary \tab Y \tab \eqn{(2^{10})^8} \tab 1024 zebibytes\cr +} + For printout both \code{digits} and \code{width} can be specified. If \code{width} is \code{NULL}, all values have given number of digits. If \code{width} is not \code{NULL}, output is rounded to a given width and -formated similar to human readable format of \code{ls}, \code{df} or -\code{du} shell commands. +formated similar to human readable format of the Unix \code{ls}, +\code{df} or \code{du} shell commands. } @@ -95,51 +112,40 @@ } -\author{Ales Korosec and Gregor Gorjanc} +\author{Ales Korosec, Gregor Gorjanc, and Gregory R. Warnes + \email{gr...@wa...}} + \seealso{ - \code{\link{object.size}}, \code{\link[gdata]{ll}} + \code{\link{object.size}} in package 'gdata', + \code{\link[utils]{object.size}} in package 'utils', + \code{\link[gdata]{ll}} } \examples{ # Simple example: maximum addressible size of 32 bit pointer +humanReadable(2^32-1) +humanReadable(2^32-1, standard="IEC") humanReadable(2^32-1, standard="SI") -humanReadable(2^32-1, standard="IEC") +humanReadable(2^32-1, standard="Unix") -humanReadable(2^32-1, standard="SI", unit="MB") -humanReadable(2^32-1, standard="IEC", unit="MiB") +humanReadable(2^32-1, unit="MiB") +humanReadable(2^32-1, standard="IEC", unit="MiB") +humanReadable(2^32-1, standard="SI", unit="MB") +humanReadable(2^32-1, standard="Unix", unit="M") +# Vector of sizes +matrix(humanReadable(c(60810, 124141, 124, 13412513), width=4)) +matrix(humanReadable(c(60810, 124141, 124, 13412513), width=4, unit="KiB")) -baseSI <- 10 -powerSI <- seq(from=3, to=27, by=3) -SI0 <- (baseSI)^powerSI -k <- length(SI0) - 1 -SI1 <- SI0 - SI0 / c(2, runif(n=k, min=1.01, max=5.99)) -SI2 <- SI0 + SI0 / c(2, runif(n=k, min=1.01, max=5.99)) +# Specify digits rather than width +matrix(humanReadable(c(60810, 124141, 124, 13412513), width=NULL, digits=2)) -baseIEC <- 2 -powerIEC <- seq(from=10, to=90, by=10) -IEC0 <- (baseIEC)^powerIEC -IEC1 <- IEC0 - IEC0 / c(2, runif(n=k, min=1.01, max=5.99)) -IEC2 <- IEC0 + IEC0 / c(2, runif(n=k, min=1.01, max=5.99)) +# Change the justification +matrix(humanReadable(c(60810, 124141, 124, 13412513), width=NULL, + justify=c("right", "right") )) -# Auto units -cbind(humanReadable(x=SI1, width=NULL, digits=3), - humanReadable(x=SI0, width=NULL, digits=2), - humanReadable(x=SI2, width=NULL, digits=1), - humanReadable(x=IEC1, standard="IEC", width=7, digits=3), - humanReadable(x=IEC0, standard="IEC", width=7, digits=2), - humanReadable(x=IEC2, standard="IEC", width=7, digits=1)) - -# Single unit -cbind(humanReadable(x=SI1, units="GB", width=NULL, digits=3), - humanReadable(x=SI0, units="GB", width=NULL, digits=2), - humanReadable(x=SI2, units="GB", width=NULL, digits=1), - humanReadable(x=IEC1, units="GiB", standard="IEC", width=7, digits=3), - humanReadable(x=IEC0, units="GiB", standard="IEC", width=7, digits=2), - humanReadable(x=IEC2, units="GiB", standard="IEC", width=7, digits=1)) - } \keyword{misc} Modified: trunk/gdata/man/object.size.Rd =================================================================== --- trunk/gdata/man/object.size.Rd 2015-04-25 02:52:53 UTC (rev 1956) +++ trunk/gdata/man/object.size.Rd 2015-04-25 05:54:28 UTC (rev 1957) @@ -1,70 +1,95 @@ -% File src/library/utils/man/object.size.Rd +% Come material taken from src/library/utils/man/object.size.Rd % Part of the R package, http://www.R-project.org % Copyright 1995-2007 R Core Development Team % Distributed under GPL 2 or later \name{object.size} \alias{object.size} -\alias{print.object_sizes} \alias{c.object_sizes} \alias{as.object_sizes} \alias{is.object_sizes} +\alias{format.object_sizes} +\alias{print.object_sizes} -\title{Report the Space Allocated for an Object} +\title{Report the Space Allocated for Objects} \description{ - Provides an estimate of the memory that is being used to store an \R object. + Provides an estimate of the memory that is being used to store \R objects. } \usage{ object.size(\dots) -\method{print}{object_sizes}(x, quote=FALSE, humanReadable, \dots) +\method{is}{object_sizes}(x) + +\method{as}{object_sizes}(x) + +\method{c}{object_sizes}(x) + +\method{format}{object_sizes}(x, humanReadable=getOption("humanReadable"), standard="IEC", units, + digits=1, width=NULL, sep=" ", \dots) + +\method{print}{object_sizes}x, quote=FALSE, humanReadable=getOption("humanReadable"), + standard="IEC", units, digits=1, width=NULL, sep=" ", \dots) + } \arguments{ - \item{\dots}{\code{object.size}: \R objects; \code{print}; arguments - to be passed to or from other methods.} + \item{\dots}{\code{object.size}: \R objects; + \code{print}: arguments to be passed to other methods.} \item{x}{output from \code{object.size}} \item{quote}{logical, indicating whether or not the result should be printed with surrounding quotes.} \item{humanReadable}{logical, use the \dQuote{human readable} format.} + \item{standard,units,digits,width,sep,justify}{arguments passed to + \code{\link{humanReadable}}. See the \code{\link{humanReadable}} + man page for details. + } } \details{ - This is a modified copy from the utils package in R as fo 2008-12-15. + \emph{This is a modified copy of the man page for utils::object.size in R + 2.2.1.} - Exactly which parts of the memory allocation should be attributed to - which object is not clear-cut. This function merely provides a rough - indication: it should be reasonably accurate for atomic vectors, but - does not detect if elements of a list are shared, for example. - (Sharing amongst elements of a character vector is taken into account, - but not that between character vectors in a single object.) - - The calculation is of the size of the object, and excludes the space - needed to store its name in the symbol table. + Exactly which parts of the memory allocation should be attributed + to which object is not clear-cut. This function merely provides a + rough indication: it should be reasonably accurate for atomic + vectors, but does not detect if elements of a list are shared, for + example. (Sharing amongst elements of a character vector is taken + into account, but not that between character vectors in a single + object.) - Associated space (e.g. the environment of a function and what the - pointer in a \code{EXTPTRSXP} points to) is not included in the + The calculation is of the size of the object, and excludes the + space needed to store its name in the symbol table. + + Associated space (e.g., the environment of a function and what the + pointer in a ‘EXTPTRSXP’ points to) is not included in the calculation. - Object sizes are larger on 64-bit platforms than 32-bit ones, but will - very likely be the same on different platforms with the same word - length and pointer size. + Object sizes are larger on 64-bit builds than 32-bit ones, but + will very likely be the same on different platforms with the same + word length and pointer size. % Modificitaion start - Class of returned object is \code{c("byte", "numeric")} with + \emph{Changes} + + Class of returned object is \code{c("object_sizes", "numeric")} with appropriate \code{print} and \code{c} methods. By default \code{object.size} outputs size in bytes, but human readable format similar to \code{ls}, \code{df} or \code{du} shell - commands can be invoked with \code{options(humanReadable=TRUE)}. + commands can be displayed by calling \code{humanReadable} directly, + calling \code{print} with the argument \code{humanReadable=TRUE}, or + by setting \code{options(humanReadable=TRUE)}. + % Modificitaion end } \value{ - An object of class \code{"object.size"} with a length-one double value, - an estimate of the memory allocation attributable to the object in bytes. + A numeric vector class \code{c("object_sizes", "numeric")} containing + estimated memory allocation attributable to the objects in bytes. } \seealso{ - \code{\link{Memory-limits}} for the design limitations on object size. + \code{\link[utils]{object.size}} in package 'utils' for the standard + version of this function, + \code{\link{Memory-limits}} for the design limitations on object size, \code{\link{humanReadable}} for human readable format. } @@ -72,14 +97,35 @@ object.size(letters) object.size(ls) ## find the 10 largest objects in the base package -z <- sapply(ls("package:base"), function(x) - object.size(get(x, envir = baseenv()))) -(tmp <- as.matrix(rev(sort(z))[1:10])) +allObj <- sapply(ls("package:base"), + function(x) + object.size(get(x, envir = baseenv())) + ) +( bigObj <- as.object_sizes(rev(sort(allObj))[1:10] ) ) +print(bigObj, humanReadable=TRUE) + + as.object_sizes(14567567) + +\dontshow{ + optionsOrig <- options("humanReadable") +} + options(humanReadable=TRUE) -(z <- object.size(letters, c(letters, letters), rep(letters, 100), rep(letters, 10000))) +( + z <- object.size(letters, + c(letters, letters), + rep(letters, 100), + rep(letters, 10000) + ) +) is.object_sizes(z) as.object_sizes(14567567) + +\dontshow{ + options(optionsOrig) } + +} \keyword{utilities} Added: trunk/gdata/tests/test.humanReadable.R =================================================================== --- trunk/gdata/tests/test.humanReadable.R (rev 0) +++ trunk/gdata/tests/test.humanReadable.R 2015-04-25 05:54:28 UTC (rev 1957) @@ -0,0 +1,91 @@ +library(gdata) + +options(humanReadable=FALSE) + +baseSI <- 10 +powerSI <- seq(from=0, to=27, by=3) +SI0 <- (baseSI)^powerSI +k <- length(SI0) - 1 +SI1 <- SI0 - SI0 / c(2, runif(n=k, min=1.01, max=5.99)) +SI2 <- SI0 + SI0 / c(2, runif(n=k, min=1.01, max=5.99)) + +baseIEC <- 2 +powerIEC <- seq(from=0, to=90, by=10) +IEC0 <- (baseIEC)^powerIEC +IEC1 <- IEC0 - IEC0 / c(2, runif(n=k, min=1.01, max=5.99)) +IEC2 <- IEC0 + IEC0 / c(2, runif(n=k, min=1.01, max=5.99)) + +# Auto units, specify width +cbind(humanReadable(x=SI2, standard="SI", width=7), + humanReadable(x=SI2, standard="SI", width=5), + humanReadable(x=SI2, standard="SI", width=3), + humanReadable(x=IEC2, standard="IEC", width=7), + humanReadable(x=IEC2, standard="IEC", width=5), + humanReadable(x=IEC2, standard="IEC", width=3), + humanReadable(x=IEC2, standard="Unix", width=7), + humanReadable(x=IEC2, standard="Unix", width=5), + humanReadable(x=IEC2, standard="Unix", width=3)) + +# Auto units, specify digits +cbind(humanReadable(x=SI2, standard="SI", width=NULL, digits=7), + humanReadable(x=SI2, standard="SI", width=NULL, digits=3), + humanReadable(x=SI2, standard="SI", width=NULL, digits=2), + humanReadable(x=SI2, standard="SI", width=NULL, digits=1), + humanReadable(x=IEC2, standard="IEC", width=NULL, digits=7), + humanReadable(x=IEC2, standard="IEC", width=NULL, digits=3), + humanReadable(x=IEC2, standard="IEC", width=NULL, digits=2), + humanReadable(x=IEC2, standard="IEC", width=NULL, digits=1), + humanReadable(x=IEC2, standard="Unix", width=NULL, digits=7), + humanReadable(x=IEC2, standard="Unix", width=NULL, digits=3), + humanReadable(x=IEC2, standard="Unix", width=NULL, digits=2), + humanReadable(x=IEC2, standard="Unix", width=NULL, digits=1)) + +# Single unit, specify width +cbind(humanReadable(x=SI1, units="GB", standard="SI", width=7), + humanReadable(x=SI1, units="GB", standard="SI", width=5), + humanReadable(x=SI1, units="GB", standard="SI", width=3), + humanReadable(x=IEC1, units="GiB", standard="IEC", width=7), + humanReadable(x=IEC1, units="GiB", standard="IEC", width=5), + humanReadable(x=IEC1, units="GiB", standard="IEC", width=3), + humanReadable(x=IEC1, units="G", standard="Unix", width=7), + humanReadable(x=IEC1, units="G", standard="Unix", width=5), + humanReadable(x=IEC1, units="G", standard="Unix", width=3) + ) + +# Single unit, specify digits +cbind(humanReadable(x=SI1, units="GB", standard="SI", width=NULL, digits=7), + humanReadable(x=SI1, units="GB", standard="SI", width=NULL, digits=3), + humanReadable(x=SI1, units="GB", standard="SI", width=NULL, digits=2), + humanReadable(x=SI1, units="GB", standard="SI", width=NULL, digits=1), + humanReadable(x=IEC1, units="GiB", standard="IEC", width=NULL, digits=7), + humanReadable(x=IEC1, units="GiB", standard="IEC", width=NULL, digits=3), + humanReadable(x=IEC1, units="GiB", standard="IEC", width=NULL, digits=2), + humanReadable(x=IEC1, units="GiB", standard="IEC", width=NULL, digits=1), + humanReadable(x=IEC1, units="G", standard="Unix", width=NULL, digits=7), + humanReadable(x=IEC1, units="G", standard="Unix", width=NULL, digits=3), + humanReadable(x=IEC1, units="G", standard="Unix", width=NULL, digits=2), + humanReadable(x=IEC1, units="G", standard="Unix", width=NULL, digits=1) + ) + + +stopifnot( is.object_sizes(as.object_sizes( 2^(1:30) ) ) ) +stopifnot( format(as.object_sizes(124)) == "124 bytes") +stopifnot( format(as.object_sizes(124e8), units="auto") == "11.5 GiB") +stopifnot( format(as.object_sizes(124e8), humanReadable=TRUE) == "11.5 GiB") +stopifnot( format(as.object_sizes(124e8), units="bytes") == "1.24e+10 bytes") + +tools::assertError( as.object_sizes(-1) ) +tools::assertError( as.object_sizes('a') ) +tools::assertError( as.object_sizes(list()) ) +tools::assertError( as.object_sizes(NULL) ) +tools::assertError( as.object_sizes(0+1i) ) + +stopifnot( format(as.object_sizes(1e40) ) == "1e+40 bytes" ) +stopifnot( format(as.object_sizes(1e40), units="auto" ) == "8.271806e+15 YiB") +stopifnot( format(as.object_sizes(1e40), units="bytes") == "1e+40 bytes" ) +stopifnot( format(as.object_sizes(1e40), humanReadable=TRUE) == "8.271806e+15 YiB") +stopifnot( format(as.object_sizes(1e40), humanReadable=FALSE) == "1e+40 bytes") + +options(humanReadable=TRUE) +stopifnot( format(as.object_sizes(1e40) ) == "8.271806e+15 YiB") +options(humanReadable=FALSE) Added: trunk/gdata/tests/test.humanReadable.Rout.save =================================================================== --- trunk/gdata/tests/test.humanReadable.Rout.save (rev 0) +++ trunk/gdata/tests/test.humanReadable.Rout.save 2015-04-25 05:54:28 UTC (rev 1957) @@ -0,0 +1,243 @@ + +R version 3.1.2 (2014-10-31) -- "Pumpkin Helmet" +Copyright (C) 2014 The R Foundation for Statistical Computing +Platform: x86_64-apple-darwin13.4.0 (64-bit) + +R is free software and comes with ABSOLUTELY NO WARRANTY. +You are welcome to redistribute it under certain conditions. +Type 'license()' or 'licence()' for distribution details. + + Natural language support but running in an English locale + +R is a collaborative project with many contributors. +Type 'contributors()' for more information and +'citation()' on how to cite R or R packages in publications. + +Type 'demo()' for some demos, 'help()' for on-line help, or +'help.start()' for an HTML browser interface to help. +Type 'q()' to quit R. + +> library(gdata) +gdata: read.xls support for 'XLS' (Excel 97-2004) files ENABLED. + +gdata: Unable to load perl libaries needed by read.xls() +gdata: to support 'XLSX' (Excel 2007+) files. + +gdata: Run the function 'installXLSXsupport()' +gdata: to automatically download and install the perl +gdata: libaries needed to support Excel XLS and XLSX formats. + +Attaching package: ‘gdata’ + +The following object is masked from ‘package:stats’: + + nobs + +The following object is masked from ‘package:utils’: + + object.size + +> +> options(humanReadable=FALSE) +> +> baseSI <- 10 +> powerSI <- seq(from=0, to=27, by=3) +> SI0 <- (baseSI)^powerSI +> k <- length(SI0) - 1 +> SI1 <- SI0 - SI0 / c(2, runif(n=k, min=1.01, max=5.99)) +> SI2 <- SI0 + SI0 / c(2, runif(n=k, min=1.01, max=5.99)) +> +> baseIEC <- 2 +> powerIEC <- seq(from=0, to=90, by=10) +> IEC0 <- (baseIEC)^powerIEC +> IEC1 <- IEC0 - IEC0 / c(2, runif(n=k, min=1.01, max=5.99)) +> IEC2 <- IEC0 + IEC0 / c(2, runif(n=k, min=1.01, max=5.99)) +> +> # Auto units, specify width +> cbind(humanReadable(x=SI2, standard="SI", width=7), ++ humanReadable(x=SI2, standard="SI", width=5), ++ humanReadable(x=SI2, standard="SI", width=3), ++ humanReadable(x=IEC2, standard="IEC", width=7), ++ humanReadable(x=IEC2, standard="IEC", width=5), ++ humanReadable(x=IEC2, standard="IEC", width=3), ++ humanReadable(x=IEC2, standard="Unix", width=7), ++ humanReadable(x=IEC2, standard="Unix", width=5), ++ humanReadable(x=IEC2, standard="Unix", width=3)) + [,1] [,2] [,3] [,4] [,5] [,6] + [1,] " 2 B " " 2 B " " 2 B " " 2 B " " 2 B " " 2 B " + [2,] "1.26838 kB" "1.268 kB" " 1.3 kB" "1.25729 KiB" "1.257 KiB" " 1.3 KiB" + [3,] " 1.2285 MB" "1.228 MB" " 1.2 MB" "1.83751 MiB" "1.838 MiB" " 1.8 MiB" + [4,] "1.24401 GB" "1.244 GB" " 1.2 GB" "1.26666 GiB" "1.267 GiB" " 1.3 GiB" + [5,] "1.47565 TB" "1.476 TB" " 1.5 TB" " 1.4234 TiB" "1.423 TiB" " 1.4 TiB" + [6,] "1.36687 PB" "1.367 PB" " 1.4 PB" "1.32499 PiB" "1.325 PiB" " 1.3 PiB" + [7,] "1.21324 EB" "1.213 EB" " 1.2 EB" "1.54391 EiB" "1.544 EiB" " 1.5 EiB" + [8,] "1.37186 ZB" "1.372 ZB" " 1.4 ZB" " 1.233 ZiB" "1.233 ZiB" " 1.2 ZiB" + [9,] "1.19468 YB" "1.195 YB" " 1.2 YB" "1.21258 YiB" "1.213 YiB" " 1.2 YiB" +[10,] "1201.13 YB" " 1201 YB" "1201 YB" "1489.01 YiB" " 1489 YiB" "1489 YiB" + [,7] [,8] [,9] + [1,] " 2 B" " 2 B" " 2 B" + [2,] "1.25729 K" "1.257 K" " 1.3 K" + [3,] "1.83751 M" "1.838 M" " 1.8 M" + [4,] "1.26666 G" "1.267 G" " 1.3 G" + [5,] " 1.4234 T" "1.423 T" " 1.4 T" + [6,] "1.32499 P" "1.325 P" " 1.3 P" + [7,] "1.54391 E" "1.544 E" " 1.5 E" + [8,] " 1.233 Z" "1.233 Z" " 1.2 Z" + [9,] "1.21258 Y" "1.213 Y" " 1.2 Y" +[10,] "1489.01 Y" " 1489 Y" "1489 Y" +> +> # Auto units, specify digits +> cbind(humanReadable(x=SI2, standard="SI", width=NULL, digits=7), ++ humanReadable(x=SI2, standard="SI", width=NULL, digits=3), ++ humanReadable(x=SI2, standard="SI", width=NULL, digits=2), ++ humanReadable(x=SI2, standard="SI", width=NULL, digits=1), ++ humanReadable(x=IEC2, standard="IEC", width=NULL, digits=7), ++ humanReadable(x=IEC2, standard="IEC", width=NULL, digits=3), ++ humanReadable(x=IEC2, standard="IEC", width=NULL, digits=2), ++ humanReadable(x=IEC2, standard="IEC", width=NULL, digits=1), ++ humanReadable(x=IEC2, standard="Unix", width=NULL, digits=7), ++ humanReadable(x=IEC2, standard="Unix", width=NULL, digits=3), ++ humanReadable(x=IEC2, standard="Unix", width=NULL, digits=2), ++ humanReadable(x=IEC2, standard="Unix", width=NULL, digits=1)) + [,1] [,2] [,3] [,4] + [1,] " 1.5000000 B " " 1.500 B " " 1.50 B " " 1.5 B " + [2,] " 1.2683780 kB" " 1.268 kB" " 1.27 kB" " 1.3 kB" + [3,] " 1.2284981 MB" " 1.228 MB" " 1.23 MB" " 1.2 MB" + [4,] " 1.2440094 GB" " 1.244 GB" " 1.24 GB" " 1.2 GB" + [5,] " 1.4756474 TB" " 1.476 TB" " 1.48 TB" " 1.5 TB" + [6,] " 1.3668711 PB" " 1.367 PB" " 1.37 PB" " 1.4 PB" + [7,] " 1.2132416 EB" " 1.213 EB" " 1.21 EB" " 1.2 EB" + [8,] " 1.3718619 ZB" " 1.372 ZB" " 1.37 ZB" " 1.4 ZB" + [9,] " 1.1946775 YB" " 1.195 YB" " 1.19 YB" " 1.2 YB" +[10,] "1201.1346574 YB" "1201.135 YB" "1201.13 YB" "1201.1 YB" + [,5] [,6] [,7] [,8] + [1,] " 1.5000000 B " " 1.500 B " " 1.50 B " " 1.5 B " + [2,] " 1.2572859 KiB" " 1.257 KiB" " 1.26 KiB" " 1.3 KiB" + [3,] " 1.8375086 MiB" " 1.838 MiB" " 1.84 MiB" " 1.8 MiB" + [4,] " 1.2666626 GiB" " 1.267 GiB" " 1.27 GiB" " 1.3 GiB" + [5,] " 1.4234036 TiB" " 1.423 TiB" " 1.42 TiB" " 1.4 TiB" + [6,] " 1.3249855 PiB" " 1.325 PiB" " 1.32 PiB" " 1.3 PiB" + [7,] " 1.5439083 EiB" " 1.544 EiB" " 1.54 EiB" " 1.5 EiB" + [8,] " 1.2329980 ZiB" " 1.233 ZiB" " 1.23 ZiB" " 1.2 ZiB" + [9,] " 1.2125791 YiB" " 1.213 YiB" " 1.21 YiB" " 1.2 YiB" +[10,] "1489.0123170 YiB" "1489.012 YiB" "1489.01 YiB" "1489.0 YiB" + [,9] [,10] [,11] [,12] + [1,] " 1.5000000 B" " 1.500 B" " 1.50 B" " 1.5 B" + [2,] " 1.2572859 K" " 1.257 K" " 1.26 K" " 1.3 K" + [3,] " 1.8375086 M" " 1.838 M" " 1.84 M" " 1.8 M" + [4,] " 1.2666626 G" " 1.267 G" " 1.27 G" " 1.3 G" + [5,] " 1.4234036 T" " 1.423 T" " 1.42 T" " 1.4 T" + [6,] " 1.3249855 P" " 1.325 P" " 1.32 P" " 1.3 P" + [7,] " 1.5439083 E" " 1.544 E" " 1.54 E" " 1.5 E" + [8,] " 1.2329980 Z" " 1.233 Z" " 1.23 Z" " 1.2 Z" + [9,] " 1.2125791 Y" " 1.213 Y" " 1.21 Y" " 1.2 Y" +[10,] "1489.0123170 Y" "1489.012 Y" "1489.01 Y" "1489.0 Y" +> +> # Single unit, specify width +> cbind(humanReadable(x=SI1, units="GB", standard="SI", width=7), ++ humanReadable(x=SI1, units="GB", standard="SI", width=5), ++ humanReadable(x=SI1, units="GB", standard="SI", width=3), ++ humanReadable(x=IEC1, units="GiB", standard="IEC", width=7), ++ humanReadable(x=IEC1, units="GiB", standard="IEC", width=5), ++ humanReadable(x=IEC1, units="GiB", standard="IEC", width=3), ++ humanReadable(x=IEC1, units="G", standard="Unix", width=7), ++ humanReadable(x=IEC1, units="G", standard="Unix", width=5), ++ humanReadable(x=IEC1, units="G", standard="Unix", width=3) ++ ) + [,1] [,2] [,3] [,4] [,5] [,6] + [1,] "5e-10 GB" "5e-10 GB" "5e-10 GB" "5e-10 GiB" "5e-10 GiB" "5e-10 GiB" + [2,] "6e-07 GB" "6e-07 GB" "6e-07 GB" "6e-07 GiB" "6e-07 GiB" "6e-07 GiB" + [3,] "7e-04 GB" "7e-04 GB" "7e-04 GB" "7e-04 GiB" "7e-04 GiB" "7e-04 GiB" + [4,] "8e-01 GB" "8e-01 GB" "8e-01 GB" "8e-01 GiB" "8e-01 GiB" "8e-01 GiB" + [5,] "7e+02 GB" "7e+02 GB" "7e+02 GB" "3e+02 GiB" "3e+02 GiB" "3e+02 GiB" + [6,] "8e+05 GB" "8e+05 GB" "8e+05 GB" "7e+05 GiB" "7e+05 GiB" "7e+05 GiB" + [7,] "8e+08 GB" "8e+08 GB" "8e+08 GB" "8e+08 GiB" "8e+08 GiB" "8e+08 GiB" + [8,] "8e+11 GB" "8e+11 GB" "8e+11 GB" "5e+11 GiB" "5e+11 GiB" "5e+11 GiB" + [9,] "7e+14 GB" "7e+14 GB" "7e+14 GB" "9e+14 GiB" "9e+14 GiB" "9e+14 GiB" +[10,] "8e+17 GB" "8e+17 GB" "8e+17 GB" "6e+17 GiB" "6e+17 GiB" "6e+17 GiB" + [,7] [,8] [,9] + [1,] "5e-10 G" "5e-10 G" "5e-10 G" + [2,] "6e-07 G" "6e-07 G" "6e-07 G" + [3,] "7e-04 G" "7e-04 G" "7e-04 G" + [4,] "8e-01 G" "8e-01 G" "8e-01 G" + [5,] "3e+02 G" "3e+02 G" "3e+02 G" + [6,] "7e+05 G" "7e+05 G" "7e+05 G" + [7,] "8e+08 G" "8e+08 G" "8e+08 G" + [8,] "5e+11 G" "5e+11 G" "5e+11 G" + [9,] "9e+14 G" "9e+14 G" "9e+14 G" +[10,] "6e+17 G" "6e+17 G" "6e+17 G" +> +> # Single unit, specify digits +> cbind(humanReadable(x=SI1, units="GB", standard="SI", width=NULL, digits=7), ++ humanReadable(x=SI1, units="GB", standard="SI", width=NULL, digits=3), ++ humanReadable(x=SI1, units="GB", standard="SI", width=NULL, digits=2), ++ humanReadable(x=SI1, units="GB", standard="SI", width=NULL, digits=1), ++ humanReadable(x=IEC1, units="GiB", standard="IEC", width=NULL, digits=7), ++ humanReadable(x=IEC1, units="GiB", standard="IEC", width=NULL, digits=3), ++ humanReadable(x=IEC1, units="GiB", standard="IEC", width=NULL, digits=2), ++ humanReadable(x=IEC1, units="GiB", standard="IEC", width=NULL, digits=1), ++ humanReadable(x=IEC1, units="G", standard="Unix", width=NULL, digits=7), ++ humanReadable(x=IEC1, units="G", standard="Unix", width=NULL, digits=3), ++ humanReadable(x=IEC1, units="G", standard="Unix", width=NULL, digits=2), ++ humanReadable(x=IEC1, units="G", standard="Unix", width=NULL, digits=1) ++ ) + [,1] [,2] [,3] [,4] + [1,] "5.000000e-10 GB" "5.00e-10 GB" "5.0e-10 GB" "5e-10 GB" + [2,] "6.388137e-07 GB" "6.39e-07 GB" "6.4e-07 GB" "6e-07 GB" + [3,] "7.101117e-04 GB" "7.10e-04 GB" "7.1e-04 GB" "7e-04 GB" + [4,] "8.188110e-01 GB" "8.19e-01 GB" "8.2e-01 GB" "8e-01 GB" + [5,] "6.706597e+02 GB" "6.71e+02 GB" "6.7e+02 GB" "7e+02 GB" + [6,] "8.067884e+05 GB" "8.07e+05 GB" "8.1e+05 GB" "8e+05 GB" + [7,] "7.758668e+08 GB" "7.76e+08 GB" "7.8e+08 GB" "8e+08 GB" + [8,] "7.861707e+11 GB" "7.86e+11 GB" "7.9e+11 GB" "8e+11 GB" + [9,] "7.495958e+14 GB" "7.50e+14 GB" "7.5e+14 GB" "7e+14 GB" +[10,] "7.655714e+17 GB" "7.66e+17 GB" "7.7e+17 GB" "8e+17 GB" + [,5] [,6] [,7] [,8] + [1,] "4.656613e-10 GiB" "4.66e-10 GiB" "4.7e-10 GiB" "5e-10 GiB" + [2,] "6.058649e-07 GiB" "6.06e-07 GiB" "6.1e-07 GiB" "6e-07 GiB" + [3,] "7.437373e-04 GiB" "7.44e-04 GiB" "7.4e-04 GiB" "7e-04 GiB" + [4,] "7.890501e-01 GiB" "7.89e-01 GiB" "7.9e-01 GiB" "8e-01 GiB" + [5,] "2.665461e+02 GiB" "2.67e+02 GiB" "2.7e+02 GiB" "3e+02 GiB" + [6,] "6.781352e+05 GiB" "6.78e+05 GiB" "6.8e+05 GiB" "7e+05 GiB" + [7,] "7.658425e+08 GiB" "7.66e+08 GiB" "7.7e+08 GiB" "8e+08 GiB" + [8,] "4.681329e+11 GiB" "4.68e+11 GiB" "4.7e+11 GiB" "5e+11 GiB" + [9,] "8.705167e+14 GiB" "8.71e+14 GiB" "8.7e+14 GiB" "9e+14 GiB" +[10,] "6.227605e+17 GiB" "6.23e+17 GiB" "6.2e+17 GiB" "6e+17 GiB" + [,9] [,10] [,11] [,12] + [1,] "4.656613e-10 G" "4.66e-10 G" "4.7e-10 G" "5e-10 G" + [2,] "6.058649e-07 G" "6.06e-07 G" "6.1e-07 G" "6e-07 G" + [3,] "7.437373e-04 G" "7.44e-04 G" "7.4e-04 G" "7e-04 G" + [4,] "7.890501e-01 G" "7.89e-01 G" "7.9e-01 G" "8e-01 G" + [5,] "2.665461e+02 G" "2.67e+02 G" "2.7e+02 G" "3e+02 G" + [6,] "6.781352e+05 G" "6.78e+05 G" "6.8e+05 G" "7e+05 G" + [7,] "7.658425e+08 G" "7.66e+08 G" "7.7e+08 G" "8e+08 G" + [8,] "4.681329e+11 G" "4.68e+11 G" "4.7e+11 G" "5e+11 G" + [9,] "8.705167e+14 G" "8.71e+14 G" "8.7e+14 G" "9e+14 G" +[10,] "6.227605e+17 G" "6.23e+17 G" "6.2e+17 G" "6e+17 G" +> +> +> stopifnot( is.object_sizes(as.object_sizes( 2^(1:30) ) ) ) +> stopifnot( format(as.object_sizes(124)) == "124 bytes") +> stopifnot( format(as.object_sizes(124e8), units="auto") == "11.5 GiB") +> stopifnot( format(as.object_sizes(124e8), humanReadable=TRUE) == "11.5 GiB") +> stopifnot( format(as.object_sizes(124e8), units="bytes") == "1.24e+10 bytes") +> +> tools::assertError( as.object_sizes(-1) ) +> tools::assertError( as.object_sizes('a') ) +> tools::assertError( as.object_sizes(list()) ) +> tools::assertError( as.object_sizes(NULL) ) +> tools::assertError( as.object_sizes(0+1i) ) +> +> stopifnot( format(as.object_sizes(1e40) ) == "1e+40 bytes" ) +> stopifnot( format(as.object_sizes(1e40), units="auto" ) == "8.271806e+15 YiB") +> stopifnot( format(as.object_sizes(1e40), units="bytes") == "1e+40 bytes" ) +> stopifnot( format(as.object_sizes(1e40), humanReadable=TRUE) == "8.271806e+15 YiB") +> stopifnot( format(as.object_sizes(1e40), humanReadable=FALSE) == "1e+40 bytes") +> +> options(humanReadable=TRUE) +> stopifnot( format(as.object_sizes(1e40) ) == "8.271806e+15 YiB") +> options(humanReadable=FALSE) +> +> proc.time() + user system elapsed + 0.411 0.048 0.455 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2015-04-25 06:26:53
|
Revision: 1958 http://sourceforge.net/p/r-gregmisc/code/1958 Author: warnes Date: 2015-04-25 06:26:40 +0000 (Sat, 25 Apr 2015) Log Message: ----------- Update DESCRIPTION, ChangeLog, and NEWS Modified Paths: -------------- trunk/gdata/DESCRIPTION trunk/gdata/inst/ChangeLog trunk/gdata/inst/NEWS Modified: trunk/gdata/DESCRIPTION =================================================================== --- trunk/gdata/DESCRIPTION 2015-04-25 05:54:28 UTC (rev 1957) +++ trunk/gdata/DESCRIPTION 2015-04-25 06:26:40 UTC (rev 1958) @@ -5,7 +5,7 @@ SystemRequirements: perl Imports: gtools Version: 2.16.0 -Date: 2015-04-21 +Date: 2015-04-25 Author: Gregory R. Warnes, Ben Bolker, Gregor Gorjanc, Gabor Grothendieck, Ales Korosec, Thomas Lumley, Don MacQueen, Arni Magnusson, Jim Rogers, and others Modified: trunk/gdata/inst/ChangeLog =================================================================== --- trunk/gdata/inst/ChangeLog 2015-04-25 05:54:28 UTC (rev 1957) +++ trunk/gdata/inst/ChangeLog 2015-04-25 06:26:40 UTC (rev 1958) @@ -1,59 +1,101 @@ -2015-04-23 warnes +2015-04-23 22:49 warnes - * [r1952] R/write.fwf.R: - write.fwf() now properly supports - matrix objects, including matrix objects wihtout column - names. (Reported by Carl Witthoft.) - * [r1951] inst/perl/xls2csv.pl: Remove 'use POSIX' from xls2csv.pl - since it is no longer needed - * [r1939] inst/ChangeLog, inst/NEWS: Update NEWS and ChangeLog - * [r1938] R/reorder.R: reorder.factor() now hands off processing to + * inst/ChangeLog, inst/NEWS: Update NEWS and ChangeLog + +2015-04-23 22:41 warnes + + * R/write.fwf.R: - write.fwf() now properly supports matrix + objects, including matrix + objects wihtout column names. (Reported by Carl Witthoft.) + +2015-04-23 21:55 warnes + + * inst/perl/xls2csv.pl: Remove 'use POSIX' from xls2csv.pl since it + is no longer needed + +2015-04-23 17:40 warnes + + * inst/ChangeLog, inst/NEWS: Update NEWS and ChangeLog + +2015-04-23 17:37 warnes + + * R/reorder.R: reorder.factor() now hands off processing to stats:::reorder.default() when either 'X' or 'FUN' is specified. -2015-04-22 warnes +2015-04-22 23:18 warnes - * [r1937] inst/ChangeLog, inst/NEWS: Update NEWS and ChangeLog for - changes to humanReadable() - * [r1936] DESCRIPTION, R/humanReadable.R, R/object.size.R, + * inst/ChangeLog, inst/NEWS: Update NEWS and ChangeLog for changes + to humanReadable() + +2015-04-22 23:14 warnes + + * DESCRIPTION, R/humanReadable.R, R/object.size.R, man/humanReadable.Rd: Fix 'units' argument of humanReadable() - * [r1935] man/object.size.Rd: Update object.size() man page to - reflect change in class of return value from 'object_size' to + +2015-04-22 22:44 warnes + + * man/object.size.Rd: Update object.size() man page to reflect + change in class of return value from 'object_size' to 'object_sizes' - * [r1934] inst/ChangeLog, inst/NEWS: Update NEWS and ChangeLog for - gdata 2.16.0 - * [r1933] NAMESPACE, R/object.size.R: Modify gdaata:object.size to - generate S3 objects of class 'object_sizes' (note the final 's') - to avoid conflicts with methods in utils for object_size. - * [r1932] R/reorder.R, tests/test.reorder.factor.R, + +2015-04-22 22:41 warnes + + * inst/ChangeLog, inst/NEWS: Update NEWS and ChangeLog for gdata + 2.16.0 + +2015-04-22 22:34 warnes + + * NAMESPACE, R/object.size.R: Modify gdaata:object.size to generate + S3 objects of class 'object_sizes' (note the final 's') to avoid + conflicts with methods in utils for object_size. + +2015-04-22 22:32 warnes + + * R/reorder.R, tests/test.reorder.factor.R, tests/test.reorder.factor.Rout.save: Correct behavior of reorder.factor() when argument 'X' is supplied by delgating to stats:::reorder.default() -2015-04-14 warnes +2015-04-14 22:02 warnes - * [r1929] inst/ChangeLog: Update ChangeLog - * [r1928] man/write.fwf.Rd: Remove editorializing - * [r1927] inst/ChangeLog, inst/NEWS: Update NEWS and ChangeLog for - gdata 2.15.0 - * [r1926] R/write.fwf.R, man/write.fwf.Rd: Add 'scientific' - argument to write.fwf to allow control of whether numeric values - can be displated using scientific notation. - * [r1925] inst/perl/xls2csv.pl: Replace depricated PERL function - POSIX::isnumeric with equivalent regexp - * [r1924] inst/ChangeLog: Add gdata ChangeLog to SVN + * inst/ChangeLog: Update ChangeLog -2015-04-10 warnes +2015-04-14 22:02 warnes - * [r1922] DESCRIPTION, NAMESPACE, inst/NEWS: Update files for gdata + * man/write.fwf.Rd: Remove editorializing + +2015-04-14 21:55 warnes + + * inst/ChangeLog, inst/NEWS: Update NEWS and ChangeLog for gdata 2.15.0 -2015-04-08 warnes +2015-04-14 21:52 warnes - * [r1919] R/first.R, man/first.Rd, man/left.Rd: Move - first/last/left/right to from gtools to gdata + * R/write.fwf.R, man/write.fwf.Rd: Add 'scientific' argument to + write.fwf to allow control of whether numeric values can be + displated using scientific notation. -2014-08-28 warnes +2015-04-14 20:52 warnes - * [r1883] R/trim.R, inst/NEWS, inst/perl/xls2csv.pl, + * inst/perl/xls2csv.pl: Replace depricated PERL function + POSIX::isnumeric with equivalent regexp + +2015-04-14 19:43 warnes + + * inst/ChangeLog: Add gdata ChangeLog to SVN + +2015-04-10 03:15 warnes + + * DESCRIPTION, NAMESPACE, inst/NEWS: Update files for gdata 2.15.0 + +2015-04-08 19:55 warnes + + * R/first.R, man/first.Rd, man/left.Rd: Move first/last/left/right + to from gtools to gdata + +2014-08-28 15:01 warnes + + * R/trim.R, inst/NEWS, inst/perl/xls2csv.pl, inst/xls/ExampleExcelFile.xls, inst/xls/ExampleExcelFile.xlsx, inst/xls/ExampleExcelFile_1900.xls, inst/xls/ExampleExcelFile_1900.xlsx, @@ -61,36 +103,64 @@ inst/xls/ExampleExcelFile_1904.xlsx, tests/test.read.xls.R, tests/test.read.xls.Rout.save, tests/tests.write.fwf.Rout.save: Everything works now! - * [r1882] inst/perl/Spreadsheet/ParseExcel/FmtDefault.pm: Suppress - annoying warnings in Spreadsheet::ParseXLS::FmtDefalt. - * [r1881] inst/xls/ExampleExcelFile_1900.xls, + +2014-08-28 05:22 warnes + + * inst/perl/Spreadsheet/ParseExcel/FmtDefault.pm: Suppress annoying + warnings in Spreadsheet::ParseXLS::FmtDefalt. + +2014-08-28 05:17 warnes + + * inst/xls/ExampleExcelFile_1900.xls, inst/xls/ExampleExcelFile_1900.xlsx, inst/xls/ExampleExcelFile_1904.xls, inst/xls/ExampleExcelFile_1904.xlsx, tests/test.read.xls.R: Add tests and corresponding test files for 1900 and 1904 based XLX/XLSX files - * [r1880] inst/perl/Spreadsheet/XLSX, - inst/perl/Spreadsheet/XLSX.pm, inst/perl/install_modules.pl, - inst/perl/module_tools.pl, inst/perl/sheetCount.pl, - inst/perl/supportedFormats.pl: Complete transition from - Spreadsheet::XLSX to Spreadsheet::ParseXLSX - * [r1879] inst/perl/xls2csv.pl: Handle Excel files created on the - Mac, where by default Excel uses + +2014-08-28 04:56 warnes + + * inst/perl/Spreadsheet/XLSX, inst/perl/Spreadsheet/XLSX.pm, + inst/perl/install_modules.pl, inst/perl/module_tools.pl, + inst/perl/sheetCount.pl, inst/perl/supportedFormats.pl: Complete + transition from Spreadsheet::XLSX to Spreadsheet::ParseXLSX + +2014-08-28 04:55 warnes + + * inst/perl/xls2csv.pl: Handle Excel files created on the Mac, + where by default Excel uses 1904-01-01 as the baseline for dates, rather than the usual 1900-01-01. - * [r1878] inst/perl/Crypt/.exists, inst/perl/XML/.exists: Remove - dotfiles - * [r1877] DESCRIPTION, inst/NEWS: Update for release - * [r1876] inst/xls/wide.xls, inst/xls/wide.xlsx: Add test for - handling fo very wide xls and xlsx files. - * [r1875] tests/test.read.xls.R: Add test for handling fo very wide - xls and xlsx files. - * [r1874] inst/perl/module_tools.pl, inst/perl/sheetCount.pl, + +2014-08-28 03:08 warnes + + * inst/perl/Crypt/.exists, inst/perl/XML/.exists: Remove dotfiles + +2014-08-28 02:08 warnes + + * DESCRIPTION, inst/NEWS: Update for release + +2014-08-28 02:01 warnes + + * inst/xls/wide.xls, inst/xls/wide.xlsx: Add test for handling fo + very wide xls and xlsx files. + +2014-08-28 02:00 warnes + + * tests/test.read.xls.R: Add test for handling fo very wide xls and + xlsx files. + +2014-08-28 01:50 warnes + + * inst/perl/module_tools.pl, inst/perl/sheetCount.pl, inst/perl/xls2csv.pl: Modify code to use latest version of Spreadsheet::ParseExcel and to replace Spreadsheet::XLSX woth Spreadsheet::ParseXLSX - * [r1873] inst/perl/Crypt, inst/perl/Crypt/.exists, - inst/perl/Crypt/RC4.pm, inst/perl/Digest, inst/perl/Digest/Perl, + +2014-08-28 01:28 warnes + + * inst/perl/Crypt, inst/perl/Crypt/.exists, inst/perl/Crypt/RC4.pm, + inst/perl/Digest, inst/perl/Digest/Perl, inst/perl/Digest/Perl/MD5.pm, inst/perl/Graphics, inst/perl/Graphics/ColorUtils.pm, inst/perl/Spreadsheet/ParseExcel.pm, @@ -114,44 +184,93 @@ inst/perl/XML/Twig/XPath.pm: Update Spreadsheet::ParseExcel, add Spreadsheet:ParseXLSX, add dependencies -2014-04-05 warnes +2014-04-05 21:08 warnes - * [r1801] tests/unitTests/runit.unknown.R: Apply same changes to + * tests/unitTests/runit.unknown.R: Apply same changes to NAToUnknown that were previously applied to unknownToNA for POSIXlt. - * [r1800] inst/NEWS: Update NEWS with latest changes - * [r1799] R/nobs.R: Call stats::nobs instead of - stats:::nobs.default within + +2014-04-05 18:41 warnes + + * inst/NEWS: Update NEWS with latest changes + +2014-04-05 18:38 warnes + + * R/nobs.R: Call stats::nobs instead of stats:::nobs.default within gdata::nobs.default. This avoids R CMD check warning. - * [r1798] tests/unitTests/runit.unknown.R: Don't compare optional - POSIXlt field. Explicitly compare POSIXlt, with special handling - of '-1' unknown value. - * [r1797] R/mapLevels.R, R/unknown.R: Don't use gdata:::<foo> - prefix to access gdata function <foo> - * [r1796] DESCRIPTION: Fix syntax error in DESCRIPTION file. - * [r1795] tests/runRUnitTests.R: Package name needs to be defined - outside of if test. - * [r1794] vignettes/Rnews.sty: Style file needed - * [r1793] R/unknown.R, tests/unitTests/runit.unknown.R: The issue - Brian pointed out was an error in the isUnknown() code, not an - error in the unit tests! - * [r1792] tests/unitTests/runit.unknown.R: Apply changes Brian - recommned to NAtoUnknown as well as unknownToNA. - * [r1791] inst/NEWS: Update NEWS file - * [r1790] inst/doc/Rnews.dtx: Don't need latex .dtx source file - * [r1789] inst/doc/mapLevels.Rnw, inst/doc/unknown.Rnw, vignettes, + +2014-04-05 18:22 warnes + + * tests/unitTests/runit.unknown.R: Don't compare optional POSIXlt + field. Explicitly compare POSIXlt, with special handling of '-1' + unknown value. + +2014-04-05 18:19 warnes + + * R/mapLevels.R, R/unknown.R: Don't use gdata:::<foo> prefix to + access gdata function <foo> + +2014-04-05 17:01 warnes + + * DESCRIPTION: Fix syntax error in DESCRIPTION file. + +2014-04-05 17:00 warnes + + * tests/runRUnitTests.R: Package name needs to be defined outside + of if test. + +2014-04-05 17:00 warnes + + * vignettes/Rnews.sty: Style file needed + +2014-04-05 16:59 warnes + + * R/unknown.R, tests/unitTests/runit.unknown.R: The issue Brian + pointed out was an error in the isUnknown() code, not an error in + the unit tests! + +2014-04-05 15:55 warnes + + * tests/unitTests/runit.unknown.R: Apply changes Brian recommned to + NAtoUnknown as well as unknownToNA. + +2014-04-05 14:40 warnes + + * inst/NEWS: Update NEWS file + +2014-04-05 14:38 warnes + + * inst/doc/Rnews.dtx: Don't need latex .dtx source file + +2014-04-05 14:26 warnes + + * inst/doc/mapLevels.Rnw, inst/doc/unknown.Rnw, vignettes, vignettes/mapLevels.Rnw, vignettes/unknown.Rnw: Move vignettes from inst/doc/ to vignettes/ - * [r1788] R/aggregate.table.R, man/aggregate.table.Rd, + +2014-04-05 13:57 warnes + + * R/aggregate.table.R, man/aggregate.table.Rd, man/gdata-defunct.Rd: Change 'aggregate.table' from deprecated to defunct. - * [r1787] DESCRIPTION, inst/unitTests, man/gdata-package.Rd, + +2014-04-05 12:53 warnes + + * DESCRIPTION, inst/unitTests, man/gdata-package.Rd, tests/runRUnitTests.R, tests/unitTests: Complete changes so that the unit tests are run as part of R CMD check - * [r1786] DESCRIPTION, inst/NEWS: Update NEWS for gdata 2.13.4 - * [r1785] NAMESPACE: Update NAMESPACE file to remove deleted - function - * [r1784] inst/unitTests/Makefile, inst/unitTests/runit.bindData.R, + +2014-04-05 02:25 warnes + + * DESCRIPTION, inst/NEWS: Update NEWS for gdata 2.13.4 + +2014-04-05 02:25 warnes + + * NAMESPACE: Update NAMESPACE file to remove deleted function + +2014-04-05 02:23 warnes + + * inst/unitTests/Makefile, inst/unitTests/runit.bindData.R, inst/unitTests/runit.cbindX.R, inst/unitTests/runit.drop.levels.R, inst/unitTests/runit.getDateTimeParts.R, @@ -169,10 +288,16 @@ tests/runit.wideByFactor.R, tests/runit.write.fwf.R: Move unit test files back to inst/unitTests. Fix up runRUnitTests.R to work properly in the new location - * [r1783] tests/runit.unknown.R: - For unit tests, don't check for - equality of optional POSIXlt + +2014-04-05 01:27 warnes + + * tests/runit.unknown.R: - For unit tests, don't check for equality + of optional POSIXlt components. (Bug reported by Brian Ripley). - * [r1782] R/runRUnitTests.R, inst/unitTests/Makefile, + +2014-04-05 01:08 warnes + + * R/runRUnitTests.R, inst/unitTests/Makefile, inst/unitTests/runRUnitTests.R, inst/unitTests/runit.bindData.R, inst/unitTests/runit.cbindX.R, inst/unitTests/runit.drop.levels.R, @@ -191,80 +316,115 @@ tests/runit.wideByFactor.R, tests/runit.write.fwf.R: Move unit test code into the (now) standard location -2014-03-19 arnima +2014-03-19 10:04 arnima - * [r1777] R/keep.R: change warning message to R standards + * R/keep.R: change warning message to R standards -2013-12-18 arnima +2013-12-18 14:33 arnima - * [r1758] R/ll.R: Retain original list order unless sort=FALSE; - also stop if unnamed list + * R/ll.R: Retain original list order unless sort=FALSE; also stop + if unnamed list -2013-12-16 warnes +2013-12-16 19:58 warnes - * [r1757] R/trim.R: Trim will now remove all types of - leading/trailing whitespace by using + * R/trim.R: Trim will now remove all types of leading/trailing + whitespace by using the [:blank:] character class. -2013-06-29 warnes +2013-06-29 01:40 warnes - * [r1692] inst/NEWS: Update NEWS for second try for gdata 2.13.2 - * [r1691] R/ll.R: Simplify ll() by stuffing list arguments into an + * inst/NEWS: Update NEWS for second try for gdata 2.13.2 + +2013-06-29 01:37 warnes + + * R/ll.R: Simplify ll() by stuffing list arguments into an environment, avoiding the need to use attach/detach. -2013-06-28 warnes +2013-06-28 21:31 warnes - * [r1685] inst/NEWS: Update NEWS for gdata 2.13.2 - * [r1684] tests/test.read.xls.Rout.save, - tests/tests.write.fwf.Rout.save: Minor update to - tests/*.Rout.save - * [r1683] R/ll.R: Add on.exit() handler to ensure a matching detach - occurs when attach is used in ll() - * [r1682] DESCRIPTION: Update for gdata 2.13.2 - * [r1681] R/aggregate.table.R: Improve deprecated message + * inst/NEWS: Update NEWS for gdata 2.13.2 -2013-03-24 warnes +2013-06-28 21:24 warnes - * [r1645] tests/test.read.xls.Rout.save, - tests/tests.write.fwf.Rout.save: Update test files for code - changes - * [r1644] inst/NEWS: Fix formatting in NEWS - * [r1643] DESCRIPTION, inst/NEWS, man/read.xls.Rd, - man/sheetCount.Rd, tests/test.read.xls.R: Replaced calls to - depreciated function ".path.package" with the new public function - "path.package". + * tests/test.read.xls.Rout.save, tests/tests.write.fwf.Rout.save: + Minor update to tests/*.Rout.save -2013-01-14 warnes +2013-06-28 21:22 warnes - * [r1639] R/installXLSXsupport.R, R/sheetCount.R, R/xls2sep.R, + * R/ll.R: Add on.exit() handler to ensure a matching detach occurs + when attach is used in ll() + +2013-06-28 20:29 warnes + + * DESCRIPTION: Update for gdata 2.13.2 + +2013-06-28 20:26 warnes + + * R/aggregate.table.R: Improve deprecated message + +2013-03-24 04:50 warnes + + * tests/test.read.xls.Rout.save, tests/tests.write.fwf.Rout.save: + Update test files for code changes + +2013-03-24 04:36 warnes + + * inst/NEWS: Fix formatting in NEWS + +2013-03-24 04:34 warnes + + * DESCRIPTION, inst/NEWS, man/read.xls.Rd, man/sheetCount.Rd, + tests/test.read.xls.R: Replaced calls to depreciated function + ".path.package" with the new public function "path.package". + +2013-01-14 20:47 warnes + + * R/installXLSXsupport.R, R/sheetCount.R, R/xls2sep.R, R/xlsFormats.R: Replace (obsolete) '.path.package' with 'find.package' function. -2012-09-20 warnes +2012-09-20 17:35 warnes - * [r1622] man/MedUnits.Rd, man/ans.Rd, man/duplicated2.Rd: Correct - .Rd file errors detected by 'R CMD check'. - * [r1621] NAMESPACE: Add duplicated() and ans() to the NAMESPACE. - * [r1620] DESCRIPTION, inst/NEWS: Update for gdata 2.13.0. - * [r1619] man/ConvertMedUnits.Rd: Fix typographic error. - * [r1618] R/ans.R, R/duplicated2.R, man/ans.Rd, man/duplicated2.Rd: - Add 'ans()' and 'duplicated()' contributed by Liviu Andronic. + * man/MedUnits.Rd, man/ans.Rd, man/duplicated2.Rd: Correct .Rd file + errors detected by 'R CMD check'. -2012-09-19 warnes +2012-09-20 17:15 warnes - * [r1617] data/MedUnits.rda: Correct column names. Unit columns - were reversed and misspelled. - * [r1616] R/sheetCount.R: Add ignore.stderr to system command in - sheetCmd() to prevent stderr + * NAMESPACE: Add duplicated() and ans() to the NAMESPACE. + +2012-09-20 17:12 warnes + + * DESCRIPTION, inst/NEWS: Update for gdata 2.13.0. + +2012-09-20 15:42 warnes + + * man/ConvertMedUnits.Rd: Fix typographic error. + +2012-09-20 15:39 warnes + + * R/ans.R, R/duplicated2.R, man/ans.Rd, man/duplicated2.Rd: Add + 'ans()' and 'duplicated()' contributed by Liviu Andronic. + +2012-09-19 18:30 warnes + + * data/MedUnits.rda: Correct column names. Unit columns were + reversed and misspelled. + +2012-09-19 18:02 warnes + + * R/sheetCount.R: Add ignore.stderr to system command in sheetCmd() + to prevent stderr messages from being included in the captured output from the perl script. -2012-09-12 warnes +2012-09-12 17:40 warnes - * [r1606] DESCRIPTION, inst/NEWS: Update for gdata 2.12.0 - * [r1605] R/aggregate.table.R, man/aggregate.table.Rd: - 'stats::aggregate' was made into a generic on 27-Jan-2010, so - that + * DESCRIPTION, inst/NEWS: Update for gdata 2.12.0 + +2012-09-12 17:39 warnes + + * R/aggregate.table.R, man/aggregate.table.Rd: 'stats::aggregate' + was made into a generic on 27-Jan-2010, so that attempting to call 'aggregate' on a 'table' object will now incorrectly call 'aggregate.table'. Since 'aggregate.table' can be @@ -275,31 +435,48 @@ the 'aggregate.table' function will now display a warning that it is depreciated and recommending the equivalent call to tapply. It will be removed entirely in a future version of gdata. - * [r1604] .Rinstignore: Don't ignore .Rnw files, but do ignore .svn - files. -2012-09-11 warnes +2012-09-12 17:29 warnes - * [r1603] man/interleave.Rd: Clarify workding of DROP argument to + * .Rinstignore: Don't ignore .Rnw files, but do ignore .svn files. + +2012-09-11 20:41 warnes + + * man/interleave.Rd: Clarify workding of DROP argument to interleave(). - * [r1602] man/interleave.Rd: Replace call to aggregate.table() with + +2012-09-11 20:37 warnes + + * man/interleave.Rd: Replace call to aggregate.table() with equivalent tapply() call since aggregate.table() is being depreciated. -2012-08-22 warnes +2012-08-22 16:47 warnes - * [r1601] DESCRIPTION, inst/NEWS: Update DESCRIPTION and NEWS for - gdate 2.11.1. - * [r1600] man/read.xls.Rd: Add example for read.xls() that shows - how to use the fileEncoding + * DESCRIPTION, inst/NEWS: Update DESCRIPTION and NEWS for gdate + 2.11.1. + +2012-08-22 16:42 warnes + + * man/read.xls.Rd: Add example for read.xls() that shows how to use + the fileEncoding argument to read in latin-1 encoded data. - * [r1599] tests/latin-1.xls, tests/test.read.xls.R, + +2012-08-22 16:41 warnes + + * tests/latin-1.xls, tests/test.read.xls.R, tests/test.read.xls.Rout.save: Add XLSX test for latin-1 characters, and look for them in their new location in inst/xls/. - * [r1598] inst/xls/latin-1.xls, inst/xls/latin-1.xlsx: add XLSX - version of latin-1.xls - * [r1597] tests/latin-1.xls, tests/test.read.xls.R, + +2012-08-22 16:35 warnes + + * inst/xls/latin-1.xls, inst/xls/latin-1.xlsx: add XLSX version of + latin-1.xls + +2012-08-22 15:48 warnes + + * tests/latin-1.xls, tests/test.read.xls.R, tests/test.read.xls.Rout.save: Add test file and code to ensure that read.xls() can properly handle files with alternative encodings. latin-1.xls contains each of @@ -307,23 +484,34 @@ non-ascii latin-1 special characters in both the column headings and the body of the file. - * [r1596] R/read.xls.R: Change code to have R read the csv/tab data - from the file rather than + +2012-08-22 15:45 warnes + + * R/read.xls.R: Change code to have R read the csv/tab data from + the file rather than from the connetion we made, so that file encodings can be properly handled. - * [r1595] R/read.xls.R: Always close the connection. -2012-08-13 warnes +2012-08-22 14:29 warnes - * [r1594] inst/perl/xls2csv.pl: Remove trailing space from output - line. + * R/read.xls.R: Always close the connection. -2012-06-18 warnes +2012-08-13 22:13 warnes - * [r1567] inst/NEWS: Update NEWS for 2.11.0 release. - * [r1566] DESCRIPTION: Bump version number and add - SystemRequirements for perl. - * [r1565] R/xls2sep.R, inst/perl/xls2csv.pl, man/read.xls.Rd, + * inst/perl/xls2csv.pl: Remove trailing space from output line. + +2012-06-18 20:32 warnes + + * inst/NEWS: Update NEWS for 2.11.0 release. + +2012-06-18 20:27 warnes + + * DESCRIPTION: Bump version number and add SystemRequirements for + perl. + +2012-06-18 20:26 warnes + + * R/xls2sep.R, inst/perl/xls2csv.pl, man/read.xls.Rd, tests/test.read.xls.R, tests/test.read.xls.Rout.save: read.xls() and supporting functions now allow blank lines to be preserved, rather than skipped, by supplying the argument @@ -331,180 +519,274 @@ extended to suppor this via an optional "-s" argument which, when present, *preserves* blank lines during the conversion. -2012-06-13 warnes +2012-06-13 01:10 warnes - * [r1564] DESCRIPTION, R/nobs.R, inst/NEWS: - nobs.default needs to - handle logical vectors in addition to numeric + * DESCRIPTION, R/nobs.R, inst/NEWS: - nobs.default needs to handle + logical vectors in addition to numeric vectors. - update DESCRIPTION and NEWS for 2.10.6. - * [r1563] R/nobs.R: nobs.default needs to handle logical as well as - numeric vectors. -2012-06-08 warnes +2012-06-13 01:00 warnes - * [r1562] DESCRIPTION, tests/test.read.xls.Rout.save: Update - DESCRIPTION and tests - * [r1561] tests/test.read.xls.R: fix incorrect function name - * [r1560] DESCRIPTION, man/installXLSXsupport.Rd: Mark example for + * R/nobs.R: nobs.default needs to handle logical as well as numeric + vectors. + +2012-06-08 22:04 warnes + + * DESCRIPTION, tests/test.read.xls.Rout.save: Update DESCRIPTION + and tests + +2012-06-08 21:59 warnes + + * tests/test.read.xls.R: fix incorrect function name + +2012-06-08 20:02 warnes + + * DESCRIPTION, man/installXLSXsupport.Rd: Mark example for installXLSXsupport() to not be executed durin R CMD check. - * [r1559] DESCRIPTION: stats:::nobs.default and stats::nobs.lm - require R > 2.13.0, so add this as a dependency. -2012-06-06 warnes +2012-06-08 19:01 warnes - * [r1552] DESCRIPTION, inst/NEWS: Update for release 2.10.2 - * [r1551] R/nobs.R: Fix bugs in nobs.default. - * [r1550] tests/test.read.xls.Rout.save, - tests/tests.write.fwf.Rout.save: Update to reflect warning on - startup that 'nobs' hides 'stats::nobs'. - * [r1549] man/nobs.Rd: Remove stray non-ASCII characters. - * [r1548] R/nobs.R: The nobs() dispatch method must be defined in - the gdata namespace to + * DESCRIPTION: stats:::nobs.default and stats::nobs.lm require R > + 2.13.0, so add this as a dependency. + +2012-06-06 22:10 warnes + + * DESCRIPTION, inst/NEWS: Update for release 2.10.2 + +2012-06-06 22:09 warnes + + * R/nobs.R: Fix bugs in nobs.default. + +2012-06-06 21:11 warnes + + * tests/test.read.xls.Rout.save, tests/tests.write.fwf.Rout.save: + Update to reflect warning on startup that 'nobs' hides + 'stats::nobs'. + +2012-06-06 21:11 warnes + + * man/nobs.Rd: Remove stray non-ASCII characters. + +2012-06-06 21:07 warnes + + * R/nobs.R: The nobs() dispatch method must be defined in the gdata + namespace to pick up the definition of gdata::nobs.default. - * [r1547] DESCRIPTION, inst/NEWS: Update DESCRIPTION and NEWS for - 2.10.1 release. - * [r1546] NAMESPACE, R/nobs.R, man/nobs.Rd: Define aliases for - 'nobs' and 'nobs.lm' to support backward + +2012-06-06 20:30 warnes + + * DESCRIPTION, inst/NEWS: Update DESCRIPTION and NEWS for 2.10.1 + release. + +2012-06-06 20:26 warnes + + * NAMESPACE, R/nobs.R, man/nobs.Rd: Define aliases for 'nobs' and + 'nobs.lm' to support backward compatibility for packages depending on gdata. - * [r1545] DESCRIPTION, inst/NEWS: Update DESCRIPTION and NEWS for - 2.10.0 release - * [r1544] NAMESPACE, R/startsWith.R, man/startsWith.Rd: - Add - manual page and NAMESPACE entry for startsWith(). + +2012-06-06 01:59 warnes + + * DESCRIPTION, inst/NEWS: Update DESCRIPTION and NEWS for 2.10.0 + release + +2012-06-06 01:53 warnes + + * NAMESPACE, R/startsWith.R, man/startsWith.Rd: - Add manual page + and NAMESPACE entry for startsWith(). - Add 'ignore.case' argument to startsWith(). - * [r1543] tests/test.read.xls.Rout.save: Update to match new code. - * [r1542] man/read.xls.Rd: Replace non-ASCII characters. - * [r1541] R/read.xls.R, man/read.xls.Rd, tests/test.read.xls.R: Add + +2012-06-06 01:26 warnes + + * tests/test.read.xls.Rout.save: Update to match new code. + +2012-06-06 01:25 warnes + + * man/read.xls.Rd: Replace non-ASCII characters. + +2012-06-06 01:21 warnes + + * R/read.xls.R, man/read.xls.Rd, tests/test.read.xls.R: Add na.strings to read.xls call to convert "#DIV/0!" to NA. -2012-06-05 warnes +2012-06-05 20:09 warnes - * [r1540] NAMESPACE: Remove nobs method dispatch and lm methods - since these are now provided by the stats package. - * [r1539] R/env.R: Spell out arguments to ls() to avoid R CMD check + * NAMESPACE: Remove nobs method dispatch and lm methods since these + are now provided by the stats package. + +2012-06-05 20:08 warnes + + * R/env.R: Spell out arguments to ls() to avoid R CMD check warnings. - * [r1538] .Rinstignore: Add .Rinstignore file to omit latex style - and source files from distributed inst/doc directory. - * [r1537] R/ConvertMedUnits.R: - Add NULL definition of MedUnits to - avoid R CMD check warning. + +2012-06-05 20:08 warnes + + * .Rinstignore: Add .Rinstignore file to omit latex style and + source files from distributed inst/doc directory. + +2012-06-05 19:56 warnes + + * R/ConvertMedUnits.R: - Add NULL definition of MedUnits to avoid R + CMD check warning. - Specify local environment when calling data() so that MedUnits gets defined in the function's environment rather than the global environment. - * [r1536] R/ls.funs.R: Fix error in ls.funs() that occurs when - there are no objects in the environment. - * [r1535] R/object.size.R: Avoid warning by calling - utils::object.size rather than Internal(object.size(x)) -2012-05-31 warnes +2012-06-05 19:07 warnes - * [r1534] R/nobs.R, man/nobs.Rd: - Remove dispatch function 'nobs' - and method 'nobs.lm' since these are + * R/ls.funs.R: Fix error in ls.funs() that occurs when there are no + objects in the environment. + +2012-06-05 18:36 warnes + + * R/object.size.R: Avoid warning by calling utils::object.size + rather than Internal(object.size(x)) + +2012-05-31 22:14 warnes + + * R/nobs.R, man/nobs.Rd: - Remove dispatch function 'nobs' and + method 'nobs.lm' since these are now provided by the R 'stats' package. -2012-05-04 warnes +2012-05-04 21:20 warnes - * [r1532] DESCRIPTION: Update for next release - * [r1531] NAMESPACE, R/ls.funs.R, man/ls.funs.Rd: Add ls.funs() to - show functions defined in the specified environment. - * [r1530] man/is.what.Rd: Fix enumerate syntax. + * DESCRIPTION: Update for next release -2012-04-03 warnes +2012-05-04 19:39 warnes - * [r1522] R/startsWith.R: Add startsWith() function. + * NAMESPACE, R/ls.funs.R, man/ls.funs.Rd: Add ls.funs() to show + functions defined in the specified environment. -2011-10-05 warnes +2012-05-04 19:38 warnes - * [r1516] man/read.xls.Rd: Fix typo + * man/is.what.Rd: Fix enumerate syntax. -2011-09-30 warnes +2012-04-03 19:49 warnes - * [r1515] inst/NEWS: Update DESCRIPTION and README for 2.9.0 - release. - * [r1514] DESCRIPTION: Update DESCRIPTION and README for 2.9.0 - release. + * R/startsWith.R: Add startsWith() function. -2011-09-20 warnes +2011-10-05 15:31 warnes - * [r1508] man/read.xls.Rd: Improve xls2csv() man page - * [r1507] NAMESPACE: Add case() function, a vector equivalent of - the switch() function - * [r1506] R/case.R, man/case.Rd: Add case() function, a vector - equivalent of the switch() function + * man/read.xls.Rd: Fix typo -2011-09-02 warnes +2011-09-30 19:09 warnes - * [r1500] NAMESPACE: Add 'centerText' function to center text - strings for a specified width. - * [r1499] R/centerText.R, man/centerText.Rd: Add 'centerText' - function to center text strings for a specified width. + * inst/NEWS: Update DESCRIPTION and README for 2.9.0 release. -2011-04-16 warnes +2011-09-30 19:09 warnes - * [r1469] DESCRIPTION, inst/NEWS: Update for release 2.8.2 + * DESCRIPTION: Update DESCRIPTION and README for 2.9.0 release. -2011-04-15 warnes +2011-09-20 18:08 warnes - * [r1468] R/dQuote.ascii.R, R/installXLSXsupport.R, R/read.xls.R, + * man/read.xls.Rd: Improve xls2csv() man page + +2011-09-20 18:07 warnes + + * NAMESPACE: Add case() function, a vector equivalent of the + switch() function + +2011-09-20 18:07 warnes + + * R/case.R, man/case.Rd: Add case() function, a vector equivalent + of the switch() function + +2011-09-02 17:25 warnes + + * NAMESPACE: Add 'centerText' function to center text strings for a + specified width. + +2011-09-02 17:24 warnes + + * R/centerText.R, man/centerText.Rd: Add 'centerText' function to + center text strings for a specified width. + +2011-04-16 17:04 warnes + + * DESCRIPTION, inst/NEWS: Update for release 2.8.2 + +2011-04-15 20:25 warnes + + * R/dQuote.ascii.R, R/installXLSXsupport.R, R/read.xls.R, R/sheetCount.R, R/xls2sep.R: Fix errors on windows when R or Perl install path includes spaces by properly quoting the path. - * [r1467] R/xlsFormats.R: Fix error in xlsFormat() on windows when - R or Perl install path includes spaces by quoting the path. -2011-01-15 ggorjan +2011-04-15 19:43 warnes - * [r1465] NAMESPACE, R/nPairs.R, inst/NEWS, - inst/unitTests/runit.nPairs.R, man/nPairs.Rd: Adding summary - method for nPairs + * R/xlsFormats.R: Fix error in xlsFormat() on windows when R or + Perl install path includes spaces by quoting the path. -2010-11-12 warnes +2011-01-15 21:58 ggorjan - * [r1462] inst/NEWS: Update NEWS for gdata 2.8.1 - * [r1461] DESCRIPTION: Update DEScription file for 2.8.1 release - * [r1460] tests/test.read.xls.Rout.save, - tests/tests.write.fwf.Rout.save: Update test output to match - latest code - * [r1459] R/write.fwf.R, man/write.fwf.Rd, - tests/test.write.fwf.eol.R: Modify write.fwf() to capture and - pass on additional arguments for + * NAMESPACE, R/nPairs.R, inst/NEWS, inst/unitTests/runit.nPairs.R, + man/nPairs.Rd: Adding summary method for nPairs + +2010-11-12 19:14 warnes + + * inst/NEWS: Update NEWS for gdata 2.8.1 + +2010-11-12 19:09 warnes + + * DESCRIPTION: Update DEScription file for 2.8.1 release + +2010-11-12 19:08 warnes + + * tests/test.read.xls.Rout.save, tests/tests.write.fwf.Rout.save: + Update test output to match latest code + +2010-11-12 19:08 warnes + + * R/write.fwf.R, man/write.fwf.Rd, tests/test.write.fwf.eol.R: + Modify write.fwf() to capture and pass on additional arguments + for write.table(). This resolves a bug reported by Jan Wijffels. -2010-11-01 arnima +2010-11-01 00:30 arnima - * [r1453] man/Args.Rd: Minor improvement in Args.Rd help page + * man/Args.Rd: Minor improvement in Args.Rd help page -2010-10-19 warnes +2010-10-19 22:04 warnes - * [r1452] R/onAttach.R, R/xls2sep.R: Avoid use of file.access() - which is unreliable on Windows network shares. + * R/onAttach.R, R/xls2sep.R: Avoid use of file.access() which is + unreliable on Windows network shares. -2010-07-08 ggrothendieck2 +2010-07-08 12:36 ggrothendieck2 - * [r1448] R/xls2sep.R: findPerl call added to xls2sep + * R/xls2sep.R: findPerl call added to xls2sep -2010-07-07 ggrothendieck2 +2010-07-07 22:48 ggrothendieck2 - * [r1447] man/read.xls.Rd: small improvements to read.xls.Rd + * man/read.xls.Rd: small improvements to read.xls.Rd -2010-05-03 warnes +2010-05-03 16:26 warnes - * [r1439] NAMESPACE, R/installXLSXModules.R, - R/installXLSXsupport.R, R/onAttach.R, inst/NEWS, - man/installXLSXsupport.Rd, man/xlsFormats.Rd: Rename - installXLSXModules() to installXLSXsupport() and provide - documentation for it. - * [r1438] inst/NEWS: Update news for gdata 2.8.0 - * [r1437] DESCRIPTION, NAMESPACE, R/installXLSXModules.R, - R/onAttach.R, inst/perl/install_modules.pl, - inst/perl/module_tools.pl, tests/test.read.xls.R: Add .onAttach - function to check & inform user if perl is available, to check - whether XLS and XLSX formats are avaiable, and to run the (new) - installXLSXModules() functon to attempt to install the necessar - libraries if not. Added installXLSXModules() function. + * NAMESPACE, R/installXLSXModules.R, R/installXLSXsupport.R, + R/onAttach.R, inst/NEWS, man/installXLSXsupport.Rd, + man/xlsFormats.Rd: Rename installXLSXModules() to + installXLSXsupport() and provide documentation for it. -2010-05-02 warnes +2010-05-03 13:48 warnes - * [r1436] man/xlsFormats.Rd: Correct error in xlsFormat example - * [r1435] DESCRIPTION, NAMESPACE, R/dQuote.ascii.R, R/findPerl.R, + * inst/NEWS: Update news for gdata 2.8.0 + +2010-05-03 13:35 warnes + + * DESCRIPTION, NAMESPACE, R/installXLSXModules.R, R/onAttach.R, + inst/perl/install_modules.pl, inst/perl/module_tools.pl, + tests/test.read.xls.R: Add .onAttach function to check & inform + user if perl is available, to check whether XLS and XLSX formats + are avaiable, and to run the (new) installXLSXModules() functon + to attempt to install the necessar libraries if not. Added + installXLSXModules() function. + +2010-05-02 13:56 warnes + + * man/xlsFormats.Rd: Correct error in xlsFormat example + +2010-05-02 06:11 warnes + + * DESCRIPTION, NAMESPACE, R/dQuote.ascii.R, R/findPerl.R, R/read.xls.R, R/xlsFormats.R, inst/doc/gregmisc.tex, inst/perl/install_modules.pl, inst/perl/module_tools.pl, inst/perl/sheetCount.pl, inst/perl/supportedFormats.pl, @@ -519,71 +801,121 @@ generate warnings) when Zlib or SpreadSheet::XLXS is not instaled. Also update Greg's email address -2010-02-21 ggrothendieck2 +2010-02-21 17:12 ggrothendieck2 - * [r1423] R/read.xls.R, man/read.xls.Rd: isOpen problems fixed - (isOpen must have changed in R since this worked in earlier - versions). Also nba.xls link in read.xls.Rd disappeared. Replaced - with similar link. + * R/read.xls.R, man/read.xls.Rd: isOpen problems fixed (isOpen must + have changed in R since this worked in earlier versions). Also + nba.xls link in read.xls.Rd disappeared. Replaced with similar + link. -2010-02-20 ggrothendieck2 +2010-02-20 11:32 ggrothendieck2 - * [r1422] INSTALL: improved INSTALL file + * INSTALL: improved INSTALL file -2010-02-19 ggrothendieck2 +2010-02-19 15:36 ggrothendieck2 - * [r1421] INSTALL, R/dQuote.ascii.R, R/read.xls.R, R/sheetCount.R, + * INSTALL, R/dQuote.ascii.R, R/read.xls.R, R/sheetCount.R, inst/NEWS: added findPerl to locate ActiveState Perl on Windows if perl= not specified and Rtools perl would have otherwise been used. Also added INSTALL file. -2010-01-28 warnes +2010-01-28 19:58 warnes - * [r1419] DESCRIPTION, inst/NEWS: Update for release 2.7.1 - * [r1418] R/xls2sep.R: xls2sep(): Show output of perl call when - verbose=T - * [r1417] src/build.bat: More Win32 fixes - * [r1416] src/Makefile, src/Makefile.win, src/build.bat: More work - on Win32 building - * [r1415] src/Makefile, src/Makefile.win, src/build.bat: Support - building Compress::Raw::Zlib perl package under windows. + * DESCRIPTION, inst/NEWS: Update for release 2.7.1 -2010-01-26 warnes +2010-01-28 19:56 warnes - * [r1413] inst/NEWS: Fix typos - * [r1412] R/sheetCount.R: Show more details in sheetCount() when + * R/xls2sep.R: xls2sep(): Show output of perl call when verbose=T + +2010-01-28 16:43 warnes + + * src/build.bat: More Win32 fixes + +2010-01-28 16:00 warnes + + * src/Makefile, src/Makefile.win, src/build.bat: More work on Win32 + building + +2010-01-28 03:58 warnes + + * src/Makefile, src/Makefile.win, src/build.bat: Support building + Compress::Raw::Zlib perl package under windows. + +2010-01-26 04:12 warnes + + * inst/NEWS: Fix typos + +2010-01-26 04:11 warnes + + * R/sheetCount.R: Show more details in sheetCount() when verbose=TRUE -2010-01-24 warnes +2010-01-24 23:30 warnes - * [r1411] R/xls2sep.R: Replace two calls to 'dQuote', to - 'dQuote.ascii' - * [r1408] inst/doc/mapLevels.pdf, inst/doc/unknown.pdf: Remove + * R/xls2sep.R: Replace two calls to 'dQuote', to 'dQuote.ascii' + +2010-01-24 19:25 warnes + + * inst/doc/mapLevels.pdf, inst/doc/unknown.pdf: Remove auto-generated pdf files from svn - * [r1407] src/Makefile: create 'distclean' to remove perl binary - dir, currently mac-only - * [r1406] R/read.xls.R, R/xls2sep.R: Make read.xls() and xls2sep() - quieter when verbose=FALSE - * [r1405] tests/test.read.xls.R, tests/test.read.xls.Rout.save: Add - tests for read.xls, sheetCount, and sheetNames - * [r1404] src/Makefile: Modify makefile to 1) clean up after build, - 2) make tar non-verbose - * [r1403] R/read.xls.R, R/sheetCount.R: Close connections when - done. - * [r1402] man/read.xls.Rd: Fix typo - * [r1401] man/read.xls.Rd, man/sheetNames.Rd: Fix R CMD CHECK - errors - * [r1400] src/Compress-Raw-Zlib-2.024, - src/Compress-Raw-Zlib-2.024.tar.gz, src/Makefile: Use the - original gz file for Compress::Raw::Zlib to avoid issues with - 'non-platform-independent' filename error in R CMD CHECK - * [r1399] inst/perl/Archive/README-Archive-Zip, + +2010-01-24 19:18 warnes + + * src/Makefile: create 'distclean' to remove perl binary dir, + currently mac-only + +2010-01-24 19:13 warnes + + * R/read.xls.R, R/xls2sep.R: Make read.xls() and xls2sep() quieter + when verbose=FALSE + +2010-01-24 19:12 warnes + + * tests/test.read.xls.R, tests/test.read.xls.Rout.save: Add tests + for read.xls, sheetCount, and sheetNames + +2010-01-24 18:22 warnes + + * src/Makefile: Modify makefile to 1) clean up after build, 2) make + tar non-verbose + +2010-01-24 18:19 warnes + + * R/read.xls.R, R/sheetCount.R: Close connections when done. + +2010-01-24 18:17 warnes + + * man/read.xls.Rd: Fix typo + +2010-01-24 18:10 warnes + + * man/read.xls.Rd, man/sheetNames.Rd: Fix R CMD CHECK errors + +2010-01-24 08:47 warnes + + * src/Compress-Raw-Zlib-2.024, src/Compress-Raw-Zlib-2.024.tar.gz, + src/Makefile: Use the original gz file for Compress::Raw::Zlib to + avoid issues with 'non-platform-independent' filename error in R + CMD CHECK + +2010-01-24 08:38 warnes + + * inst/perl/Archive/README-Archive-Zip, inst/perl/Archive/README-Archive::Zip: Rename files to remove R CMD check error - * [r1398] DESCRIPTION, inst/NEWS, inst/doc/mapLevels.pdf, + +2010-01-24 08:33 warnes + + * DESCRIPTION, inst/NEWS, inst/doc/mapLevels.pdf, inst/doc/unknown.pdf: Update for 2.7.0 release - * [r1397] NAMESPACE: Add new functions to NAMESPACE - * [r1396] src, src/Compress-Raw-Zlib-2.024, + +2010-01-24 08:21 warnes + + * NAMESPACE: Add new functions to NAMESPACE + +2010-01-24 08:19 warnes + + * src, src/Compress-Raw-Zlib-2.024, src/Compress-Raw-Zlib-2.024/Changes, src/Compress-Raw-Zlib-2.024/MANIFEST, src/Compress-Raw-Zlib-2.024/META.yml, @@ -644,18 +976,35 @@ src/Compress-Raw-Zlib-2.024/zlib-src/zutil.c, src/Compress-Raw-Zlib-2.024/zlib-src/zutil.h, src/Makefile: Add Compress::Raw::Zlib code - * [r1395] man/read.xls.Rd, man/sheetCount.Rd: Add/Update - documentation - * [r1394] R/xls2sep.R: Minor formatting change - * [r1393] inst/xls/ExampleExcelFile.xls, - inst/xls/ExampleExcelFile.xlsx: Add additional example files - * [r1392] inst/perl/sheetCount.pl, inst/perl/sheetNames.pl, + +2010-01-24 08:15 warnes + + * man/read.xls.Rd, man/sheetCount.Rd: Add/Update documentation + +2010-01-24 08:06 warnes + + * R/xls2sep.R: Minor formatting change + +2010-01-24 07:54 warnes + + * inst/xls/ExampleExcelFile.xls, inst/xls/ExampleExcelFile.xlsx: + Add additional example files + +2010-01-24 07:49 warnes + + * inst/perl/sheetCount.pl, inst/perl/sheetNames.pl, inst/perl/xls2csv.pl: Combine sheetCount.pl and sheetNames.pl and modify to support Excel 2007 'xlsx' format - * [r1391] inst/perl/Spreadsheet/XLSX.pm, + +2010-01-24 07:26 warnes + + * inst/perl/Spreadsheet/XLSX.pm, inst/perl/Spreadsheet/XLSX/Fmt2007.pm, inst/perl/xls2csv.pl: Complete changes to handle Excel 2007 'xlsx' files - * [r1390] inst/perl/Archive, inst/perl/Archive/README-Archive::Zip, + +2010-01-24 05:36 warnes + + * inst/perl/Archive, inst/perl/Archive/README-Archive::Zip, inst/perl/Archive/Zip, inst/perl/Archive/Zip.pm, inst/perl/Archive/Zip/Archive.pm, inst/perl/Archive/Zip/BufferedFileHandle.pm, @@ -677,40 +1026,67 @@ inst/perl/Spreadsheet/XLSX/Utility2007.pm, inst/perl/VERSIONS: Add additional Perl modules to support Excel 2007 'xlsx' files -2010-01-24 ggrothendieck2 +2010-01-24 02:28 ggrothendieck2 - * [r1389] NAMESPACE, man/sheetNames.Rd: added sheetNames.Rd - (documenting sheetNames/sheetCount) and updated NAMESPACE file. - * [r1388] inst/NEWS: fixed spacing problem in NEWS + * NAMESPACE, man/sheetNames.Rd: added sheetNames.Rd (documenting + sheetNames/sheetCount) and updated NAMESPACE file. -2010-01-23 warnes +2010-01-24 02:05 ggrothendieck2 - * [r1387] inst/perl/xls2csv.pl: Check if parsing the xls file - succeeds... Current code doesn't handle new XML-based format - * [r1386] inst/perl/Spreadsheet/XLSX: Remove perl - 'Spreadsheet:XLSX' module since it depends on Compress-Raw-Zlib, - which probably won't be available on most machines, and I don't - have time to figure out how to get R to build it properly when - gdata is installed. - * [r1385] inst/perl/Spreadsheet/XLSX, + * inst/NEWS: fixed spacing problem in NEWS + +2010-01-23 07:11 warnes + + * inst/perl/xls2csv.pl: Check if parsing the xls file succeeds... + Current code doesn't handle new XML-based format + +2010-01-23 07:09 warnes + + * inst/perl/Spreadsheet/XLSX: Remove perl 'Spreadsheet:XLSX' module + since it depends on Compress-Raw-Zlib, which probably won't be + available on most machines, and I don't have time to figure out + how to get R to build it properly when gdata is installed. + +2010-01-23 06:49 warnes + + * inst/perl/Spreadsheet/XLSX, inst/perl/Spreadsheet/XLSX/Fmt2007.pm, inst/perl/Spreadsheet/XLSX/Utility2007.pm: Add perl 'Spreadsheet:XLSX' module to support new Excel XML format files - * [r1384] R/xls2sep.R: Add xls2tsv() convenience wrapper to - xls2sep() - * [r1383] R/read.xls.R, R/xls2sep.R: Update to match new xls2csv.pl - code, allow specification of sheets by name, support CSV and TAB + +2010-01-23 05:51 warnes + + * R/xls2sep.R: Add xls2tsv() convenience wrapper to xls2sep() + +2010-01-23 05:50 warnes + + * R/read.xls.R, R/xls2sep.R: Update to match new xls2csv.pl code, + allow specification of sheets by name, support CSV and TAB delimited files using the same code, other minor changes. - * [r1382] R/sheetCount.R: Add sheetNames() function to extract the - names from XLS files - * [r1381] inst/bin/xls2csv.bat: Fix xls2csv.bat - * [r1380] inst/perl/xls2csv.pl: If only one sheet is present in the - file, don't insert the sheet name into the filename - * [r1379] inst/xls/ExampleExcelFile.xls, - inst/xls/ExampleExcelFile.xlsx: Add additional test/example Excel - files - * [r1378] inst/perl/xls2csv.pl, inst/perl/xls2tab.pl, - inst/perl/xls2tsv.pl: Modify xls2csv.pl script to: + +2010-01-23 05:45 warnes + + * R/sheetCount.R: Add sheetNames() function to extract the names + from XLS files + +2010-01-23 05:23 warnes + + * inst/bin/xls2csv.bat: Fix xls2csv.bat + +2010-01-23 05:17 warnes + + * inst/perl/xls2csv.pl: If only one sheet is present in the file, + don't insert the sheet name into the filename + +2010-01-23 04:38 warnes + + * inst/xls/ExampleExcelFile.xls, inst/xls/ExampleExcelFile.xlsx: + Add additional test/example Excel files + +2010-01-23 04:34 warnes + + * inst/perl/xls2csv.pl, inst/perl/xls2tab.pl, inst/perl/xls2tsv.pl: + Modify xls2csv.pl script to: - Use tab-delimiter and .tsv or .tab extension if called with the name xls2tsv.pl or xls2tab.pl, respectively. This allows a single @@ -720,15 +1096,21 @@ - Allow selection of sheets by name - Provide better error checking - Other code improvements - * [r1377] inst/perl/sheetCount.pl, inst/perl/sheetNames.pl: Add - perl scripts to extract worksheet names and sheet count from - Excel files -2010-01-22 warnes +2010-01-23 02:30 warnes - * [r1376] inst/perl/OLE/Storage_Lite.pm: Upgrade Perl - OLE::StorageLight module to version 0.19 - * [r1375] inst/perl/Spreadsheet/ParseExcel.pm, + * inst/perl/sheetCount.pl, inst/perl/sheetNames.pl: Add perl + scripts to extract worksheet names and sheet count from Excel + files + +2010-01-22 19:35 warnes + + * inst/perl/OLE/Storage_Lite.pm: Upgrade Perl OLE::StorageLight + module to version 0.19 + +2010-01-22 19:31 warnes + + * inst/perl/Spreadsheet/ParseExcel.pm, inst/perl/Spreadsheet/ParseExcel/Cell.pm, inst/perl/Spreadsheet/ParseExcel/Dump.pm, inst/perl/Spreadsheet/ParseExcel/FmtDefault.pm, @@ -745,20 +1127,25 @@ inst/perl/Spreadsheet/ParseExcel/Workbook.pm, inst/perl/Spreadsheet/ParseExcel/Worksheet.pm: Upgrade perl Spreadsheet::ParseExcel to version 0.56 - * [r1374] DESCRIPTION: Add complete list of contributors -2010-01-22 arnima +2010-01-22 19:20 warnes - * [r1373] man/keep.Rd: Minor improvement in help page - * [r1371] R/Args.R, R/env.R, R/is.what.R, R/keep.R, R/ll.R, - man/Args.Rd, man/env.Rd, man/is.what.Rd, man/keep.Rd, man/ll.Rd: - Many small improvements to documentation of Arni's five functions + * DESCRIPTION: Add complete list of contributors -2010-01-22 warnes +2010-01-22 14:00 arnima - * [r1370] R/dQuote.ascii.R, R/read.xls.R, R/sheetCount.R, - R/xls2sep.R: - Move xls2csv(), xls2tab(), xls2sep() to a separate - file + * man/keep.Rd: Minor improvement in help page + +2010-01-22 13:06 arnima + + * R/Args.R, R/env.R, R/is.what.R, R/keep.R, R/ll.R, man/Args.Rd, + man/env.Rd, man/is.what.Rd, man/keep.Rd, man/ll.Rd: Many small + improvements to documentation of Arni's five functions + +2010-01-22 12:45 warnes + + * R/dQuote.ascii.R, R/read.xls.R, R/sheetCount.R, R/xls2sep.R: - + Move xls2csv(), xls2tab(), xls2sep() to a separate file - Move qQuote.ascii to a separate file - Bug Fix: xls2csv(), xls2tab() failed to pass the provided @@ -769,111 +1156,157 @@ read.xls) now supports ftp URLs. -2009-12-06 arnima +2009-12-06 22:34 arnima - * [r1369] R/Args.R, man/Args.Rd: Minor improvements of Args(). - * [r1368] R/ll.R, man/ll.Rd: Improved ll() so user can limit output - to specified classes + * R/Args.R, man/Args.Rd: Minor improvements of Args(). -2009-11-16 arnima +2009-12-06 03:12 arnima - * [r1366] R/ll.R: ll(.GlobalEnv) does not crash anymore + * R/ll.R, man/ll.Rd: Improved ll() so user can limit output to + specified classes -2009-08-20 warnes +2009-11-16 12:57 arnima - * [r1357] man/cbindX.Rd, man/getDateTimePart.Rd, man/mapLevels.Rd, + * R/ll.R: ll(.GlobalEnv) does not crash anymore + +2009-08-20 14:54 warnes + + * man/cbindX.Rd, man/getDateTimePart.Rd, man/mapLevels.Rd, man/nPairs.Rd, man/trim.Rd, man/trimSum.Rd, man/unknown.Rd, man/write.fwf.Rd: Replace \ldots with \dots to make the new R CMD CHECK happy. -2009-08-19 warnes +2009-08-19 17:39 warnes - * [r1355] DESCRIPTION: Update for 2.6.1 release - * [r1354] inst/unitTests/runit.getDateTimeParts.R: Modify unit - tests to avoid issues related to zime zones. + * DESCRIPTION: Update for 2.6.1 release -2009-08-05 warnes +2009-08-19 17:37 warnes - * [r1353] inst/doc/mapLevels.pdf, inst/doc/unknown.pdf: Update - vignettes for 2.6.0 release - * [r1352] man/frameApply.Rd: Fix formatting warning in frameApply - man page + * inst/unitTests/runit.getDateTimeParts.R: Modify unit tests to + avoid issues related to zime zones. -2009-07-16 ggorjan +2009-08-05 01:57 warnes - * [r1350] man/write.fwf.Rd: Reverting recent change and clarifying - the meaning. + * inst/doc/mapLevels.pdf, inst/doc/unknown.pdf: Update vignettes + for 2.6.0 release -2009-07-16 warnes +2009-08-05 01:57 warnes - * [r1349] inst/doc/mapLevels.pdf, inst/doc/unknown.pdf, - man/resample.Rd: Add contents of \value section for resample() - man page - * [r1348] tests/tests.write.fwf.Rout.save: Update test output to - remove R CMD check warning - * [r1347] inst/NEWS: Update ChangeLog and NEWS for gdata 2.6.0 - release - * [r1346] DESCRIPTION: Update DESCRIPTION file for gdata 2.6.0 - * [r1345] inst/doc/gregmisc.tex, inst/doc/mapLevels.pdf, + * man/frameApply.Rd: Fix formatting warning in frameApply man page + +2009-07-16 10:55 ggorjan + + * man/write.fwf.Rd: Reverting recent change and clarifying the + meaning. + +2009-07-16 03:23 warnes + + * inst/doc/mapLevels.pdf, inst/doc/unknown.pdf, man/resample.Rd: + Add contents of \value section for resample() man page + +2009-07-16 03:15 warnes + + * tests/tests.write.fwf.Rout.save: Update test output to remove R + CMD check warning + +2009-07-16 03:10 warnes + + * inst/NEWS: Update ChangeLog and NEWS for gdata 2.6.0 release + +2009-07-16 02:56 warnes + + * DESCRIPTION: Update DESCRIPTION file for gdata 2.6.0 + +2009-07-16 02:55 warnes + + * inst/doc/gregmisc.tex, inst/doc/mapLevels.pdf, inst/doc/unknown.pdf, man/ConvertMedUnits.Rd, man/aggregate.table.Rd, man/combine.Rd, man/interleave.Rd, man/matchcols.Rd, man/nobs.Rd, man/rename.vars.Rd, man/reorder.Rd, man/trim.Rd, man/unmatrix.Rd, man/upperTriangle.Rd: Correct Greg's email address - * [r1344] man/write.fwf.Rd: Correct minor typos in write.fwf() man - page - * [r1343] man/resample.Rd: Correct page for resample() - * [r1342] NAMESPACE, R/read.xls.R, inst/perl/xls2tab.pl, - man/read.xls.Rd: Add support for using tab for field separator - during translation from xls format in read.xls -2009-04-19 arnima +2009-07-16 02:52 warnes - * [r1314] R/env.R, R/ll.R: Changed object.size(object) to + * man/write.fwf.Rd: Correct minor typos in write.fwf() man page + +2009-07-16 02:50 warnes + + * man/resample.Rd: Correct page for resample() + +2009-07-16 02:49 warnes + + * NAMESPACE, R/read.xls.R, inst/perl/xls2tab.pl, man/read.xls.Rd: + Add support for using tab for field separator during translation + from xls format in read.xls + +2009-04-19 23:25 arnima + + * R/env.R, R/ll.R: Changed object.size(object) to unclass(object.size(object)). -2008-12-31 ggorjan +2008-12-31 13:30 ggorjan - * [r1312] NAMESPACE, inst/NEWS: Documenting changes and exporting - the functions. - * [r1311] R/object.size.R, man/humanReadable.Rd, - man/object.size.Rd: Enhanced function object.size that returns - the size of multiple objects. There is also a handy print method - that can print size of an object in "human readable" format when + * NAMESPACE, inst/NEWS: Documenting changes and exporting the + functions. + +2008-12-31 13:30 ggorjan + + * R/object.size.R, man/humanReadable.Rd, man/object.size.Rd: + Enhanced function object.size that returns the size of multiple + objects. There is also a handy print method that can print size + of an object in "human readable" format when options(humanReadable=TRUE) or print(object.size(x), humanReadable=TRUE). - * [r1310] R/wideByFactor.R, inst/unitTests/runit.wideByFactor.R, + +2008-12-31 13:29 ggorjan + + * R/wideByFactor.R, inst/unitTests/runit.wideByFactor.R, man/wideByFactor.Rd: New function wideByFactor that reshapes given dataset by a given factor - it creates a "multivariate" data.frame. - * [r1309] R/nPairs.R, inst/unitTests/runit.nPairs.R, man/nPairs.Rd: - New function nPairs that gives the number of variable pairs in a + +2008-12-31 13:28 ggorjan + + * R/nPairs.R, inst/unitTests/runit.nPairs.R, man/nPairs.Rd: New + function nPairs that gives the number of variable pairs in a data.frame or a matrix. - * [r1308] R/getDateTimeParts.R, - inst/unitTests/runit.getDateTimeParts.R, man/getDateTimePart.Rd: - New functions getYear, getMonth, getDay, getHour, getMin, and - getSec for extracting the date/time parts from objects of a - date/time class. - * [r1307] R/bindData.R, inst/unitTests/runit.bindData.R, - man/bindData.Rd: New function bindData that binds two data frames - into a multivariate data frame in a different way than merge. - * [r1306] R/runRUnitTests.R, inst/unitTests/Makefile, + +2008-12-31 13:26 ggorjan + + * R/getDateTimeParts.R, inst/unitTests/runit.getDateTimeParts.R, + man/getDateTimePart.Rd: New functions getYear, getMonth, getDay, + getHour, getMin, and getSec for extracting the date/time parts + from objects of a date/time class. + +2008-12-31 13:25 ggorjan + + * R/bindData.R, inst/unitTests/runit.bindData.R, man/bindData.Rd: + New function bindData that binds two data frames into a + multivariate data frame in a different way than merge. + +2008-12-31 13:24 ggorjan + + * R/runRUnitTests.R, inst/unitTests/Makefile, inst/unitTests/runRUnitTests.R, man/gdata-package.Rd, man/runRUnitTests.Rd, tests/doRUnit.R: New function .runRUnitTestsGdata that enables run of all RUnit tests during the R CMD check as well as directly from within R. -2008-12-20 ggorjan +2008-12-20 22:34 ggorjan - * [r1305] NAMESPACE, R/trimSum.R, inst/NEWS, + * NAMESPACE, R/trimSum.R, inst/NEWS, inst/unitTests/runit.trimSum.R, man/trimSum.Rd: - * [r1304] tests/tests.write.fwf.Rout.save: To remove some output in - the R CMD check -2008-08-05 ggorjan +2008-12-20 22:28 ggorjan - * [r1300] DESCRIPTION, NAMESPACE, R/cbindX.R, R/write.fwf.R, - inst/NEWS, inst/doc/mapLevels.pdf, inst/doc/unknown.pdf, + * tests/tests.write.fwf.Rout.save: To remove some output in the R + CMD check + +2008-08-05 11:47 ggorjan + + * DESCRIPTION, NAMESPACE, R/cbindX.R, R/write.fwf.R, inst/NEWS, + inst/doc/mapLevels.pdf, inst/doc/unknown.pdf, inst/unitTests/runit.cbindX.R, inst/unitTests/runit.write.fwf.R, man/cbindX.Rd, man/write.fwf.Rd, tests/tests.write.fwf.R, tests/tests.write.fwf.Rout.save: - Increased version to 2.5.0 @@ -886,22 +1319,34 @@ the width of the columns. Additional tests and documentation fixes. -2008-06-30 arnima +2008-06-30 22:29 arnima - * [r1299] R/env.R, R/ll.R, man/env.Rd, man/ll.Rd: Simplified - default 'unit' argument from c("KB","MB","bytes") to "KB". + * R/env.R, R/ll.R, man/env.Rd, man/ll.Rd: Simplified default 'unit' + argument from c("KB","MB","bytes") to "KB". -2008-05-13 warnes +2008-05-13 03:16 warnes - * [r1270] inst/NEWS, inst/doc/mapLevels.pdf, inst/doc/unknown.pdf: - Update NEWS file for 2.4.2 - * [r1269] R/read.xls.R: Use path.expand() to give proper full path - to xls file to be translated by read.xls() - * [r1268] R/read.xls.R: Modifed read.xls() failed to return the - converted data... fixed. - * [r1267] inst/perl/Spreadsheet/ParseExcel/Utility.pm: Correct - broken patch for open-office support - * [r1266] DESCRIPTION, R/read.xls.R: For read.xls() and xls2csv(): + * inst/NEWS, inst/doc/mapLevels.pdf, inst/doc/unknown.pdf: Update + NEWS file for 2.4.2 + +2008-05-13 03:09 warnes + + * R/read.xls.R: Use path.expand() to give proper full path to xls + file to be translated by read.xls() + +2008-05-13 02:55 warnes + + * R/read.xls.R: Modifed read.xls() failed to return the converted + data... fixed. + +2008-05-13 02:47 warnes + + * inst/perl/Spreadsheet/ParseExcel/Utility.pm: Correct broken patch + for open-office support + +2008-05-13 02:40 warnes + + * DESCRIPTION, R/read.xls.R: For read.xls() and xls2csv(): - Implement more informative log messages when verbose=TRUE - Quote temporary file name to avoid errors when calling perl to do the work. @@ -911,20 +1356,26 @@ Update version number in DESCRIPTION. -2008-05-12 warnes +2008-05-12 00:00 warnes - * [r1265] inst/perl/Spreadsheet/ParseExcel/Utility.pm: Patch to - correct issue with OpenOffice-created XLS files. Thanks to + * inst/perl/Spreadsheet/ParseExcel/Utility.pm: Patch to correct + issue with OpenOffice-created XLS files. Thanks to Robert Burns for pointing out the patch at http://rt.cpan.org/Public/Bug/Display.html?id=7206 -2008-03-25 warnes +2008-03-25 01:01 warnes - * [r1250] DESCRIPTION, inst/NEWS, inst/doc/mapLevels.pdf, + * DESCRIPTION, inst/NEWS, inst/doc/mapLevels.pdf, inst/doc/unknown.pdf: Update for version 2.4.1 - * [r1249] inst/xls/iris.xls: Example iris.xls file didn't complete - & properly formatted iris data set. Fixed. - * [r1248] inst/perl/IO/AtomicFile.pm, inst/perl/IO/InnerFile.pm, + +2008-03-25 00:57 warnes + + * inst/xls/iris.xls: Example iris.xls file didn't complete & + properly formatted iris data set. Fixed. + +2008-03-25 00:51 warnes + + * inst/perl/IO/AtomicFile.pm, inst/perl/IO/InnerFile.pm, inst/perl/IO/Lines.pm, inst/perl/IO/Scalar.pm, inst/perl/IO/ScalarArray.pm, inst/perl/IO/Stringy.pm, inst/perl/IO/Wrap.pm, inst/perl/IO/WrapTie.pm, @@ -939,250 +1390,351 @@ inst/perl/Spreadsheet/ParseExcel/Utility.pm: Update perl modules to latest versions -2008-03-24 warnes +2008-03-24 23:56 warnes - * [r1247] man/read.xls.Rd: Fix typo in win32 example for read.xls() + * man/read.xls.Rd: Fix typo in win32 example for read.xls() -2008-03-11 warnes +2008-03-11 20:22 warnes - * [r1246] NAMESPACE: Add xls2csv to exported function list + * NAMESPACE: Add xls2csv to exported function list -2008-01-30 warnes +2008-01-30 19:55 warnes - * [r1241] ChangeLog, DESCRIPTION, inst/NEWS: Update DESCRIPTION and - NEWS for release 2.4.0 + * ChangeLog, DESCRIPTION, inst/NEWS: Update DESCRIPTION and NEWS + for release 2.4.0 -2008-01-29 arnima +2008-01-29 11:26 arnima - * [r1240] man/keep.Rd: Added argument 'all'. - * [r1239] R/keep.R: Added argument 'all'. + * man/keep.Rd: Added argument 'all'. -2007-10-22 warnes +2008-01-29 11:09 arnima - * [r1196] DESCRIPTION: Clarify GPL version + * R/keep.R: Added argument 'all'. -2007-09-10 ggorjan +2007-10-22 02:24 warnes - * [r1169] man/upperTriangle.Rd: removed unmatched brace - * [r1168] man/gdata-package.Rd: adding alias + * DESCRIPTION: Clarify GPL version -2007-09-06 ggorjan +2007-09-10 13:39 ggorjan - * [r1162] man/gdata-package.Rd: keyword + * man/upperTriangle.Rd: removed unmatched brace -2007-08-21 ggorjan +2007-09-10 13:02 ggorjan - * [r1154] man/gdata-package.Rd: package help page - * [r1153] NEWS, inst/NEWS: move - * [r1152] NEWS: move + * man/gdata-package.Rd: adding alias -2007-08-20 ggorjan +2007-09-06 14:06 ggorjan - * [r1151] inst/doc/mapLevels.tex: clean - * [r1150] inst/doc/mapLevels.Rnw, ins... [truncated message content] |
From: <wa...@us...> - 2015-04-25 16:23:33
|
Revision: 1966 http://sourceforge.net/p/r-gregmisc/code/1966 Author: warnes Date: 2015-04-25 16:23:31 +0000 (Sat, 25 Apr 2015) Log Message: ----------- Modfy write.fwf() to properly handle matrix argument, avoiding conversion to dataframe unless rownames=TRUE. Add corresponding unit tests. Modified Paths: -------------- trunk/gdata/R/write.fwf.R trunk/gdata/tests/test.humanReadable.Rout.save trunk/gdata/tests/test.reorder.factor.Rout.save trunk/gdata/tests/tests.write.fwf.Rout.save trunk/gdata/tests/unitTests/runit.write.fwf.R Modified: trunk/gdata/R/write.fwf.R =================================================================== --- trunk/gdata/R/write.fwf.R 2015-04-25 09:11:54 UTC (rev 1965) +++ trunk/gdata/R/write.fwf.R 2015-04-25 16:23:31 UTC (rev 1966) @@ -25,6 +25,16 @@ { ## --- Setup --- + dapply <- function(x, FUN, ..., simplify=TRUE) + { + if(is.data.frame(x)) + return(sapply(x, FUN, ..., simplify=simplify)) + else if(is.matrix(x)) + return(apply(x, 2, FUN, ...)) + else + stop("x must be a data.frame or a matrix") + } + if(!(is.data.frame(x) || is.matrix(x))) stop("'x' must be a data.frame or matrix") if(length(na) > 1) @@ -39,7 +49,7 @@ if(rownames) { - x <- cbind(rownames(x), x) + x <- cbind(rownames(x), as.data.frame(x)) rowColVal <- ifelse(!is.null(rowCol), rowCol, "row") colnames(x)[1] <- rowColVal } @@ -69,22 +79,26 @@ stringsAsFactors=FALSE) ## Which columns are numeric like - isNum <- apply(x, 2, is.numeric) + isNum <- dapply(x, is.numeric) ## is.numeric picks also Date and POSIXt - isNum <- isNum & !(apply(x, 2, inherits, what="Date") | - apply(x, 2, inherits, what="POSIXt")) + isNum <- isNum & !(dapply(x, inherits, what="Date") | + dapply(x, inherits, what="POSIXt")) ## Which columns are factors --> convert them to character - isFac <- apply(x, 2, is.factor) - x[, isFac] <- apply(x[, isFac, drop=FALSE], 2, as.character) + isFac <- dapply(x, is.factor) + if(any(isFac)) + ## This conditional is necessary because if x is a matrix, even if + ## all(isFAC==FALSE), this assignment will coerce it to mode + ## character. This isn't a problem for dataframes. + x[, isFac] <- sapply(x[, isFac, drop=FALSE], as.character) ## Collect information about how format() will format columns. ## We need to get this info now, since format will turn all columns to character - tmp <- apply(x, 2, format.info, ...) + tmp <- dapply(x, format.info, ..., simplify=FALSE) + if(is.matrix(x)) tmp <- as.data.frame(tmp) tmp1 <- sapply(tmp, length) tmp <- t(as.data.frame(tmp)) retFormat$width <- tmp[, 1] - ## Collect other details for numeric columns if(any(isNum)) { ## Numeric columns with digits @@ -100,6 +114,9 @@ ## --- Format --- + ## store original object in 'y' + y <- x + ## Formatting (to character) for(i in 1:nCol) { if(widthNULL) { @@ -112,17 +129,17 @@ ## following test to "fiddle" with the value in 'na' argument since - ## NA should not increase the width of column with width 1, while wider ## value for 'na' should increase the width - test <- is.na(x[, i]) + test <- is.na(y[, i]) ## Make a copy to make sure we get character after first format() - Date class caused problems x2 <- character(length=nRow) ## Add formatted values - x2[!test] <- format(x[!test, i], justify=justify, width=tmp, ...) + x2[!test] <- format(y[!test, i], justify=justify, width=tmp, ...) ## Add 'na' value x2[test] <- na ## Replace the original x[, i] <- x2 ## Collect width (again) - tmp2 <- format.info(x[, i], ...)[1] + tmp2 <- format.info(x2, ...)[1] ## Reformat if 'na' value change the width of the column if(tmp2 != retFormat[i, "width"]) { retFormat[i, "width"] <- tmp2 @@ -139,7 +156,7 @@ ## Number of levels for "non-numeric"" columns if(any(!isNum)) { - retFormat[!isNum, "nlevels"] <- apply(x[, !isNum, drop=FALSE], 2, + retFormat[!isNum, "nlevels"] <- dapply(x[, !isNum, drop=FALSE], function(z) length(unique(z))) } Modified: trunk/gdata/tests/test.humanReadable.Rout.save =================================================================== --- trunk/gdata/tests/test.humanReadable.Rout.save 2015-04-25 09:11:54 UTC (rev 1965) +++ trunk/gdata/tests/test.humanReadable.Rout.save 2015-04-25 16:23:31 UTC (rev 1966) @@ -1,14 +1,12 @@ -R version 3.1.2 (2014-10-31) -- "Pumpkin Helmet" -Copyright (C) 2014 The R Foundation for Statistical Computing +R version 3.2.0 (2015-04-16) -- "Full of Ingredients" +Copyright (C) 2015 The R Foundation for Statistical Computing Platform: x86_64-apple-darwin13.4.0 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. - Natural language support but running in an English locale - R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. @@ -27,13 +25,13 @@ gdata: to automatically download and install the perl gdata: libaries needed to support Excel XLS and XLSX formats. -Attaching package: ‘gdata’ +Attaching package: 'gdata' -The following object is masked from ‘package:stats’: +The following object is masked from 'package:stats': nobs -The following object is masked from ‘package:utils’: +The following object is masked from 'package:utils': object.size @@ -65,26 +63,26 @@ + humanReadable(x=IEC2, standard="Unix", width=3)) [,1] [,2] [,3] [,4] [,5] [,6] [1,] " 2 B " " 2 B " " 2 B " " 2 B " " 2 B " " 2 B " - [2,] "1.26838 kB" "1.268 kB" " 1.3 kB" "1.25729 KiB" "1.257 KiB" " 1.3 KiB" - [3,] " 1.2285 MB" "1.228 MB" " 1.2 MB" "1.83751 MiB" "1.838 MiB" " 1.8 MiB" - [4,] "1.24401 GB" "1.244 GB" " 1.2 GB" "1.26666 GiB" "1.267 GiB" " 1.3 GiB" - [5,] "1.47565 TB" "1.476 TB" " 1.5 TB" " 1.4234 TiB" "1.423 TiB" " 1.4 TiB" - [6,] "1.36687 PB" "1.367 PB" " 1.4 PB" "1.32499 PiB" "1.325 PiB" " 1.3 PiB" - [7,] "1.21324 EB" "1.213 EB" " 1.2 EB" "1.54391 EiB" "1.544 EiB" " 1.5 EiB" - [8,] "1.37186 ZB" "1.372 ZB" " 1.4 ZB" " 1.233 ZiB" "1.233 ZiB" " 1.2 ZiB" - [9,] "1.19468 YB" "1.195 YB" " 1.2 YB" "1.21258 YiB" "1.213 YiB" " 1.2 YiB" -[10,] "1201.13 YB" " 1201 YB" "1201 YB" "1489.01 YiB" " 1489 YiB" "1489 YiB" + [2,] "1.19855 kB" "1.199 kB" " 1.2 kB" "1.23404 KiB" "1.234 KiB" " 1.2 KiB" + [3,] "1.20686 MB" "1.207 MB" " 1.2 MB" "1.24529 MiB" "1.245 MiB" " 1.2 MiB" + [4,] "1.24218 GB" "1.242 GB" " 1.2 GB" "1.19621 GiB" "1.196 GiB" " 1.2 GiB" + [5,] "1.20157 TB" "1.202 TB" " 1.2 TB" "1.21737 TiB" "1.217 TiB" " 1.2 TiB" + [6,] "1.26255 PB" "1.263 PB" " 1.3 PB" "1.57268 PiB" "1.573 PiB" " 1.6 PiB" + [7,] "1.35911 EB" "1.359 EB" " 1.4 EB" "1.18177 EiB" "1.182 EiB" " 1.2 EiB" + [8,] " 1.2033 ZB" "1.203 ZB" " 1.2 ZB" "1.49049 ZiB" " 1.49 ZiB" " 1.5 ZiB" + [9,] "1.35332 YB" "1.353 YB" " 1.4 YB" "1.84401 YiB" "1.844 YiB" " 1.8 YiB" +[10,] " 1723.7 YB" " 1724 YB" "1724 YB" "1216.27 YiB" " 1216 YiB" "1216 YiB" [,7] [,8] [,9] [1,] " 2 B" " 2 B" " 2 B" - [2,] "1.25729 K" "1.257 K" " 1.3 K" - [3,] "1.83751 M" "1.838 M" " 1.8 M" - [4,] "1.26666 G" "1.267 G" " 1.3 G" - [5,] " 1.4234 T" "1.423 T" " 1.4 T" - [6,] "1.32499 P" "1.325 P" " 1.3 P" - [7,] "1.54391 E" "1.544 E" " 1.5 E" - [8,] " 1.233 Z" "1.233 Z" " 1.2 Z" - [9,] "1.21258 Y" "1.213 Y" " 1.2 Y" -[10,] "1489.01 Y" " 1489 Y" "1489 Y" + [2,] "1.23404 K" "1.234 K" " 1.2 K" + [3,] "1.24529 M" "1.245 M" " 1.2 M" + [4,] "1.19621 G" "1.196 G" " 1.2 G" + [5,] "1.21737 T" "1.217 T" " 1.2 T" + [6,] "1.57268 P" "1.573 P" " 1.6 P" + [7,] "1.18177 E" "1.182 E" " 1.2 E" + [8,] "1.49049 Z" " 1.49 Z" " 1.5 Z" + [9,] "1.84401 Y" "1.844 Y" " 1.8 Y" +[10,] "1216.27 Y" " 1216 Y" "1216 Y" > > # Auto units, specify digits > cbind(humanReadable(x=SI2, standard="SI", width=NULL, digits=7), @@ -101,37 +99,37 @@ + humanReadable(x=IEC2, standard="Unix", width=NULL, digits=1)) [,1] [,2] [,3] [,4] [1,] " 1.5000000 B " " 1.500 B " " 1.50 B " " 1.5 B " - [2,] " 1.2683780 kB" " 1.268 kB" " 1.27 kB" " 1.3 kB" - [3,] " 1.2284981 MB" " 1.228 MB" " 1.23 MB" " 1.2 MB" - [4,] " 1.2440094 GB" " 1.244 GB" " 1.24 GB" " 1.2 GB" - [5,] " 1.4756474 TB" " 1.476 TB" " 1.48 TB" " 1.5 TB" - [6,] " 1.3668711 PB" " 1.367 PB" " 1.37 PB" " 1.4 PB" - [7,] " 1.2132416 EB" " 1.213 EB" " 1.21 EB" " 1.2 EB" - [8,] " 1.3718619 ZB" " 1.372 ZB" " 1.37 ZB" " 1.4 ZB" - [9,] " 1.1946775 YB" " 1.195 YB" " 1.19 YB" " 1.2 YB" -[10,] "1201.1346574 YB" "1201.135 YB" "1201.13 YB" "1201.1 YB" + [2,] " 1.1985486 kB" " 1.199 kB" " 1.20 kB" " 1.2 kB" + [3,] " 1.2068563 MB" " 1.207 MB" " 1.21 MB" " 1.2 MB" + [4,] " 1.2421751 GB" " 1.242 GB" " 1.24 GB" " 1.2 GB" + [5,] " 1.2015680 TB" " 1.202 TB" " 1.20 TB" " 1.2 TB" + [6,] " 1.2625549 PB" " 1.263 PB" " 1.26 PB" " 1.3 PB" + [7,] " 1.3591145 EB" " 1.359 EB" " 1.36 EB" " 1.4 EB" + [8,] " 1.2033002 ZB" " 1.203 ZB" " 1.20 ZB" " 1.2 ZB" + [9,] " 1.3533151 YB" " 1.353 YB" " 1.35 YB" " 1.4 YB" +[10,] "1723.7026620 YB" "1723.703 YB" "1723.70 YB" "1723.7 YB" [,5] [,6] [,7] [,8] [1,] " 1.5000000 B " " 1.500 B " " 1.50 B " " 1.5 B " - [2,] " 1.2572859 KiB" " 1.257 KiB" " 1.26 KiB" " 1.3 KiB" - [3,] " 1.8375086 MiB" " 1.838 MiB" " 1.84 MiB" " 1.8 MiB" - [4,] " 1.2666626 GiB" " 1.267 GiB" " 1.27 GiB" " 1.3 GiB" - [5,] " 1.4234036 TiB" " 1.423 TiB" " 1.42 TiB" " 1.4 TiB" - [6,] " 1.3249855 PiB" " 1.325 PiB" " 1.32 PiB" " 1.3 PiB" - [7,] " 1.5439083 EiB" " 1.544 EiB" " 1.54 EiB" " 1.5 EiB" - [8,] " 1.2329980 ZiB" " 1.233 ZiB" " 1.23 ZiB" " 1.2 ZiB" - [9,] " 1.2125791 YiB" " 1.213 YiB" " 1.21 YiB" " 1.2 YiB" -[10,] "1489.0123170 YiB" "1489.012 YiB" "1489.01 YiB" "1489.0 YiB" + [2,] " 1.2340441 KiB" " 1.234 KiB" " 1.23 KiB" " 1.2 KiB" + [3,] " 1.2452876 MiB" " 1.245 MiB" " 1.25 MiB" " 1.2 MiB" + [4,] " 1.1962114 GiB" " 1.196 GiB" " 1.20 GiB" " 1.2 GiB" + [5,] " 1.2173697 TiB" " 1.217 TiB" " 1.22 TiB" " 1.2 TiB" + [6,] " 1.5726781 PiB" " 1.573 PiB" " 1.57 PiB" " 1.6 PiB" + [7,] " 1.1817693 EiB" " 1.182 EiB" " 1.18 EiB" " 1.2 EiB" + [8,] " 1.4904906 ZiB" " 1.490 ZiB" " 1.49 ZiB" " 1.5 ZiB" + [9,] " 1.8440055 YiB" " 1.844 YiB" " 1.84 YiB" " 1.8 YiB" +[10,] "1216.2741325 YiB" "1216.274 YiB" "1216.27 YiB" "1216.3 YiB" [,9] [,10] [,11] [,12] [1,] " 1.5000000 B" " 1.500 B" " 1.50 B" " 1.5 B" - [2,] " 1.2572859 K" " 1.257 K" " 1.26 K" " 1.3 K" - [3,] " 1.8375086 M" " 1.838 M" " 1.84 M" " 1.8 M" - [4,] " 1.2666626 G" " 1.267 G" " 1.27 G" " 1.3 G" - [5,] " 1.4234036 T" " 1.423 T" " 1.42 T" " 1.4 T" - [6,] " 1.3249855 P" " 1.325 P" " 1.32 P" " 1.3 P" - [7,] " 1.5439083 E" " 1.544 E" " 1.54 E" " 1.5 E" - [8,] " 1.2329980 Z" " 1.233 Z" " 1.23 Z" " 1.2 Z" - [9,] " 1.2125791 Y" " 1.213 Y" " 1.21 Y" " 1.2 Y" -[10,] "1489.0123170 Y" "1489.012 Y" "1489.01 Y" "1489.0 Y" + [2,] " 1.2340441 K" " 1.234 K" " 1.23 K" " 1.2 K" + [3,] " 1.2452876 M" " 1.245 M" " 1.25 M" " 1.2 M" + [4,] " 1.1962114 G" " 1.196 G" " 1.20 G" " 1.2 G" + [5,] " 1.2173697 T" " 1.217 T" " 1.22 T" " 1.2 T" + [6,] " 1.5726781 P" " 1.573 P" " 1.57 P" " 1.6 P" + [7,] " 1.1817693 E" " 1.182 E" " 1.18 E" " 1.2 E" + [8,] " 1.4904906 Z" " 1.490 Z" " 1.49 Z" " 1.5 Z" + [9,] " 1.8440055 Y" " 1.844 Y" " 1.84 Y" " 1.8 Y" +[10,] "1216.2741325 Y" "1216.274 Y" "1216.27 Y" "1216.3 Y" > > # Single unit, specify width > cbind(humanReadable(x=SI1, units="GB", standard="SI", width=7), @@ -146,26 +144,26 @@ + ) [,1] [,2] [,3] [,4] [,5] [,6] [1,] "5e-10 GB" "5e-10 GB" "5e-10 GB" "5e-10 GiB" "5e-10 GiB" "5e-10 GiB" - [2,] "6e-07 GB" "6e-07 GB" "6e-07 GB" "6e-07 GiB" "6e-07 GiB" "6e-07 GiB" - [3,] "7e-04 GB" "7e-04 GB" "7e-04 GB" "7e-04 GiB" "7e-04 GiB" "7e-04 GiB" + [2,] "8e-07 GB" "8e-07 GB" "8e-07 GB" "7e-07 GiB" "7e-07 GiB" "7e-07 GiB" + [3,] "8e-04 GB" "8e-04 GB" "8e-04 GB" "8e-04 GiB" "8e-04 GiB" "8e-04 GiB" [4,] "8e-01 GB" "8e-01 GB" "8e-01 GB" "8e-01 GiB" "8e-01 GiB" "8e-01 GiB" - [5,] "7e+02 GB" "7e+02 GB" "7e+02 GB" "3e+02 GiB" "3e+02 GiB" "3e+02 GiB" - [6,] "8e+05 GB" "8e+05 GB" "8e+05 GB" "7e+05 GiB" "7e+05 GiB" "7e+05 GiB" + [5,] "8e+02 GB" "8e+02 GB" "8e+02 GB" "6e+02 GiB" "6e+02 GiB" "6e+02 GiB" + [6,] "8e+05 GB" "8e+05 GB" "8e+05 GB" "6e+05 GiB" "6e+05 GiB" "6e+05 GiB" [7,] "8e+08 GB" "8e+08 GB" "8e+08 GB" "8e+08 GiB" "8e+08 GiB" "8e+08 GiB" - [8,] "8e+11 GB" "8e+11 GB" "8e+11 GB" "5e+11 GiB" "5e+11 GiB" "5e+11 GiB" - [9,] "7e+14 GB" "7e+14 GB" "7e+14 GB" "9e+14 GiB" "9e+14 GiB" "9e+14 GiB" -[10,] "8e+17 GB" "8e+17 GB" "8e+17 GB" "6e+17 GiB" "6e+17 GiB" "6e+17 GiB" + [8,] "8e+11 GB" "8e+11 GB" "8e+11 GB" "9e+11 GiB" "9e+11 GiB" "9e+11 GiB" + [9,] "8e+14 GB" "8e+14 GB" "8e+14 GB" "4e+14 GiB" "4e+14 GiB" "4e+14 GiB" +[10,] "7e+17 GB" "7e+17 GB" "7e+17 GB" "8e+17 GiB" "8e+17 GiB" "8e+17 GiB" [,7] [,8] [,9] [1,] "5e-10 G" "5e-10 G" "5e-10 G" - [2,] "6e-07 G" "6e-07 G" "6e-07 G" - [3,] "7e-04 G" "7e-04 G" "7e-04 G" + [2,] "7e-07 G" "7e-07 G" "7e-07 G" + [3,] "8e-04 G" "8e-04 G" "8e-04 G" [4,] "8e-01 G" "8e-01 G" "8e-01 G" - [5,] "3e+02 G" "3e+02 G" "3e+02 G" - [6,] "7e+05 G" "7e+05 G" "7e+05 G" + [5,] "6e+02 G" "6e+02 G" "6e+02 G" + [6,] "6e+05 G" "6e+05 G" "6e+05 G" [7,] "8e+08 G" "8e+08 G" "8e+08 G" - [8,] "5e+11 G" "5e+11 G" "5e+11 G" - [9,] "9e+14 G" "9e+14 G" "9e+14 G" -[10,] "6e+17 G" "6e+17 G" "6e+17 G" + [8,] "9e+11 G" "9e+11 G" "9e+11 G" + [9,] "4e+14 G" "4e+14 G" "4e+14 G" +[10,] "8e+17 G" "8e+17 G" "8e+17 G" > > # Single unit, specify digits > cbind(humanReadable(x=SI1, units="GB", standard="SI", width=NULL, digits=7), @@ -183,37 +181,37 @@ + ) [,1] [,2] [,3] [,4] [1,] "5.000000e-10 GB" "5.00e-10 GB" "5.0e-10 GB" "5e-10 GB" - [2,] "6.388137e-07 GB" "6.39e-07 GB" "6.4e-07 GB" "6e-07 GB" - [3,] "7.101117e-04 GB" "7.10e-04 GB" "7.1e-04 GB" "7e-04 GB" - [4,] "8.188110e-01 GB" "8.19e-01 GB" "8.2e-01 GB" "8e-01 GB" - [5,] "6.706597e+02 GB" "6.71e+02 GB" "6.7e+02 GB" "7e+02 GB" - [6,] "8.067884e+05 GB" "8.07e+05 GB" "8.1e+05 GB" "8e+05 GB" - [7,] "7.758668e+08 GB" "7.76e+08 GB" "7.8e+08 GB" "8e+08 GB" - [8,] "7.861707e+11 GB" "7.86e+11 GB" "7.9e+11 GB" "8e+11 GB" - [9,] "7.495958e+14 GB" "7.50e+14 GB" "7.5e+14 GB" "7e+14 GB" -[10,] "7.655714e+17 GB" "7.66e+17 GB" "7.7e+17 GB" "8e+17 GB" + [2,] "7.792994e-07 GB" "7.79e-07 GB" "7.8e-07 GB" "8e-07 GB" + [3,] "7.796269e-04 GB" "7.80e-04 GB" "7.8e-04 GB" "8e-04 GB" + [4,] "8.033561e-01 GB" "8.03e-01 GB" "8.0e-01 GB" "8e-01 GB" + [5,] "8.314840e+02 GB" "8.31e+02 GB" "8.3e+02 GB" "8e+02 GB" + [6,] "8.018065e+05 GB" "8.02e+05 GB" "8.0e+05 GB" "8e+05 GB" + [7,] "8.032533e+08 GB" "8.03e+08 GB" "8.0e+08 GB" "8e+08 GB" + [8,] "7.736007e+11 GB" "7.74e+11 GB" "7.7e+11 GB" "8e+11 GB" + [9,] "8.033881e+14 GB" "8.03e+14 GB" "8.0e+14 GB" "8e+14 GB" +[10,] "6.856332e+17 GB" "6.86e+17 GB" "6.9e+17 GB" "7e+17 GB" [,5] [,6] [,7] [,8] [1,] "4.656613e-10 GiB" "4.66e-10 GiB" "4.7e-10 GiB" "5e-10 GiB" - [2,] "6.058649e-07 GiB" "6.06e-07 GiB" "6.1e-07 GiB" "6e-07 GiB" - [3,] "7.437373e-04 GiB" "7.44e-04 GiB" "7.4e-04 GiB" "7e-04 GiB" - [4,] "7.890501e-01 GiB" "7.89e-01 GiB" "7.9e-01 GiB" "8e-01 GiB" - [5,] "2.665461e+02 GiB" "2.67e+02 GiB" "2.7e+02 GiB" "3e+02 GiB" - [6,] "6.781352e+05 GiB" "6.78e+05 GiB" "6.8e+05 GiB" "7e+05 GiB" - [7,] "7.658425e+08 GiB" "7.66e+08 GiB" "7.7e+08 GiB" "8e+08 GiB" - [8,] "4.681329e+11 GiB" "4.68e+11 GiB" "4.7e+11 GiB" "5e+11 GiB" - [9,] "8.705167e+14 GiB" "8.71e+14 GiB" "8.7e+14 GiB" "9e+14 GiB" -[10,] "6.227605e+17 GiB" "6.23e+17 GiB" "6.2e+17 GiB" "6e+17 GiB" + [2,] "7.138398e-07 GiB" "7.14e-07 GiB" "7.1e-07 GiB" "7e-07 GiB" + [3,] "7.600841e-04 GiB" "7.60e-04 GiB" "7.6e-04 GiB" "8e-04 GiB" + [4,] "8.231780e-01 GiB" "8.23e-01 GiB" "8.2e-01 GiB" "8e-01 GiB" + [5,] "5.678312e+02 GiB" "5.68e+02 GiB" "5.7e+02 GiB" "6e+02 GiB" + [6,] "5.506880e+05 GiB" "5.51e+05 GiB" "5.5e+05 GiB" "6e+05 GiB" + [7,] "8.221636e+08 GiB" "8.22e+08 GiB" "8.2e+08 GiB" "8e+08 GiB" + [8,] "8.721612e+11 GiB" "8.72e+11 GiB" "8.7e+11 GiB" "9e+11 GiB" + [9,] "4.356026e+14 GiB" "4.36e+14 GiB" "4.4e+14 GiB" "4e+14 GiB" +[10,] "8.080586e+17 GiB" "8.08e+17 GiB" "8.1e+17 GiB" "8e+17 GiB" [,9] [,10] [,11] [,12] [1,] "4.656613e-10 G" "4.66e-10 G" "4.7e-10 G" "5e-10 G" - [2,] "6.058649e-07 G" "6.06e-07 G" "6.1e-07 G" "6e-07 G" - [3,] "7.437373e-04 G" "7.44e-04 G" "7.4e-04 G" "7e-04 G" - [4,] "7.890501e-01 G" "7.89e-01 G" "7.9e-01 G" "8e-01 G" - [5,] "2.665461e+02 G" "2.67e+02 G" "2.7e+02 G" "3e+02 G" - [6,] "6.781352e+05 G" "6.78e+05 G" "6.8e+05 G" "7e+05 G" - [7,] "7.658425e+08 G" "7.66e+08 G" "7.7e+08 G" "8e+08 G" - [8,] "4.681329e+11 G" "4.68e+11 G" "4.7e+11 G" "5e+11 G" - [9,] "8.705167e+14 G" "8.71e+14 G" "8.7e+14 G" "9e+14 G" -[10,] "6.227605e+17 G" "6.23e+17 G" "6.2e+17 G" "6e+17 G" + [2,] "7.138398e-07 G" "7.14e-07 G" "7.1e-07 G" "7e-07 G" + [3,] "7.600841e-04 G" "7.60e-04 G" "7.6e-04 G" "8e-04 G" + [4,] "8.231780e-01 G" "8.23e-01 G" "8.2e-01 G" "8e-01 G" + [5,] "5.678312e+02 G" "5.68e+02 G" "5.7e+02 G" "6e+02 G" + [6,] "5.506880e+05 G" "5.51e+05 G" "5.5e+05 G" "6e+05 G" + [7,] "8.221636e+08 G" "8.22e+08 G" "8.2e+08 G" "8e+08 G" + [8,] "8.721612e+11 G" "8.72e+11 G" "8.7e+11 G" "9e+11 G" + [9,] "4.356026e+14 G" "4.36e+14 G" "4.4e+14 G" "4e+14 G" +[10,] "8.080586e+17 G" "8.08e+17 G" "8.1e+17 G" "8e+17 G" > > > stopifnot( is.object_sizes(as.object_sizes( 2^(1:30) ) ) ) @@ -240,4 +238,4 @@ > > proc.time() user system elapsed - 0.411 0.048 0.455 + 0.368 0.047 0.415 Modified: trunk/gdata/tests/test.reorder.factor.Rout.save =================================================================== --- trunk/gdata/tests/test.reorder.factor.Rout.save 2015-04-25 09:11:54 UTC (rev 1965) +++ trunk/gdata/tests/test.reorder.factor.Rout.save 2015-04-25 16:23:31 UTC (rev 1966) @@ -1,14 +1,12 @@ -R version 3.1.2 (2014-10-31) -- "Pumpkin Helmet" -Copyright (C) 2014 The R Foundation for Statistical Computing -Platform: x86_64-unknown-linux-gnu (64-bit) +R version 3.2.0 (2015-04-16) -- "Full of Ingredients" +Copyright (C) 2015 The R Foundation for Statistical Computing +Platform: x86_64-apple-darwin13.4.0 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. - Natural language support but running in an English locale - R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. @@ -31,20 +29,23 @@ > library(gdata) gdata: read.xls support for 'XLS' (Excel 97-2004) files ENABLED. -gdata: read.xls support for 'XLSX' (Excel 2007+) files ENABLED. +gdata: Unable to load perl libaries needed by read.xls() +gdata: to support 'XLSX' (Excel 2007+) files. -Attaching package: ‘gdata’ +gdata: Run the function 'installXLSXsupport()' +gdata: to automatically download and install the perl +gdata: libaries needed to support Excel XLS and XLSX formats. -The following object is masked from ‘package:stats’: +Attaching package: 'gdata' +The following object is masked from 'package:stats': + nobs -The following object is masked from ‘package:utils’: +The following object is masked from 'package:utils': object.size -Warning message: -S3 methods ‘print.object_size’, ‘c.object_size’ were declared in NAMESPACE but not found > > ( m2 <- reorder(m, X=c(3, 2, 1)) ) [1] a b c @@ -57,4 +58,4 @@ > > proc.time() user system elapsed - 0.512 0.070 0.638 + 0.300 0.049 0.345 Modified: trunk/gdata/tests/tests.write.fwf.Rout.save =================================================================== --- trunk/gdata/tests/tests.write.fwf.Rout.save 2015-04-25 09:11:54 UTC (rev 1965) +++ trunk/gdata/tests/tests.write.fwf.Rout.save 2015-04-25 16:23:31 UTC (rev 1966) @@ -1,7 +1,7 @@ -R version 3.1.0 Patched (2014-05-26 r65771) -- "Spring Dance" -Copyright (C) 2014 The R Foundation for Statistical Computing -Platform: x86_64-apple-darwin13.1.0 (64-bit) +R version 3.2.0 (2015-04-16) -- "Full of Ingredients" +Copyright (C) 2015 The R Foundation for Statistical Computing +Platform: x86_64-apple-darwin13.4.0 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. @@ -25,8 +25,13 @@ > library(gdata) gdata: read.xls support for 'XLS' (Excel 97-2004) files ENABLED. -gdata: read.xls support for 'XLSX' (Excel 2007+) files ENABLED. +gdata: Unable to load perl libaries needed by read.xls() +gdata: to support 'XLSX' (Excel 2007+) files. +gdata: Run the function 'installXLSXsupport()' +gdata: to automatically download and install the perl +gdata: libaries needed to support Excel XLS and XLSX formats. + Attaching package: 'gdata' The following object is masked from 'package:stats': @@ -80,7 +85,7 @@ > ## NA should be - > write.fwf(x=testData, na="-") num1 num2 num3 int1 fac1 fac2 cha1 cha2 Date POSIXt - 1 - - 1 - f q - 1900-01-01 1900-01-01 01:01:01 + 1 - - 1 - f q - 1900-01-01 1900-01-01 01:01:01 2 1.0 733070.3 2 a g r longer - 1900-01-01 01:01:01 3 1.5 1214213.8 3 b h s y 1900-01-01 1900-01-01 01:01:01 4 2.0 553823.8 4 c i t x 1900-01-01 1900-01-01 01:01:01 @@ -90,21 +95,21 @@ 8 4.0 1053686.6 6 g m x t 1900-01-01 1900-01-01 01:01:01 9 4.5 971024.2 7 h n y s 1900-01-01 1900-01-01 01:01:01 10 5.0 631193.4 8 i o z r 1900-01-01 1900-01-01 01:01:01 - - 5.5 879431.1 9 hjh - - q 1900-01-01 1900-01-01 01:01:01 +- 5.5 879431.1 9 hjh - - q 1900-01-01 1900-01-01 01:01:01 > ## NA should be -NA- > write.fwf(x=testData, na="-NA-") num1 num2 num3 int1 fac1 fac2 cha1 cha2 Date POSIXt - 1 -NA- -NA- 1 -NA- f q -NA- 1900-01-01 1900-01-01 01:01:01 - 2 1.0 733070.3 2 a g r longer -NA- 1900-01-01 01:01:01 - 3 1.5 1214213.8 3 b h s y 1900-01-01 1900-01-01 01:01:01 - 4 2.0 553823.8 4 c i t x 1900-01-01 1900-01-01 01:01:01 - 5 2.5 1085022.9 -NA- d j u w 1900-01-01 -NA- - 6 3.0 571063.9 4 e k v v 1900-01-01 1900-01-01 01:01:01 - 7 3.5 606718.4 5 f l w u 1900-01-01 1900-01-01 01:01:01 - 8 4.0 1053686.6 6 g m x t 1900-01-01 1900-01-01 01:01:01 - 9 4.5 971024.2 7 h n y s 1900-01-01 1900-01-01 01:01:01 - 10 5.0 631193.4 8 i o z r 1900-01-01 1900-01-01 01:01:01 --NA- 5.5 879431.1 9 hjh -NA- -NA- q 1900-01-01 1900-01-01 01:01:01 + 1 -NA- -NA- 1 -NA- f q -NA- 1900-01-01 1900-01-01 01:01:01 + 2 1.0 733070.3 2 a g r longer -NA- 1900-01-01 01:01:01 + 3 1.5 1214213.8 3 b h s y 1900-01-01 1900-01-01 01:01:01 + 4 2.0 553823.8 4 c i t x 1900-01-01 1900-01-01 01:01:01 + 5 2.5 1085022.9 -NA- d j u w 1900-01-01 -NA- + 6 3.0 571063.9 4 e k v v 1900-01-01 1900-01-01 01:01:01 + 7 3.5 606718.4 5 f l w u 1900-01-01 1900-01-01 01:01:01 + 8 4.0 1053686.6 6 g m x t 1900-01-01 1900-01-01 01:01:01 + 9 4.5 971024.2 7 h n y s 1900-01-01 1900-01-01 01:01:01 +10 5.0 631193.4 8 i o z r 1900-01-01 1900-01-01 01:01:01 +-NA- 5.5 879431.1 9 hjh -NA- -NA- q 1900-01-01 1900-01-01 01:01:01 > > ## Some other separator than space > write.fwf(testData[, 1:4], sep="-mySep-") @@ -231,4 +236,4 @@ > > proc.time() user system elapsed - 0.388 0.041 0.422 + 0.413 0.044 0.448 Modified: trunk/gdata/tests/unitTests/runit.write.fwf.R =================================================================== --- trunk/gdata/tests/unitTests/runit.write.fwf.R 2015-04-25 09:11:54 UTC (rev 1965) +++ trunk/gdata/tests/unitTests/runit.write.fwf.R 2015-04-25 16:23:31 UTC (rev 1966) @@ -59,9 +59,17 @@ digits=c(0, 1), exp=c(0, 0), stringsAsFactors=FALSE) - formatInfo <- write.fwf(testData[, c("num1", "num2")], formatInfo=TRUE) + + testData1 <- testData[, c("num1", "num2")] + testData1M <- as.matrix(testData1) + + formatInfo <- write.fwf(testData1, formatInfo=TRUE) checkEquals(formatInfo, formatInfoT) + formatInfoM <- write.fwf(testData1M, formatInfo=TRUE) + checkEquals(formatInfoM, formatInfoT) + + ## scientific notation dd <- options("digits"); options(digits = 7) testData2 <- data.frame(a=123, b=pi, c=1e8, d=1e222) @@ -91,39 +99,66 @@ digits=c(0, 0, 1), exp=c(0, 0, 0), stringsAsFactors=FALSE) - formatInfoR <- write.fwf(testData[, c("num1", "num2")], formatInfo=TRUE, - rownames=TRUE, rowCol="row") + testData3 <- testData[, c("num1", "num2")] + testData3M <- as.matrix(testData3) + + formatInfoR <- write.fwf(testData3, formatInfo=TRUE, rownames=TRUE, + rowCol="row") checkEquals(formatInfoR, formatInfoTR) + formatInfoR <- write.fwf(testData3M, formatInfo=TRUE, rownames=TRUE, + rowCol="row") + checkEquals(formatInfoR, formatInfoTR) + + ## quoteInfo alone does not have any effect - formatInfoI <- write.fwf(testData[, c("num1", "num2")], formatInfo=TRUE, - quoteInfo=TRUE) + formatInfoI <- write.fwf(testData3, formatInfo=TRUE, quoteInfo=TRUE) checkEquals(formatInfoI, formatInfoT) + formatInfoI <- write.fwf(testData3M, formatInfo=TRUE, quoteInfo=TRUE) + checkEquals(formatInfoI, formatInfoT) + ## quote - formatInfoQ <- write.fwf(testData[, c("num1", "num2")], formatInfo=TRUE, - quote=TRUE) formatInfoTQ <- formatInfoT formatInfoTQ$position <- c(1, 6) formatInfoTQ$width <- c(4, 5) + + formatInfoQ <- write.fwf(testData3, formatInfo=TRUE, quote=TRUE) checkEquals(formatInfoQ, formatInfoTQ) + formatInfoQ <- write.fwf(testData3M, formatInfo=TRUE, quote=TRUE) + checkEquals(formatInfoQ, formatInfoTQ) + ## quote without quoteInfo - formatInfoQI <- write.fwf(testData[, c("num1", "num2")], formatInfo=TRUE, - quote=TRUE, quoteInfo=FALSE) formatInfoTQI <- formatInfoT formatInfoTQI$position <- c(2, 6) + + formatInfoQI <- write.fwf(testData3, formatInfo=TRUE, quote=TRUE, + quoteInfo=FALSE) checkEquals(formatInfoQI, formatInfoTQI) + formatInfoQI <- write.fwf(testData3M, formatInfo=TRUE, quote=TRUE, + quoteInfo=FALSE) + checkEquals(formatInfoQI, formatInfoTQI) + ## width ## --> default width for num1 is 2 - formatInfo <- write.fwf(testData[, "num1", drop=FALSE], width=10, formatInfo=TRUE) + testData4 <- testData[, "num1", drop=FALSE] + testData4M <- as.matrix(testData[, "num1", drop=FALSE]) + + formatInfo <- write.fwf(testData4, width=10, formatInfo=TRUE) checkEquals(formatInfo$width, 10) + formatInfo <- write.fwf(testData4M, width=10, formatInfo=TRUE) + checkEquals(formatInfo$width, 10) + ## too small value in width (this also tests recycling) ## --> proper width for num1 is 2, while for num2 it is 3 checkException(write.fwf(testData[, c("num1", "num2")], width=2)) checkException(write.fwf(testData[, c("num1", "num2")], width=c(2, 1))) + + ## Done + cat("\nDONE.\n\n") } ### }}} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2015-04-25 16:50:06
|
Revision: 1970 http://sourceforge.net/p/r-gregmisc/code/1970 Author: warnes Date: 2015-04-25 16:49:59 +0000 (Sat, 25 Apr 2015) Log Message: ----------- Remove aggregate.table() entirely Modified Paths: -------------- trunk/gdata/NAMESPACE Removed Paths: ------------- trunk/gdata/R/aggregate.table.R Modified: trunk/gdata/NAMESPACE =================================================================== --- trunk/gdata/NAMESPACE 2015-04-25 16:46:12 UTC (rev 1969) +++ trunk/gdata/NAMESPACE 2015-04-25 16:49:59 UTC (rev 1970) @@ -3,7 +3,6 @@ .onAttach, ans, Args, - aggregate.table, bindData, case, cbindX, Deleted: trunk/gdata/R/aggregate.table.R =================================================================== --- trunk/gdata/R/aggregate.table.R 2015-04-25 16:46:12 UTC (rev 1969) +++ trunk/gdata/R/aggregate.table.R 2015-04-25 16:49:59 UTC (rev 1970) @@ -1,39 +0,0 @@ -# $Id$ - -aggregate.table <- function(x, by1, by2, FUN=mean, ...) - { - .Defunct( - new=paste( - "tapply(X=", - deparse(substitute(x)), - ", INDEX=list(", - deparse(substitute(by1)), - ", ", - deparse(substitute(by2)), - "), FUN=", - deparse(substitute(FUN)), - if(length(list(...))>0) - { - l <- list(...) - paste(", ", - paste(names(l),"=", - deparse(substitute(...)), - sep="", - collapse=", ") - ) - }, - ")", sep=""), - package="gdata" - ) - } - -## aggregate.table <- function(x, by1, by2, FUN=mean, ... ) -## { -## -## tab <- matrix( nrow=nlevels(by1), ncol=nlevels(by2) ) -## dimnames(tab) <- list(levels(by1),levels(by2)) -## -## for(i in 1:nrow(ag)) -## tab[ as.character(ag[i,1]), as.character(ag[i,2]) ] <- ag[i,3] -## tab -## } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2015-04-28 04:41:42
|
Revision: 1977 http://sourceforge.net/p/r-gregmisc/code/1977 Author: warnes Date: 2015-04-28 04:41:39 +0000 (Tue, 28 Apr 2015) Log Message: ----------- If arguments 'X' or 'FUN' is supplied to reorder.factor(), mimic the behavior of stats::reorder.default() rather than trying to call it via NextMethod. Modified Paths: -------------- trunk/gdata/R/reorder.R trunk/gdata/man/reorder.Rd Modified: trunk/gdata/R/reorder.R =================================================================== --- trunk/gdata/R/reorder.R 2015-04-28 04:27:04 UTC (rev 1976) +++ trunk/gdata/R/reorder.R 2015-04-28 04:41:39 UTC (rev 1977) @@ -1,7 +1,3 @@ -# $Id$ - -# Reorder the levels of a factor. - reorder.factor <- function(x, X, FUN, @@ -13,17 +9,28 @@ constructor <- if (order) ordered else factor if(!missing(X) || !missing(FUN)) - return( NextMethod(x)) + { + if(missing(FUN)) FUN <- 'mean' - if (!missing(new.order)) + ## I would prefer to call stats::reorder.default directly, + ## but it exported from stats, so the relevant code is + ## replicated here: + ## --> + scores <- tapply(X = X, INDEX = x, FUN = FUN, ...) + ans <- (if (order) + ordered + else factor)(x, levels = names(sort(scores, na.last = TRUE))) + attr(ans, "scores") <- scores + ## <-- + return(ans) + } + else if (!missing(new.order)) { if (is.numeric(new.order)) new.order <- levels(x)[new.order] else new.order <- new.order } - else if (!missing(FUN)) - new.order <- names(sort(tapply(X, x, FUN, ...))) else new.order <- sort(levels(x)) Modified: trunk/gdata/man/reorder.Rd =================================================================== --- trunk/gdata/man/reorder.Rd 2015-04-28 04:27:04 UTC (rev 1976) +++ trunk/gdata/man/reorder.Rd 2015-04-28 04:41:39 UTC (rev 1977) @@ -38,23 +38,23 @@ The groups are then sorted by this value, and the resulting order is used for the new factor level names. - If \code{new.order} is provided: For a numeric vector, the new factor - level names are constructed by reordering the factor levels according - to the numeric values. For vectors, \code{new.order} gives the list of - new factor level names. In either case levels omitted from - \code{new.order} will become missing (\code{NA}) values. + If \code{new.order} is a numeric vector, the new factor level names + are constructed by reordering the factor levels according to the + numeric values. If \code{new.order} is a chraccter vector, + \code{new.order} gives the list of new factor level names. In either + case levels omitted from \code{new.order} will become missing + (\code{NA}) values. - If \code{sort} is provided (as it is by default): The new - factor level names are generated by applying the supplied function - to the existing factor level names. With \code{sort=mixedsort} the - factor levels are sorted so that combined numeric and character - strings are sorted in according to character rules on the character - sections (including ignoring case), and the numeric rules for the - numeric sections. See \code{\link[gtools]{mixedsort}} for details. + If \code{sort} is provided (as it is by default): The new factor level + names are generated by calling the function specified by \code{sort} + to the existing factor level \emph{names}. With \code{sort=mixedsort} + (the default) the factor levels are sorted so that combined numeric + and character strings are sorted in according to character rules on + the character sections (including ignoring case), and the numeric + rules for the numeric sections. See \code{\link[gtools]{mixedsort}} + for details. } -\value{ - A new factor with reordered levels -} +\value{ A new factor with reordered levels } \author{Gregory R. Warnes \email{gr...@wa...}} @@ -67,21 +67,21 @@ summary(trt) # Note that the levels are not in a meaningful order. - # Change the order to something useful - # default "mixedsort" ordering + # Change the order to something useful.. + # - default "mixedsort" ordering trt2 <- reorder(trt) summary(trt2) - # using indexes: + # - using indexes: trt3 <- reorder(trt, new.order=c(4, 2, 3, 1)) summary(trt3) - # using label names: + # - using label names: trt4 <- reorder(trt, new.order=c("PLACEBO", "300 MG", "600 MG", "1200 MG")) summary(trt4) - # using frequency + # - using frequency trt5 <- reorder(trt, X=as.numeric(trt), FUN=length) summary(trt5) - # drop out the '300 MG' level + # Drop out the '300 MG' level trt6 <- reorder(trt, new.order=c("PLACEBO", "600 MG", "1200 MG")) summary(trt6) } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2015-04-28 04:44:11
|
Revision: 1978 http://sourceforge.net/p/r-gregmisc/code/1978 Author: warnes Date: 2015-04-28 04:44:08 +0000 (Tue, 28 Apr 2015) Log Message: ----------- - first() and last() are now simply wrappers to utils::head() and utils::tail() with a default 'n=1' instead of 'n=6'. - Move code for left() and right() into a separate file. Modified Paths: -------------- trunk/gdata/R/first.R trunk/gdata/man/first.Rd Added Paths: ----------- trunk/gdata/R/left.R Modified: trunk/gdata/R/first.R =================================================================== --- trunk/gdata/R/first.R 2015-04-28 04:41:39 UTC (rev 1977) +++ trunk/gdata/R/first.R 2015-04-28 04:44:08 UTC (rev 1978) @@ -1,30 +1,3 @@ -first <- function(x) UseMethod("first") -last <- function(x) UseMethod("last") - -left <- function(x, n=6) UseMethod("left") -right <- function(x, n=6) UseMethod("left") - - -first.default <- function(x) x[1] -last.default <- function(x) x[length(x)] - - -first.list <- function(x) x[[1]] -last.list <- function(x) x[[length(x)]] - - -left.data.frame <- function(x, n=6) -{ - n <- min(n, ncol(x)) - x[, 1:n] -} -left.matrix <- left.data.frame - - -right.data.frame <- function(x, n=6) -{ - n <- min(n, ncol(x)) - x[, (ncol(x)-n+1):ncol(x)] -} -right.matrix <- right.data.frame - +# Simply call 'first' or 'last' with a different default value for 'n'. +first <- function(x, n=1, ...) head(x, n=n, ...) +last <- function(x, n=1, ...) tail(x, n=n, ...) Added: trunk/gdata/R/left.R =================================================================== --- trunk/gdata/R/left.R (rev 0) +++ trunk/gdata/R/left.R 2015-04-28 04:44:08 UTC (rev 1978) @@ -0,0 +1,38 @@ +left <- function(x, n=6L) UseMethod("left") +right <- function(x, n=6L) UseMethod("left") + +left.data.frame <- function(x, n=6) +{ + stopifnot(length(n) == 1L) + n <- if (n < 0L) + max(ncol(x) + n, 0L) + else min(n, ncol(x)) + x[, seq_len(n), drop = FALSE] +} +left.matrix <- left.data.frame + + +right.data.frame <- function (x, n = 6L, ...) +{ + stopifnot(length(n) == 1L) + ncx <- ncol(x) + n <- if (n < 0L) + max(ncx + n, 0L) + else min(n, ncx) + x[, seq.int(to = ncx, length.out = n), drop = FALSE] +} + +right.matrix <- function (x, n = 6L, addcolnums = TRUE, ...) +{ + stopifnot(length(n) == 1L) + ncx <- ncol(x) + n <- if (n < 0L) + max(ncx + n, 0L) + else min(n, ncx) + sel <- seq.int(to = ncx, length.out = n) + ans <- x[, sel, drop = FALSE] + if (addcolnums && is.null(colnames(x))) + colnames(ans) <- paste0("[", sel, ",]") + ans +} + Modified: trunk/gdata/man/first.Rd =================================================================== --- trunk/gdata/man/first.Rd 2015-04-28 04:41:39 UTC (rev 1977) +++ trunk/gdata/man/first.Rd 2015-04-28 04:44:08 UTC (rev 1978) @@ -1,28 +1,25 @@ \name{first} \alias{first} -\alias{first.default} -\alias{first.list} \alias{last} -\alias{last.default} -\alias{last.list} -\title{Return first or last element of a vector or list} +\title{Return first or last element of an object} \description{ - Return first or last element of a vector or list -} + Return first or last element of an object. These functions are convenience + wrappers for \code{head(x, n=1, ...)} and \code{tail(x, n=1, ...)}. + } \usage{ -first(x) -last(x) -\method{first}{default}(x) -\method{last}{default}(x) -\method{first}{list}(x) -\method{last}{list}(x) +first(x, n=1, ...) +last(x, n=1, ...) } -%- maybe also 'usage' for other objects documented here. \arguments{ - \item{x}{vector or list} + \item{x}{data object} + \item{n}{a single integer. If positive, size for the resulting object: + number of elements for a vector (including lists), rows for a + matrix or data frame or lines for a function. If negative, + all but the ‘n’ last/first number of elements of ‘x’.} + \item{...}{arguments to be passed to or from other methods.} } \value{ - The first or last element of \code{x}. + An object (usually) like ‘x’ but generally smaller. } \author{ Gregory R. Warnes \email{gr...@wa...} @@ -43,5 +40,16 @@ l <- list(a=1, b=2, c=3) first(l) last(l) + +## and data.frames +df <- data.frame(a=1:2, b=3:4, c=5:6) +first(df) +last(df) + +## and matrixes +m <- as.matrix(df) +first(m) +last(m) + } \keyword{ manip } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wa...@us...> - 2015-04-29 01:29:33
|
Revision: 1989 http://sourceforge.net/p/r-gregmisc/code/1989 Author: warnes Date: 2015-04-29 01:29:30 +0000 (Wed, 29 Apr 2015) Log Message: ----------- Display read latin1 data so that diff can catch changes. Modified Paths: -------------- trunk/gdata/R/installXLSXsupport.R trunk/gdata/tests/test.humanReadable.Rout.save trunk/gdata/tests/test.read.xls.R trunk/gdata/tests/test.read.xls.Rout.save trunk/gdata/tests/test.reorder.factor.Rout.save trunk/gdata/tests/tests.write.fwf.Rout.save Modified: trunk/gdata/R/installXLSXsupport.R =================================================================== --- trunk/gdata/R/installXLSXsupport.R 2015-04-28 21:12:20 UTC (rev 1988) +++ trunk/gdata/R/installXLSXsupport.R 2015-04-29 01:29:30 UTC (rev 1989) @@ -7,17 +7,18 @@ findPerl(verbose = verbose) else findPerl(perl, verbose = verbose) - + ## ## directories package.dir <- find.package('gdata') perl.dir <- file.path(package.dir,'perl') + temp.dir <- tempdir() ## ## cmd <- "install_modules.pl" sc <- file.path(perl.dir, cmd) - + ## ## @@ -53,6 +54,6 @@ else { stop("\nUnable to install Perl XLSX support libraries.\n\n") - invisible(FALSE) - } + invisible(FALSE) + } } Modified: trunk/gdata/tests/test.humanReadable.Rout.save =================================================================== --- trunk/gdata/tests/test.humanReadable.Rout.save 2015-04-28 21:12:20 UTC (rev 1988) +++ trunk/gdata/tests/test.humanReadable.Rout.save 2015-04-29 01:29:30 UTC (rev 1989) @@ -235,4 +235,4 @@ > > proc.time() user system elapsed - 0.410 0.050 0.451 + 0.384 0.045 0.421 Modified: trunk/gdata/tests/test.read.xls.R =================================================================== --- trunk/gdata/tests/test.read.xls.R 2015-04-28 21:12:20 UTC (rev 1988) +++ trunk/gdata/tests/test.read.xls.R 2015-04-29 01:29:30 UTC (rev 1989) @@ -51,27 +51,29 @@ if( 'XLSX' %in% xlsFormats() ) { - example.x.1 <- read.xls(exampleFileX, sheet=1) # default is first worksheet - print(example.x.1) + example.x.1 <- read.xls(exampleFileX, sheet=1) # default is first worksheet + print(example.x.1) - example.x.2 <- read.xls(exampleFileX, sheet=2) # second worksheet by number - print(example.x.2) + example.x.2 <- read.xls(exampleFileX, sheet=2) # second worksheet by number + print(example.x.2) - example.x.3 <- read.xls(exampleFileX, sheet=3, header=FALSE) # third worksheet by number - print(example.x.3) + example.x.3 <- read.xls(exampleFileX, sheet=3, header=FALSE) # third worksheet by number + print(example.x.3) - example.x.4 <- read.xls(exampleFileX, sheet=4, header=FALSE) # fourth worksheet by number - print(example.x.4) + example.x.4 <- read.xls(exampleFileX, sheet=4, header=FALSE) # fourth worksheet by number + print(example.x.4) - data <- read.xls(exampleFileX, sheet="Sheet Second") # and by name - print(data) + data <- read.xls(exampleFileX, sheet="Sheet Second") # and by name + print(data) - # load the third worksheet, skipping the first two non-data lines... - data <- read.xls(exampleFileX, sheet="Sheet with initial text", skip=2) - print(data) -} + # load the third worksheet, skipping the first two non-data lines... + data <- read.xls(exampleFileX, sheet="Sheet with initial text", skip=2) + print(data) + } else { + cat("** DIFF IN THIS SECTION IS EXPECTED BECAUSE PERL PACKAGES **\n") + cat("** FOR SUPPORTING XLSX ARE NOT INSTALLED **\n") + } - ## Check handling of skip.blank.lines=FALSE example.skip <- read.xls(exampleFile, sheet=2, blank.lines.skip=FALSE) @@ -81,6 +83,9 @@ { example.x.skip <- read.xls(exampleFileX, sheet=2, blank.lines.skip=FALSE) example.x.skip + } else { + cat("** DIFF IN THIS SECTION IS EXPECTED BECAUSE PERL PACKAGES **\n") + cat("** FOR SUPPORTING XLSX ARE NOT INSTALLED **\n") } @@ -90,10 +95,15 @@ latin1FileX <- file.path(path.package('gdata'),'xls', 'latin-1.xlsx') example.latin1 <- read.xls(latin1File, fileEncoding='latin1') +example.latin1 if( 'XLSX' %in% xlsFormats() ) { - example.latin1.x <- read.xls(latin1FileX, fileEncoding='latin1') + example.latin1.x <- read.xls(latin1FileX, fileEncoding='latin1') + example.latin1.x + } else { + cat("** DIFF IN THIS SECTION IS EXPECTED BECAUSE PERL PACKAGES **\n") + cat("** FOR SUPPORTING XLSX ARE NOT INSTALLED **\n") } @@ -109,6 +119,9 @@ { example.wide.x <- read.xls(wideFileX) stopifnot(dim(example.wide.x)==c(0,16384)) + } else { + cat("** DIFF IN THIS SECTION IS EXPECTED BECAUSE PERL PACKAGES **\n") + cat("** FOR SUPPORTING XLSX ARE NOT INSTALLED **\n") } ## Check handling of files with dates calulcated relative to Modified: trunk/gdata/tests/test.read.xls.Rout.save =================================================================== --- trunk/gdata/tests/test.read.xls.Rout.save 2015-04-28 21:12:20 UTC (rev 1988) +++ trunk/gdata/tests/test.read.xls.Rout.save 2015-04-29 01:29:30 UTC (rev 1989) @@ -592,25 +592,28 @@ > > if( 'XLSX' %in% xlsFormats() ) + { -+ example.x.1 <- read.xls(exampleFileX, sheet=1) # default is first worksheet -+ print(example.x.1) ++ example.x.1 <- read.xls(exampleFileX, sheet=1) # default is first worksheet ++ print(example.x.1) + -+ example.x.2 <- read.xls(exampleFileX, sheet=2) # second worksheet by number -+ print(example.x.2) ++ example.x.2 <- read.xls(exampleFileX, sheet=2) # second worksheet by number ++ print(example.x.2) + -+ example.x.3 <- read.xls(exampleFileX, sheet=3, header=FALSE) # third worksheet by number -+ print(example.x.3) ++ example.x.3 <- read.xls(exampleFileX, sheet=3, header=FALSE) # third worksheet by number ++ print(example.x.3) + -+ example.x.4 <- read.xls(exampleFileX, sheet=4, header=FALSE) # fourth worksheet by number -+ print(example.x.4) ++ example.x.4 <- read.xls(exampleFileX, sheet=4, header=FALSE) # fourth worksheet by number ++ print(example.x.4) + -+ data <- read.xls(exampleFileX, sheet="Sheet Second") # and by name -+ print(data) ++ data <- read.xls(exampleFileX, sheet="Sheet Second") # and by name ++ print(data) + -+ # load the third worksheet, skipping the first two non-data lines... -+ data <- read.xls(exampleFileX, sheet="Sheet with initial text", skip=2) -+ print(data) -+ } ++ # load the third worksheet, skipping the first two non-data lines... ++ data <- read.xls(exampleFileX, sheet="Sheet with initial text", skip=2) ++ print(data) ++ } else { ++ cat("** DIFF IN THIS SECTION IS EXPECTED BECAUSE PERL PACKAGES **\n") ++ cat("** FOR SUPPORTING XLSX ARE NOT INSTALLED **\n") ++ } A B C 1 1 1 1 2 2 4 8 @@ -673,7 +676,6 @@ 3 NA ThirdRow 3 2 1 NA Red 4 NA FourthRow 4 3 2 1 Black > -> > ## Check handling of skip.blank.lines=FALSE > > example.skip <- read.xls(exampleFile, sheet=2, blank.lines.skip=FALSE) @@ -689,6 +691,9 @@ + { + example.x.skip <- read.xls(exampleFileX, sheet=2, blank.lines.skip=FALSE) + example.x.skip ++ } else { ++ cat("** DIFF IN THIS SECTION IS EXPECTED BECAUSE PERL PACKAGES **\n") ++ cat("** FOR SUPPORTING XLSX ARE NOT INSTALLED **\n") + } X D E. F G Factor 1 FirstRow 1 NA NA NA Red @@ -704,11 +709,646 @@ > latin1FileX <- file.path(path.package('gdata'),'xls', 'latin-1.xlsx') > > example.latin1 <- read.xls(latin1File, fileEncoding='latin1') +> example.latin1 + X.á. X.Á. X.â. X.Â. X.à. X.À. X.å. X.Å. +1 aacute á small a, acute accent NA NA NA NA NA +2 Aacute Á capital A, acute accent NA NA NA NA NA +3 acirc â small a, circumflex accent NA NA NA NA NA +4 Acirc  capital A, circumflex accent NA NA NA NA NA +5 agrave à small a, grave accent NA NA NA NA NA +6 Agrave À capital A, grave accent NA NA NA NA NA +7 aring å small a, ring NA NA NA NA NA +8 Aring Å capital A, ring NA NA NA NA NA +9 atilde ã small a, tilde NA NA NA NA NA +10 Atilde à capital A, tilde NA NA NA NA NA +11 auml ä small a, dieresis or umlautmark NA NA NA NA NA +12 Auml Ä capital A, dieresis or umlautmark NA NA NA NA NA +13 aelig æ small ae diphthong (ligature) NA NA NA NA NA +14 AElig Æ capital AE diphthong(ligature) NA NA NA NA NA +15 ccedil ç small c, cedilla NA NA NA NA NA +16 Ccedil Ç capital C, cedilla NA NA NA NA NA +17 eth ð small eth, Icelandic NA NA NA NA NA +18 ETH Ð capital Eth, Icelandic NA NA NA NA NA +19 eacute é small e, acute accent NA NA NA NA NA +20 Eacute É capital E, acute accent NA NA NA NA NA +21 ecirc ê small e, circumflex accent NA NA NA NA NA +22 Ecirc Ê capital E, circumflex accent NA NA NA NA NA +23 egrave è small e, grave accent NA NA NA NA NA +24 Egrave È capital E, grave accent NA NA NA NA NA +25 euml ë small e, dieresis or umlautmark NA NA NA NA NA +26 Euml Ë capital E, dieresis or umlautmark NA NA NA NA NA +27 iacute í small i, acute accent NA NA NA NA NA +28 Iacute Í capital I, acute accent NA NA NA NA NA +29 icirc î small i, circumflex accent NA NA NA NA NA +30 Icirc Î capital I, circumflex accent NA NA NA NA NA +31 igrave ì small i, grave accent NA NA NA NA NA +32 Igrave Ì capital I, grave accent NA NA NA NA NA +33 iuml ï small i, dieresis or umlautmark NA NA NA NA NA +34 Iuml Ï capital I, dieresis or umlautmark NA NA NA NA NA +35 ntilde ñ small n, tilde NA NA NA NA NA +36 Ntilde Ñ capital N, tilde NA NA NA NA NA +37 oacute ó small o, acute accent NA NA NA NA NA +38 Oacute Ó capital O, acute accent NA NA NA NA NA +39 ocirc ô small o, circumflex accent NA NA NA NA NA +40 Ocirc Ô capital O, circumflex accent NA NA NA NA NA +41 ograve ò small o, grave accent NA NA NA NA NA +42 Ograve Ò capital O, grave accent NA NA NA NA NA +43 oslash ø small o, slash NA NA NA NA NA +44 Oslash Ø capital O, slash NA NA NA NA NA +45 otilde õ small o, tilde NA NA NA NA NA +46 Otilde Õ capital O, tilde NA NA NA NA NA +47 ouml ö small o, dieresis or umlautmark NA NA NA NA NA +48 Ouml Ö capital O, dieresis or umlautmark NA NA NA NA NA +49 szlig ß small sharp s, German (szligature NA NA NA NA NA +50 thorn þ small thorn, Icelandic NA NA NA NA NA +51 THORN Þ capital THORN, Icelandic NA NA NA NA NA +52 uacute ú small u, acute accent NA NA NA NA NA +53 Uacute Ú capital U, acute accent NA NA NA NA NA +54 ucirc û small u, circumflex accent NA NA NA NA NA +55 Ucirc Û capital U, circumflex accent NA NA NA NA NA +56 ugrave ù small u, grave accent NA NA NA NA NA +57 Ugrave Ù capital U, grave accent NA NA NA NA NA +58 uuml ü small u, dieresis or umlautmark NA NA NA NA NA +59 Uuml Ü capital U, dieresis or umlautmark NA NA NA NA NA +60 yacute ý small y, acute accent NA NA NA NA NA +61 Yacute Ý capital Y, acute accent NA NA NA NA NA +62 yuml ÿ small y, dieresis or umlautmark NA NA NA NA NA + X.ã. X.Ã. X.ä. X.Ä. X.æ. X.Æ. X.ç. X.Ç. X.ð. X.Ð. X.é. X.É. X.ê. X.Ê. X.è. +1 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +2 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +3 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +4 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +5 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +6 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +7 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +8 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +9 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +10 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +11 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +12 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +13 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +14 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +15 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +16 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +17 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +18 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +19 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +20 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +21 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +22 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +23 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +24 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +25 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +26 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +27 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +28 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +29 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +30 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +31 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +32 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +33 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +34 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +35 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +36 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +37 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +38 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +39 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +40 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +41 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +42 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +43 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +44 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +45 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +46 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +47 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +48 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +49 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +50 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +51 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +52 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +53 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +54 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +55 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +56 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +57 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +58 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +59 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +60 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +61 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +62 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA + X.È. X.ë. X.Ë. X.í. X.Í. X.î. X.Î. X.ì. X.Ì. X.ï. X.Ï. X.ñ. X.Ñ. X.ó. X.Ó. +1 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +2 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +3 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +4 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +5 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +6 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +7 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +8 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +9 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +10 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +11 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +12 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +13 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +14 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +15 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +16 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +17 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +18 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +19 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +20 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +21 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +22 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +23 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +24 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +25 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +26 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +27 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +28 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +29 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +30 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +31 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +32 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +33 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +34 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +35 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +36 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +37 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +38 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +39 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +40 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +41 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +42 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +43 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +44 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +45 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +46 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +47 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +48 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +49 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +50 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +51 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +52 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +53 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +54 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +55 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +56 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +57 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +58 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +59 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +60 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +61 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +62 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA + X.ô. X.Ô. X.ò. X.Ò. X.ø. X.Ø. X.õ. X.Õ. X.ö. X.Ö. X.ß. X.þ. X.Þ. X.ú. X.Ú. +1 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +2 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +3 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +4 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +5 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +6 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +7 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +8 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +9 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +10 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +11 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +12 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +13 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +14 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +15 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +16 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +17 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +18 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +19 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +20 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +21 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +22 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +23 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +24 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +25 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +26 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +27 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +28 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +29 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +30 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +31 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +32 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +33 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +34 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +35 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +36 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +37 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +38 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +39 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +40 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +41 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +42 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +43 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +44 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +45 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +46 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +47 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +48 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +49 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +50 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +51 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +52 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +53 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +54 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +55 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +56 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +57 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +58 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +59 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +60 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +61 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +62 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA + X.û. X.Û. X.ù. X.Ù. X.ü. X.Ü. X.ý. X.Ý. X.ÿ. +1 NA NA NA NA NA NA NA NA NA +2 NA NA NA NA NA NA NA NA NA +3 NA NA NA NA NA NA NA NA NA +4 NA NA NA NA NA NA NA NA NA +5 NA NA NA NA NA NA NA NA NA +6 NA NA NA NA NA NA NA NA NA +7 NA NA NA NA NA NA NA NA NA +8 NA NA NA NA NA NA NA NA NA +9 NA NA NA NA NA NA NA NA NA +10 NA NA NA NA NA NA NA NA NA +11 NA NA NA NA NA NA NA NA NA +12 NA NA NA NA NA NA NA NA NA +13 NA NA NA NA NA NA NA NA NA +14 NA NA NA NA NA NA NA NA NA +15 NA NA NA NA NA NA NA NA NA +16 NA NA NA NA NA NA NA NA NA +17 NA NA NA NA NA NA NA NA NA +18 NA NA NA NA NA NA NA NA NA +19 NA NA NA NA NA NA NA NA NA +20 NA NA NA NA NA NA NA NA NA +21 NA NA NA NA NA NA NA NA NA +22 NA NA NA NA NA NA NA NA NA +23 NA NA NA NA NA NA NA NA NA +24 NA NA NA NA NA NA NA NA NA +25 NA NA NA NA NA NA NA NA NA +26 NA NA NA NA NA NA NA NA NA +27 NA NA NA NA NA NA NA NA NA +28 NA NA NA NA NA NA NA NA NA +29 NA NA NA NA NA NA NA NA NA +30 NA NA NA NA NA NA NA NA NA +31 NA NA NA NA NA NA NA NA NA +32 NA NA NA NA NA NA NA NA NA +33 NA NA NA NA NA NA NA NA NA +34 NA NA NA NA NA NA NA NA NA +35 NA NA NA NA NA NA NA NA NA +36 NA NA NA NA NA NA NA NA NA +37 NA NA NA NA NA NA NA NA NA +38 NA NA NA NA NA NA NA NA NA +39 NA NA NA NA NA NA NA NA NA +40 NA NA NA NA NA NA NA NA NA +41 NA NA NA NA NA NA NA NA NA +42 NA NA NA NA NA NA NA NA NA +43 NA NA NA NA NA NA NA NA NA +44 NA NA NA NA NA NA NA NA NA +45 NA NA NA NA NA NA NA NA NA +46 NA NA NA NA NA NA NA NA NA +47 NA NA NA NA NA NA NA NA NA +48 NA NA NA NA NA NA NA NA NA +49 NA NA NA NA NA NA NA NA NA +50 NA NA NA NA NA NA NA NA NA +51 NA NA NA NA NA NA NA NA NA +52 NA NA NA NA NA NA NA NA NA +53 NA NA NA NA NA NA NA NA NA +54 NA NA NA NA NA NA NA NA NA +55 NA NA NA NA NA NA NA NA NA +56 NA NA NA NA NA NA NA NA NA +57 NA NA NA NA NA NA NA NA NA +58 NA NA NA NA NA NA NA NA NA +59 NA NA NA NA NA NA NA NA NA +60 NA NA NA NA NA NA NA NA NA +61 NA NA NA NA NA NA NA NA NA +62 NA NA NA NA NA NA NA NA NA > > if( 'XLSX' %in% xlsFormats() ) + { -+ example.latin1.x <- read.xls(latin1FileX, fileEncoding='latin1') ++ example.latin1.x <- read.xls(latin1FileX, fileEncoding='latin1') ++ example.latin1.x ++ } else { ++ cat("** DIFF IN THIS SECTION IS EXPECTED BECAUSE PERL PACKAGES **\n") ++ cat("** FOR SUPPORTING XLSX ARE NOT INSTALLED **\n") + } + X.á. X.Á. X.â. X.Â. X.à. X.À. X.å. X.Å. +1 aacute á small a, acute accent NA NA NA NA NA +2 Aacute Á capital A, acute accent NA NA NA NA NA +3 acirc â small a, circumflex accent NA NA NA NA NA +4 Acirc  capital A, circumflex accent NA NA NA NA NA +5 agrave à small a, grave accent NA NA NA NA NA +6 Agrave À capital A, grave accent NA NA NA NA NA +7 aring å small a, ring NA NA NA NA NA +8 Aring Å capital A, ring NA NA NA NA NA +9 atilde ã small a, tilde NA NA NA NA NA +10 Atilde à capital A, tilde NA NA NA NA NA +11 auml ä small a, dieresis or umlautmark NA NA NA NA NA +12 Auml Ä capital A, dieresis or umlautmark NA NA NA NA NA +13 aelig æ small ae diphthong (ligature) NA NA NA NA NA +14 AElig Æ capital AE diphthong(ligature) NA NA NA NA NA +15 ccedil ç small c, cedilla NA NA NA NA NA +16 Ccedil Ç capital C, cedilla NA NA NA NA NA +17 eth ð small eth, Icelandic NA NA NA NA NA +18 ETH Ð capital Eth, Icelandic NA NA NA NA NA +19 eacute é small e, acute accent NA NA NA NA NA +20 Eacute É capital E, acute accent NA NA NA NA NA +21 ecirc ê small e, circumflex accent NA NA NA NA NA +22 Ecirc Ê capital E, circumflex accent NA NA NA NA NA +23 egrave è small e, grave accent NA NA NA NA NA +24 Egrave È capital E, grave accent NA NA NA NA NA +25 euml ë small e, dieresis or umlautmark NA NA NA NA NA +26 Euml Ë capital E, dieresis or umlautmark NA NA NA NA NA +27 iacute í small i, acute accent NA NA NA NA NA +28 Iacute Í capital I, acute accent NA NA NA NA NA +29 icirc î small i, circumflex accent NA NA NA NA NA +30 Icirc Î capital I, circumflex accent NA NA NA NA NA +31 igrave ì small i, grave accent NA NA NA NA NA +32 Igrave Ì capital I, grave accent NA NA NA NA NA +33 iuml ï small i, dieresis or umlautmark NA NA NA NA NA +34 Iuml Ï capital I, dieresis or umlautmark NA NA NA NA NA +35 ntilde ñ small n, tilde NA NA NA NA NA +36 Ntilde Ñ capital N, tilde NA NA NA NA NA +37 oacute ó small o, acute accent NA NA NA NA NA +38 Oacute Ó capital O, acute accent NA NA NA NA NA +39 ocirc ô small o, circumflex accent NA NA NA NA NA +40 Ocirc Ô capital O, circumflex accent NA NA NA NA NA +41 ograve ò small o, grave accent NA NA NA NA NA +42 Ograve Ò capital O, grave accent NA NA NA NA NA +43 oslash ø small o, slash NA NA NA NA NA +44 Oslash Ø capital O, slash NA NA NA NA NA +45 otilde õ small o, tilde NA NA NA NA NA +46 Otilde Õ capital O, tilde NA NA NA NA NA +47 ouml ö small o, dieresis or umlautmark NA NA NA NA NA +48 Ouml Ö capital O, dieresis or umlautmark NA NA NA NA NA +49 szlig ß small sharp s, German (szligature NA NA NA NA NA +50 thorn þ small thorn, Icelandic NA NA NA NA NA +51 THORN Þ capital THORN, Icelandic NA NA NA NA NA +52 uacute ú small u, acute accent NA NA NA NA NA +53 Uacute Ú capital U, acute accent NA NA NA NA NA +54 ucirc û small u, circumflex accent NA NA NA NA NA +55 Ucirc Û capital U, circumflex accent NA NA NA NA NA +56 ugrave ù small u, grave accent NA NA NA NA NA +57 Ugrave Ù capital U, grave accent NA NA NA NA NA +58 uuml ü small u, dieresis or umlautmark NA NA NA NA NA +59 Uuml Ü capital U, dieresis or umlautmark NA NA NA NA NA +60 yacute ý small y, acute accent NA NA NA NA NA +61 Yacute Ý capital Y, acute accent NA NA NA NA NA +62 yuml ÿ small y, dieresis or umlautmark NA NA NA NA NA + X.ã. X.Ã. X.ä. X.Ä. X.æ. X.Æ. X.ç. X.Ç. X.ð. X.Ð. X.é. X.É. X.ê. X.Ê. X.è. +1 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +2 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +3 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +4 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +5 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +6 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +7 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +8 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +9 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +10 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +11 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +12 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +13 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +14 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +15 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +16 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +17 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +18 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +19 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +20 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +21 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +22 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +23 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +24 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +25 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +26 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +27 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +28 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +29 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +30 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +31 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +32 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +33 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +34 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +35 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +36 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +37 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +38 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +39 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +40 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +41 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +42 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +43 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +44 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +45 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +46 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +47 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +48 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +49 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +50 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +51 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +52 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +53 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +54 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +55 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +56 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +57 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +58 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +59 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +60 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +61 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +62 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA + X.È. X.ë. X.Ë. X.í. X.Í. X.î. X.Î. X.ì. X.Ì. X.ï. X.Ï. X.ñ. X.Ñ. X.ó. X.Ó. +1 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +2 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +3 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +4 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +5 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +6 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +7 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +8 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +9 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +10 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +11 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +12 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +13 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +14 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +15 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +16 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +17 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +18 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +19 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +20 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +21 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +22 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +23 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +24 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +25 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +26 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +27 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +28 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +29 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +30 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +31 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +32 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +33 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +34 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +35 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +36 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +37 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +38 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +39 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +40 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +41 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +42 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +43 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +44 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +45 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +46 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +47 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +48 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +49 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +50 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +51 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +52 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +53 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +54 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +55 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +56 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +57 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +58 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +59 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +60 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +61 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +62 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA + X.ô. X.Ô. X.ò. X.Ò. X.ø. X.Ø. X.õ. X.Õ. X.ö. X.Ö. X.ß. X.þ. X.Þ. X.ú. X.Ú. +1 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +2 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +3 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +4 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +5 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +6 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +7 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +8 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +9 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +10 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +11 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +12 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +13 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +14 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +15 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +16 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +17 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +18 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +19 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +20 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +21 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +22 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +23 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +24 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +25 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +26 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +27 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +28 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +29 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +30 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +31 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +32 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +33 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +34 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +35 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +36 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +37 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +38 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +39 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +40 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +41 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +42 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +43 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +44 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +45 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +46 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +47 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +48 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +49 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +50 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +51 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +52 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +53 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +54 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +55 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +56 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +57 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +58 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +59 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +60 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +61 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA +62 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA + X.û. X.Û. X.ù. X.Ù. X.ü. X.Ü. X.ý. X.Ý. X.ÿ. +1 NA NA NA NA NA NA NA NA NA +2 NA NA NA NA NA NA NA NA NA +3 NA NA NA NA NA NA NA NA NA +4 NA NA NA NA NA NA NA NA NA +5 NA NA NA NA NA NA NA NA NA +6 NA NA NA NA NA NA NA NA NA +7 NA NA NA NA NA NA NA NA NA +8 NA NA NA NA NA NA NA NA NA +9 NA NA NA NA NA NA NA NA NA +10 NA NA NA NA NA NA NA NA NA +11 NA NA NA NA NA NA NA NA NA +12 NA NA NA NA NA NA NA NA NA +13 NA NA NA NA NA NA NA NA NA +14 NA NA NA NA NA NA NA NA NA +15 NA NA NA NA NA NA NA NA NA +16 NA NA NA NA NA NA NA NA NA +17 NA NA NA NA NA NA NA NA NA +18 NA NA NA NA NA NA NA NA NA +19 NA NA NA NA NA NA NA NA NA +20 NA NA NA NA NA NA NA NA NA +21 NA NA NA NA NA NA NA NA NA +22 NA NA NA NA NA NA NA NA NA +23 NA NA NA NA NA NA NA NA NA +24 NA NA NA NA NA NA NA NA NA +25 NA NA NA NA NA NA NA NA NA +26 NA NA NA NA NA NA NA NA NA +27 NA NA NA NA NA NA NA NA NA +28 NA NA NA NA NA NA NA NA NA +29 NA NA NA NA NA NA NA NA NA +30 NA NA NA NA NA NA NA NA NA +31 NA NA NA NA NA NA NA NA NA +32 NA NA NA NA NA NA NA NA NA +33 NA NA NA NA NA NA NA NA NA +34 NA NA NA NA NA NA NA NA NA +35 NA NA NA NA NA NA NA NA NA +36 NA NA NA NA NA NA NA NA NA +37 NA NA NA NA NA NA NA NA NA +38 NA NA NA NA NA NA NA NA NA +39 NA NA NA NA NA NA NA NA NA +40 NA NA NA NA NA NA NA NA NA +41 NA NA NA NA NA NA NA NA NA +42 NA NA NA NA NA NA NA NA NA +43 NA NA NA NA NA NA NA NA NA +44 NA NA NA NA NA NA NA NA NA +45 NA NA NA NA NA NA NA NA NA +46 NA NA NA NA NA NA NA NA NA +47 NA NA NA NA NA NA NA NA NA +48 NA NA NA NA NA NA NA NA NA +49 NA NA NA NA NA NA NA NA NA +50 NA NA NA NA NA NA NA NA NA +51 NA NA NA NA NA NA NA NA NA +52 NA NA NA NA NA NA NA NA NA +53 NA NA NA NA NA NA NA NA NA +54 NA NA NA NA NA NA NA NA NA +55 NA NA NA NA NA NA NA NA NA +56 NA NA NA NA NA NA NA NA NA +57 NA NA NA NA NA NA NA NA NA +58 NA NA NA NA NA NA NA NA NA +59 NA NA NA NA NA NA NA NA NA +60 NA NA NA NA NA NA NA NA NA +61 NA NA NA NA NA NA NA NA NA +62 NA NA NA NA NA NA NA NA NA > > > ## Check handling of very wide file @@ -723,6 +1363,9 @@ + { + example.wide.x <- read.xls(wideFileX) + stopifnot(dim(example.wide.x)==c(0,16384)) ++ } else { ++ cat("** DIFF IN THIS SECTION IS EXPECTED BECAUSE PERL PACKAGES **\n") ++ cat("** FOR SUPPORTING XLSX ARE NOT INSTALLED **\n") + } > > ## Check handling of files with dates calulcated relative to @@ -846,4 +1489,4 @@ > > proc.time() user system elapsed - 14.104 0.888 15.221 + 13.148 0.835 14.190 Modified: trunk/gdata/tests/test.reorder.factor.Rout.save =================================================================== --- trunk/gdata/tests/test.reorder.factor.Rout.save 2015-04-28 21:12:20 UTC (rev 1988) +++ trunk/gdata/tests/test.reorder.factor.Rout.save 2015-04-29 01:29:30 UTC (rev 1989) @@ -53,4 +53,4 @@ > > proc.time() user system elapsed - 0.339 0.046 0.379 + 0.327 0.045 0.363 Modified: trunk/gdata/tests/tests.write.fwf.Rout.save =================================================================== --- trunk/gdata/tests/tests.write.fwf.Rout.save 2015-04-28 21:12:20 UTC (rev 1988) +++ trunk/gdata/tests/tests.write.fwf.Rout.save 2015-04-29 01:29:30 UTC (rev 1989) @@ -231,4 +231,4 @@ > > proc.time() user system elapsed - 0.434 0.049 0.475 + 0.421 0.045 0.459 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |