Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
crowding committed Oct 7, 2012
1 parent 5d7cfa7 commit fc4cebc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions R/rbind-matrix.r
Expand Up @@ -60,12 +60,12 @@ rbind.fill.matrix <- function(...) {
output <- matrix(NA, nrow = nrows, ncol = length(cols))
colnames(output) <- cols

# Compute start and length for each data frame
pos <- matrix(c(cumsum(rows)-rows+1, rows), ncol=2)
# Compute start and length for each matrix
pos <- matrix(c(cumsum(rows) - rows + 1, rows), ncol = 2)

## fill in the new matrix
## fill in the new matrix
for(i in seq_along(rows)) {
rng <- seq(pos[i,1], length=pos[i,2])
rng <- seq(pos[i, 1], length = pos[i, 2])
output[rng, lcols[[i]]] <- matrices[[i]]
}

Expand Down
10 changes: 5 additions & 5 deletions R/rbind.r
Expand Up @@ -23,7 +23,7 @@ rbind.fill <- function(...) {
if (is.list(dfs[[1]]) && !is.data.frame(dfs[[1]])) {
dfs <- dfs[[1]]
}

if (length(dfs) == 0) return()
if (length(dfs) == 1) return(dfs[[1]])

Expand All @@ -34,13 +34,13 @@ rbind.fill <- function(...) {

# Generate output template
output <- output_template(dfs, nrows)

# Compute start and length for each data frame
pos <- matrix(c(cumsum(rows)-rows+1, rows), ncol=2)
pos <- matrix(c(cumsum(rows) - rows + 1, rows), ncol = 2)

# Copy inputs into output
for(i in seq_along(rows)) {
rng <- seq(pos[i,1], length=pos[i,2])
rng <- seq(pos[i, 1], length = pos[i, 2])
df <- dfs[[i]]

for(var in names(df)) {
Expand Down

0 comments on commit fc4cebc

Please sign in to comment.