R - use rbind on multiple variables with similar names -
i have many variables have created using code this:
for (i in 1:10) { assign(paste0("variable", i), )} i need use rbind on variables combine them. tried no avail:
rbind(assign(paste0("variable", 1:10))) any suggestions on do?
that wrong way handle related items. better use list or dataframe, find out why in due course. now:
do.matrix <- do.call(rbind, lapply( ls(patt="variable"), get) ) or:
do.matrix <- do.call(rbind, lapply( paste0("variable", 1:10) , get) )
Comments
Post a Comment