Skip to content

Commit

Permalink
bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
brendano committed Oct 3, 2009
1 parent 4a6ecb4 commit 2355b0c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions util.R
Expand Up @@ -22,8 +22,6 @@ util = new.env()
# so these support for a dataframe-centric lifestyle.

reframe <- function(.data, ...) {
print(.data)
print(list(...))
eval(substitute(data.frame(...)), .data, parent.frame())
}

Expand Down Expand Up @@ -423,10 +421,13 @@ util$lax_rbind <- function(...) {
inputs = list(...)
each_names = sapply(inputs, names)
all_names = unique(c(each_names, recursive=TRUE))
if (is.data.frame(inputs[[1]]) && all(dim(inputs[[1]])==c(0,0)))
inputs[[1]] = NULL
for (k in 1:length(inputs)) {
if (is.null(inputs[[k]])) next
more = setdiff(all_names, names(inputs[[k]]))
inputs[[k]][,more] = NA
names(inputs[[k]]) = c(names(inputs[[k]]), more)
# inputs[[k]][,more] = NA
}
do.call(rbind, inputs)
}
Expand Down Expand Up @@ -531,7 +532,7 @@ util$timeit <- function(expr, name=NULL) {
ret = eval(expr)
finish = Sys.time()
if (!is.null(name)) cat(name,": ")
cat(sprintf("%.3f seconds\n", finish-start))
print(finish-start)
invisible(ret)
}

Expand Down

0 comments on commit 2355b0c

Please sign in to comment.