Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge branch 'master' of github.com:halpo/dostats

Conflicts:
	DESCRIPTION
	R/wargs.R
  • Loading branch information...
commit 9bbe7730e4b726c3e5da52c413d6af71287d8ff9 2 parents 5690605 + 8227a57
Andrew Redd authored
2  DESCRIPTION
@@ -26,4 +26,4 @@ Collate:
26 26 'formula.R'
27 27 'hdf.R'
28 28 'pval.R'
29   - 'utils.R'
  29 + 'utils.R'
14 R/capply.R
... ... @@ -0,0 +1,14 @@
  1 +
  2 +
  3 +#' Conditional Apply
  4 +#'
  5 +#' A wrapper for \code{ifelse(test(x), fun(x, ...), x)}
  6 +#'
  7 +#' @param test a test that returns a logical
  8 +#' @param fun to apply
  9 +#' @param x data to apply fun to.
  10 +#'
  11 +#'
  12 +capply <- function(test, x, fun, ...){
  13 + ifelse(Map(test, x), fun(x, ...), x)
  14 +}
2  R/hdf.R
@@ -170,7 +170,7 @@ recombine.hdf <- function(x, ri){
170 170 make_ppath <- function(id, header) {
171 171 if(length(id) > 1) return(llply(id, make_ppath, header))
172 172 par <- trace_parents(header, id)
173   - reverse(header[c(id, par), 'position'])
  173 + rev(header[c(id, par), 'position'])
174 174 }
175 175 copy_names <- function(x, header) {
176 176 by.parent <- dlply(header, 'parent', I)
11 R/utils.R
@@ -22,7 +22,7 @@
22 22 # dostats. If not, see http://www.gnu.org/licenses/.
23 23 #
24 24 }###############################################################################
25   -{## Utilities
  25 +
26 26 first <- wargs(head, n=1)
27 27 last <- wargs(tail, n=1)
28 28
@@ -84,13 +84,6 @@ me<- function(){
84 84 }
85 85
86 86
87   -#' reverse the order of a vector
88   -#' @param x any vector
89   -#' @export
90   -reverse <- function(x){
91   - x[seq(from=length(x), to=1)]
92   -}
93   -
94 87 #' Fill vector to length with a specified value
95 88 #'
96 89 #' @export
@@ -98,5 +91,3 @@ fill_v <- function(x, l=length(x), with=last(x), after=length(x)){
98 91 stopifnot(length(x) <= l)
99 92 append(x, rep(with, l-length(x)), after=after)
100 93 }
101   -
102   -}
1  R/wargs.R
@@ -76,4 +76,3 @@ redirf <- function(f, envir=parent.frame()){
76 76 args <- formals(f)
77 77 wrap_function(symb, args, envir)
78 78 }
79   -

0 comments on commit 9bbe773

Please sign in to comment.
Something went wrong with that request. Please try again.