Code:
i<-c("a","b","c")
j<-c("x","y")
k<-data.frame(i,j)
Error in data.frame(i, j) :
arguments imply differing number of rows: 3, 2
I'm trying to take two vectors named i and j:
    i             j
1   a         1   x
2   b         2   y
3   c
and I would like to join them as a data frame such that the empty row in j is filled in and it looks like this:
    i    j
1   a    x
2   b    y
3   c    0
How do I achieve this and end up with class(k) being a data frame? Other examples are using:
cbind.fill<-function(...){
  nm <- list(...) 
  nm<-lapply(nm, as.matrix)
  n <- max(sapply(nm, nrow)) 
  do.call(cbind, lapply(nm, function (x) 
    rbind(x, data.frame(, n-nrow(x), ncol(x))))) 
}
But I need a data frame as the result.
