Suppose there is a data frame with a fixed number of row, for example
a <- as.data.frame(c(1:7))
And there is another vector with fewer (or bigger) number of row:
b <- c(1:4)
Then it is not possible to add b as new column into a:
a <- cbind(a, b)
Here is the output:
Error in data.frame(..., check.names = FALSE) :
arguments imply differing number of rows: 7, 4
Where the following result is expected:
1 1 1
2 2 2
3 3 3
4 4 4
5 5 NA
6 6 NA
7 7 NA