"list.to.df"<- function(maps) { # input: a list whose components are matrices giving map coords # output: a data frame with column names "lat", "long", "source", # with the source giving the map name as a factor. mnames <- names(maps) numpts <- dim(maps[[1]])[1] num <- length(maps) p1 <- paste("maps[[", 1:num, "]]", sep = "", collapse = ",") p2 <- parse(text = paste("rbind(", p1, ")")) p3 <- eval(p2) p4 <- factor(rep(mnames, rep(numpts, num))) cbind(p3, source = p4) }