Codebase list gtools / 0eb818e
Import Debian changes 3.2.0-1 gtools (3.2.0-1) unstable; urgency=low * New upstream release * debian/control: Add new (Build-)Depends: on gdata Dirk Eddelbuettel 5 years ago
18 changed file(s) with 289 addition(s) and 146 deletion(s). Raw diff Collapse all Expand all
0 2014-01-11 warnes
1
2 * [r1762] DESCRIPTION, NAMESPACE, R/capture.R, R/defunct.R,
3 R/keywords.R, man/capture.Rd, man/gtools-defunct.Rd,
4 man/stars.pval.Rd: Fixes for gtools release 3.2.0
5
6 2013-12-23 warnes
7
8 * [r1761] R/keywords.R, man/keywords.Rd: Extend the keywords()
9 function to return keywords associated with a specified topic via
10 'keywords(topic)'.
11 * [r1760] man/stars.pval.Rd: Add keyword.
12 * [r1759] NAMESPACE, R/stars.pval.R, man/stars.pval.Rd: Add
13 stars.pval() function to convert p-values into significance
14 symbols.
15
16 2013-11-26 warnes
17
18 * [r1748] R/mixedsort.R: mixedorder() was failing to correctly
19 handle numbers including
20 decimals due to a faulty regular expression. Prior to the fix:
21
22 > drr
23 [1] "Dose 0.3 mg" "Dose 0.04 mg" "Dose 0.5 mg"
24 > gtools::mixedsort(drr)
25 [1] "Dose 0.3 mg" "Dose 0.04 mg" "Dose 0.5 mg"
26
27 After the fix:
28
29 > drr
30 [1] "Dose 0.3 mg" "Dose 0.04 mg" "Dose 0.5 mg"
31 > mixedsort(drr)
32 [1] "Dose 0.04 mg" "Dose 0.3 mg" "Dose 0.5 mg"
33
34 In addition, an optimization was added that checked if the input
35 vector
36 was numeric. If so, simply use the existing base::order function.
37
38 2013-11-18 warnes
39
40 * [r1747] R/capture.R: Use ".Deprecated" instead of warning.
41
042 2013-11-06 warnes
143
44 * [r1746] DESCRIPTION, inst/NEWS: Update files for gtools 3.1.1
245 * [r1745] R/mixedsort.R: Fix problem with mixedorder/mixedsort when
346 there is only zero or one elements in the vector.
447
00 Package: gtools
11 Title: Various R programming tools
22 Description: Various R programming tools
3 Version: 3.1.1
4 Date: 2013-11-06
3 Version: 3.2.0
4 Date: 2014-01-11
55 Author: Gregory R. Warnes, Ben Bolker, and Thomas Lumley
66 Maintainer: Gregory R. Warnes <greg@warnes.net>
7 Imports: gdata
78 License: LGPL-2.1
8 Packaged: 2013-11-06 14:55:43 UTC; warnes
9 Packaged: 2014-01-11 23:40:09 UTC; warnes
910 NeedsCompilation: yes
1011 Repository: CRAN
11 Date/Publication: 2013-11-06 18:12:14
12 Date/Publication: 2014-01-12 09:54:15
+13
-12
MD5 less more
0 2fde3dd1792883afe6d7cebcfcf6f2b8 *ChangeLog
1 1ea84db21153b206a346cc190ef59fa5 *DESCRIPTION
2 6b878bdfaa0ca7b966646ed6a11710d1 *NAMESPACE
3 e4d0cc8abc172e456ec8f1b079a28494 *NEWS
0 16db02154eca1ae541425bd399892fc2 *ChangeLog
1 2fc6e60632ff2e71f26c29613433377c *DESCRIPTION
2 6e384f31ff7ed1bb05c7ca706be9d618 *NAMESPACE
3 aa2e103a8b06d2fbf51715951914dd8b *NEWS
44 9eb418fd95aa09ba85aed159545dea61 *R/RSCompat.S
55 a86a74ba04089ad58ea22e3a994a9b14 *R/addLast.R
66 c4ae0d6b5867f6751981e9f93cd2f619 *R/ask.R
77 d2308a673e3f0e0ee3aac816fed729a9 *R/binsearch.R
8 1d260953ae104917c7016b590dd253cb *R/capture.R
98 c70220a92fd3c5781638e3779cbd55ff *R/checkRVersion.R
109 529f69b81b6b734a4f637d250b5b71f9 *R/combinations.R
1110 1c333b16a59dcaf7ccf20151962b6375 *R/defmacro.R
11 28d70252e7e25f8e3743fc07434acba9 *R/defunct.R
1212 344b58e1976792a3295238c17df7e917 *R/deprecated.R
1313 c089bb5f542501dc1e3ba07f032c84ed *R/dirichlet.R
1414 1da2198e1d194c705ca89381159b7b63 *R/foldchange.R
1515 71212f4c14003458fc3e30638f339629 *R/invalid.R
16 7865a5e9151b4e0dfe5336ab150afd45 *R/keywords.R
16 11fc8cb8e4bd7c93cd8edefe54b9c64c *R/keywords.R
1717 f00dfc3263a5854151f244493b3f04d0 *R/lastAdd.R
1818 2bb525e1930ec3ba2afefa2ff43d74e0 *R/logit.R
19 5fbeac9e36b2ac3a8bd52a61f0beac62 *R/mixedsort.R
19 a1335136622137e3a287f2fd7b39b4f9 *R/mixedsort.R
2020 93a46a6ef5937bdd112468daceac00a6 *R/newVersionAvailable.R
2121 07cd779ab7e64f697604b8b4fa4c9d70 *R/oddeven.R
2222 1d016a924dd59daa78ea62d986da2929 *R/permute.R
2525 a5ea32bab219fd7c634f034dddada96b *R/scat.R
2626 e5ddc84d8a502feed32f7f6b1b5e25ab *R/setTCPNoDelay.R
2727 3d0ac64f38d5b91d4ef8adc2344d5875 *R/smartbind.R
28 ef22fb4007dec9fb62eb5ed947292fa3 *R/stars.pval.R
2829 e8f510e73bd2cd820c384c00d75b0080 *R/strmacro.R
2930 d2d2d0444a049d74694203974624835c *data/ELISA.rda
30 2fde3dd1792883afe6d7cebcfcf6f2b8 *inst/ChangeLog
31 e4d0cc8abc172e456ec8f1b079a28494 *inst/NEWS
31 16db02154eca1ae541425bd399892fc2 *inst/ChangeLog
32 aa2e103a8b06d2fbf51715951914dd8b *inst/NEWS
3233 904304f52b08ec847904ac2aa5be9aef *man/ELISA.Rd
3334 c5b7124f5fdbcc83f2e283314df95858 *man/ask.Rd
3435 ecbe8481bdcff0d8abd1a47cc64ca7b2 *man/binsearch.Rd
35 f175511921137c0b1fe252640aa8b30f *man/capture.Rd
3636 e1a3f01f01db3e883397eaa49037af6f *man/checkRVersion.Rd
3737 0b2fba4b1456254689640add6afec843 *man/combinations.Rd
3838 1c240ef01582dd99e3a2e432e7dfb2ba *man/defmacro.Rd
3939 22b71a514ea7acc360552527394ce9c1 *man/dirichlet.Rd
4040 74868a3948263db0fbc2519b792acba2 *man/foldchange.Rd
41 c40ffc36f16b63f90be9d90666bce478 *man/gtools-defunct.Rd
41 aa98190531ff93721b715e61000f76a4 *man/gtools-defunct.Rd
4242 72d1da64e38796cc37347aa1be02bdd2 *man/gtools-deprecated.Rd
4343 01c743eee2dbb9dc14d02035fa05063c *man/invalid.Rd
44 9710a997ca66869732cbb4a245485723 *man/keywords.Rd
44 8d8b5429047edd4ed52f8f8f6b11f807 *man/keywords.Rd
4545 67b9c146bd8470b1dd5ddcac782c2071 *man/lastAdd.Rd
4646 3c207d731ad8ead62af138afe2e20c5f *man/logit.Rd
4747 422c16f570c15590fa83e1a71506757f *man/mixedsort.Rd
5252 f781e22f646cf803a7f24129525521fc *man/scat.Rd
5353 5dae46a9758c2a81d25d87881f7b42ee *man/setTCPNoDelay.Rd
5454 6661dfc3dcf520520106b3d74a893259 *man/smartbind.Rd
55 7ba286fa2b1bc994de1c6ec78883cdc8 *man/stars.pval.Rd
5556 8d4158b8eb92153e2d3f581682b2a3c1 *src/Makevars.win
5657 bb28a3858ac5a6152565d3b8cef8c70c *src/setTCPNoDelay.c
3030 setTCPNoDelay,
3131 smartbind,
3232 sprint,
33 stars.pval,
3334 strmacro
3435 )
35
0 gtools 3.2.0 - 2014-01-11
1 -------------------------
2
3 New features:
4
5 - The keywords() function now accepts a function or function name as
6 an argument and will return the list of keywords associated with the
7 named function.
8
9 - New function stars.pval() which will generate p-value significance
10 symbols ('***', '**', etc.)
11
12 Bug fixes:
13
14 - R/mixedsort.R: mixedorder() was failing to correctly handle numbers
15 including decimals due to a faulty regular expression.
16
17 Other changes:
18
19 - capture() and sprint() are now defunct.
20
21
022 gtools 3.1.1 - 2013-11-06
123 -------------------------
224
2951
3052 - The function 'addLast()' has been deprecated because it directly
3153 manipulates the global environment, which is expressly prohibited by
32 the CRAN policies.
54 the CRAN policies.
3355
3456 - A new function, 'lastAdd()' has been created to replace 'addLast()'.
3557 The name has been changed because the two functions require
+0
-44
R/capture.R less more
0 # $Id: capture.R 277 2004-01-21 04:31:25Z warnes $
1 #
2 # $Log$
3 # Revision 1.4 2004/01/21 04:31:25 warnes
4 # - Mark sprint() as depreciated.
5 # - Replace references to sprint with capture.output()
6 # - Use match.arg for halign and valign arguments to textplot.default.
7 # - Fix textplot.character so that a vector of characters is properly
8 # displayed. Previouslt, character vectors were plotted on top of each
9 # other.
10 #
11 # Revision 1.3 2003/11/10 22:11:13 warnes
12 #
13 # - Add files contributed by Arni Magnusson
14 # <arnima@u.washington.edu>. As well as some of my own.
15 #
16 # Revision 1.2 2003/04/04 13:45:21 warnes
17 #
18 # - Allow optional arguments to sprint to be passed to print
19 #
20 # Revision 1.1 2003/04/02 22:28:32 warnes
21 #
22 # - Added file 'capture.R' containing capture() and sprint().
23 #
24 #
25
26 capture <- function( expression, collapse="\n")
27 {
28 warning("Depreciated. Use capture.output(...) from base instead.")
29
30 resultText <- capture.output( expression )
31
32 return( paste( c(resultText, ""), collapse=collapse, sep="" ) )
33 # the reason for c(result, "") is so that we get the line
34 # terminator on the last line of output. Otherwise, it just shows
35 # up between the lines.
36 }
37
38
39 sprint <- function(x,...)
40 {
41 warning("Depreciated. Use capture.output(print(...)) from base instead.")
42 capture(print(x,...))
43 }
0 capture <- function( expression, collapse="\n")
1 .Defunct("capture.output", "base")
2
3 sprint <- function(x,...)
4 .Defunct("capture.output", "base")
5
0 keywords <- function( ... )
0 keywords <- function( topic )
11 {
2
23 file <- file.path(R.home("doc"),"KEYWORDS")
3 file.show(file, ...)
4 if(missing(topic))
5 {
6 file.show(file)
7 }
8 else
9 {
10
11 ## Local copy of trim.character to avoid cyclic dependency with gdata ##
12 trim <- function(s)
13 {
14 s <- sub(pattern="^[[:blank:]]+", replacement="", x=s)
15 s <- sub(pattern="[[:blank:]]+$", replacement="", x=s)
16 s
17 }
18
19 kw <- scan(file=file, what=character(), sep="\n", quiet=TRUE)
20 kw <- grep("&", kw, value=TRUE)
21 kw <- gsub("&[^&]*$","", kw)
22 kw <- gsub("&+"," ", kw)
23 kw <- na.omit(trim(kw))
24
25 ischar <- tryCatch(is.character(topic) && length(topic) ==
26 1L, error = identity)
27 if (inherits(ischar, "error"))
28 ischar <- FALSE
29 if (!ischar)
30 topic <- deparse(substitute(topic))
31
32 item <- paste("^",topic,"$", sep="")
33
34 topics <- function(k) help.search(keyword=k)$matches[,"topic"]
35 matches <- lapply(kw, topics)
36 names(matches) <- kw
37
38 tmp <- unlist(lapply( matches, function(m) grep(item, m, value=TRUE) ))
39 names(tmp)
40 }
441 }
0 # $Id: mixedsort.R 1745 2013-11-06 14:51:16Z warnes $
0 # $Id: mixedsort.R 1748 2013-11-26 14:38:58Z warnes $
11
22 mixedsort <- function(x) x[mixedorder(x)]
33
1212 return(NULL)
1313 else if(length(x)==1)
1414 return(1)
15
15
16 if( is.numeric(x) )
17 return( order(x) )
18
19
1620 delim="\\$\\@\\$"
1721
1822 numeric <- function(x)
2529 suppressWarnings( ifelse(is.na(as.numeric(x)), toupper(x), NA) )
2630 }
2731
28
2932 x <- as.character(x)
3033
3134 which.nas <- which(is.na(x))
3235 which.blanks <- which(x=="")
3336
3437 if(length(which.blanks) >0)
35 x[ which.blanks ] <- -Inf
38 x[ which.blanks ] <- -Inf
39
3640 if(length(which.nas) >0)
37 x[ which.nas ] <- Inf
41 x[ which.nas ] <- Inf
3842
3943 ####
4044 # - Convert each character string into an vector containing single
4246 ####
4347
4448 # find and mark numbers in the form of +1.23e+45.67
45 delimited <- gsub("([+-]{0,1}[0-9]+([eE][\\+\\-]{0,1}[0-9]+){0,1})",
49 delimited <- gsub("([+-]{0,1}[0-9]+.{0,1}[0-9]*([eE][\\+\\-]{0,1}[0-9]+.{0,1}[0-9]*){0,1})",
4650 paste(delim,"\\1",delim,sep=""), x)
4751
4852 # separate out numbers
0 stars.pval <- function(p.value)
1 {
2 unclass(
3 symnum(p.value, corr = FALSE, na = FALSE,
4 cutpoints = c(0, 0.001, 0.01, 0.05, 0.1, 1),
5 symbols = c("***", "**", "*", ".", " "))
6 )
7 }
0 gtools (3.2.0-1) unstable; urgency=low
1
2 * New upstream release
3
4 * debian/control: Add new (Build-)Depends: on gdata
5
6 -- Dirk Eddelbuettel <edd@debian.org> Sun, 12 Jan 2014 10:14:05 -0600
7
08 gtools (3.1.1-1) unstable; urgency=low
19
210 * New upstream release
11 Section: gnu-r
22 Priority: optional
33 Maintainer: Dirk Eddelbuettel <edd@debian.org>
4 Build-Depends: debhelper (>= 7), r-base-dev (>= 3.0.2), cdbs
4 Build-Depends: debhelper (>= 7), r-base-dev (>= 3.0.2), cdbs, r-cran-gdata
55 Standards-Version: 3.9.5
66
77 Package: r-cran-gtools
88 Architecture: any
9 Depends: ${shlibs:Depends}, ${R:Depends}
9 Depends: ${shlibs:Depends}, ${R:Depends}, r-cran-gdata
1010 Description: GNU R package with R programming tools by Greg Warnes et al
1111 This package of R programming tools was written by Gregory Warnes
1212 with code contributions by Ben Bolker and Thomas Lumley.
0 2014-01-11 warnes
1
2 * [r1762] DESCRIPTION, NAMESPACE, R/capture.R, R/defunct.R,
3 R/keywords.R, man/capture.Rd, man/gtools-defunct.Rd,
4 man/stars.pval.Rd: Fixes for gtools release 3.2.0
5
6 2013-12-23 warnes
7
8 * [r1761] R/keywords.R, man/keywords.Rd: Extend the keywords()
9 function to return keywords associated with a specified topic via
10 'keywords(topic)'.
11 * [r1760] man/stars.pval.Rd: Add keyword.
12 * [r1759] NAMESPACE, R/stars.pval.R, man/stars.pval.Rd: Add
13 stars.pval() function to convert p-values into significance
14 symbols.
15
16 2013-11-26 warnes
17
18 * [r1748] R/mixedsort.R: mixedorder() was failing to correctly
19 handle numbers including
20 decimals due to a faulty regular expression. Prior to the fix:
21
22 > drr
23 [1] "Dose 0.3 mg" "Dose 0.04 mg" "Dose 0.5 mg"
24 > gtools::mixedsort(drr)
25 [1] "Dose 0.3 mg" "Dose 0.04 mg" "Dose 0.5 mg"
26
27 After the fix:
28
29 > drr
30 [1] "Dose 0.3 mg" "Dose 0.04 mg" "Dose 0.5 mg"
31 > mixedsort(drr)
32 [1] "Dose 0.04 mg" "Dose 0.3 mg" "Dose 0.5 mg"
33
34 In addition, an optimization was added that checked if the input
35 vector
36 was numeric. If so, simply use the existing base::order function.
37
38 2013-11-18 warnes
39
40 * [r1747] R/capture.R: Use ".Deprecated" instead of warning.
41
042 2013-11-06 warnes
143
44 * [r1746] DESCRIPTION, inst/NEWS: Update files for gtools 3.1.1
245 * [r1745] R/mixedsort.R: Fix problem with mixedorder/mixedsort when
346 there is only zero or one elements in the vector.
447
0 gtools 3.2.0 - 2014-01-11
1 -------------------------
2
3 New features:
4
5 - The keywords() function now accepts a function or function name as
6 an argument and will return the list of keywords associated with the
7 named function.
8
9 - New function stars.pval() which will generate p-value significance
10 symbols ('***', '**', etc.)
11
12 Bug fixes:
13
14 - R/mixedsort.R: mixedorder() was failing to correctly handle numbers
15 including decimals due to a faulty regular expression.
16
17 Other changes:
18
19 - capture() and sprint() are now defunct.
20
21
022 gtools 3.1.1 - 2013-11-06
123 -------------------------
224
2951
3052 - The function 'addLast()' has been deprecated because it directly
3153 manipulates the global environment, which is expressly prohibited by
32 the CRAN policies.
54 the CRAN policies.
3355
3456 - A new function, 'lastAdd()' has been created to replace 'addLast()'.
3557 The name has been changed because the two functions require
+0
-51
man/capture.Rd less more
0 \name{capture}
1 \alias{capture}
2 \alias{sprint}
3 \title{Capture printed output of an R expression in a string}
4 \description{
5 Capture printed output of an R expression in a string
6 }
7 \usage{
8 capture(expression, collapse = "\n")
9 sprint(x,...)
10 }
11 \arguments{
12 \item{expression}{R expression whose output will be captured.}
13 \item{collapse}{Character used to join output lines. Defaults to
14 "\\n". Use \code{NULL} to return a vector of individual output lines.}
15 \item{x}{Object to be printed}
16 \item{...}{Optional parameters to be passed to \code{\link{print}} }
17 }
18 \details{
19 The \code{capture} function uses \code{\link{sink}} to capture the
20 printed results generated by \code{expression}.
21
22 The function \code{sprint} uses \code{capture} to redirect the
23 results of calling \code{\link{print}} on an object to a string.
24 }
25 \value{
26 A character string, or if \code{collapse==NULL} a vector of character
27 strings containing the printed output from the R expression.
28 }
29 \section{WARNING}{R 1.7.0+ includes \code{capture.output}, which
30 duplicates the functionality of \code{capture}. Thus, \code{capture}
31 is depreciated.}
32 \author{Gregory R. Warnes \email{greg@warnes.net} }
33 \seealso{
34 \code{\link[session]{texteval}},
35 \code{\link{capture.output}}
36 }
37 \examples{
38
39 # capture the results of a loop
40 loop.text <- capture( for(i in 1:10) cat("i=",i,"\n") )
41 loop.text
42
43 # put regression summary results into a string
44 data(iris)
45 reg <- lm( Sepal.Length ~ Species, data=iris )
46 summary.text <- sprint( summary(reg) )
47 cat(summary.text)
48 }
49 \keyword{print}
50 \keyword{IO}
11 \alias{gtools-defunct}
22 \alias{assert}
33 \alias{addLast}
4 \title{Deprecated Functions in the gtools package}
4 \alias{capture}
5 \alias{sprint}
6 \title{Defunct Functions in package \code{gtools}}
57 \description{
6 These functions are no longer available in gtools.
7 }
8 \usage{
9 assert(FLAG)
10 addLast(fun)
11 }
12 \arguments{
13 \item{FLAG}{ Expression that should evaluate to a boolean vector}
14 \item{fun}{Function to be called.}
8 The functions or variables listed here are no longer part of
9 package \code{gtools}.
1510 }
1611 \details{
1712 \itemize{
1813 \item{ \code{assert} is a defunct synonym for
19 \code{\link[base]{stopifnot}}. }
14 \code{\link[base]{stopifnot}}. }
2015 \item{ \code{addLast} has been replaced by \code{lastAdd}, which has
21 the same purpose but appled using different syntax. }
16 the same purpose but appled using different syntax. }
17 \item{ \code{capture} and \code{capture.output} have been removed in
18 favor of \code{capture.output} from the \code{utils} package.}
2219 }
2320 }
2421 \seealso{
25 \code{\link[base]{Defunct}}
26 \code{\link[base]{stopifnot}}
27 \code{\link[gtools]{lastAdd}}
22 \code{\link[base]{Defunct}},
23 \code{\link[base]{stopifnot}},
24 \code{\link[gtools]{lastAdd}},
25 \code{\link[utils]{capture.output}}
2826 }
2927 \keyword{misc}
44 List valid keywords for R man pages
55 }
66 \usage{
7 keywords(...)
7 keywords(topic)
88 }
99 \arguments{
10 \item{\dots}{Optional argumenst to pass to show.file()}
10 \item{topic}{object or man page topic}
1111 }
1212 \details{
13 This function simply determines the path \$RHOME/doc/KEYWORDS and calls
14 show.file() to display it.
15 }
16 \value{
17 Nothing of interest.
13 If \code{topic} is provided, return a list of the keywords associated
14 with \code{topic}. Otherwise, display the list of valid R keywords
15 from the R doc/KEYWORDS file.
1816 }
1917 \author{Gregory R. Warnes \email{greg@warnes.net}}
2018 \seealso{ \code{\link[utils]{help}} }
2119 \examples{
20 ## Show all valid R keywords
2221 keywords()
22
23 ## Show keywords associated with the 'merge' function
24 keywords(merge)
25 keywords("merge")
2326 }
2427 \keyword{documentation}
0 \name{stars.pval}
1 \alias{stars.pval}
2 \title{
3 Generate significance stars from p-values
4 }
5 \description{
6 Generate significance stars (e.g. '***', '**', '*', '+') from
7 p-values using R's standard definitions.
8 }
9 \usage{
10 stars.pval(p.value)
11 }
12 \arguments{
13 \item{p.value}{numeric vector of p-values}
14 }
15 \details{
16 Mapping from p-value ranges to symbols:
17 \describe{
18 \item{0 - 0.001}{'***'}
19 \item{0.001 - 0.01}{'**'}
20 \item{0.01 - 0.05}{'*'}
21 \item{0.05 - 0.1}{'+'}
22 \item{0.1 - 1.0}{'' (No symbol)}
23 }
24 }
25 \value{
26 A character vector containing the same number of elements as
27 \code{p-value}, with an attribute "legend" providing the conversion
28 pattern.
29 }
30 \author{
31 Gregory R. Warnes \email{greg@warnes.net}
32 }
33 \seealso{
34 \code{\link[stats]{symnum}}
35 }
36 \examples{
37 p.val <- c(0.0004, 0.0015, 0.013, 0.044, 0.067, 0.24)
38 stars.pval(p.val)
39 }
40 \keyword{misc}
41