Adding list names to data frames when using lapply and do.call

f <- function(x,i){
if(!is.null(x)){
ids <- rep(i,length(x))
x<- cbind(x,ids)
return(x)}
split2 <- mapply(f,split,as.list(names(split)))
y <- do.call(rbind(split2))
Next
Next

Code snippet for edge list with igraph (R)