[Rd] rbind returns a zero row data frame when binding zero column data frames

Ant F @nto|ne@|@br| @end|ng |rom gm@||@com
Mon Sep 2 11:40:34 CEST 2019


Dear all,

`rbind()` returns a zero row data frame when binding zero column data
frames, see example below:

``` r
# a data frame with 1 row and 0 column
x <- data.frame(row.names=1)
x
#> data frame with 0 columns and 1 row
rbind(x,x)
#> data frame with 0 columns and 0 rows
```

I would have expected in that case `data frame with 0 columns and 2 rows`.

`cbind()` on the other hand acts as I would expect, returning a 2 column
data frame from 2 one column data frames even if they have no row.

``` r
# a data frame with 0 row and 1 column
y <- data.frame(A = numeric(0))
y
#> [1] A
#> <0 rows> (or 0-length row.names)
cbind(y,y)
#> [1] A A
#> <0 rows> (or 0-length row.names)
```

	[[alternative HTML version deleted]]



More information about the R-devel mailing list