combine all vectores into dataframe which starts with specific name in R -


i have different numeric vectors same length , want combine specific name dataframe; lets say:
want combine vectors starts "pred"

prednn=c(1,2,3,4,5) prednb=c(2,6,4,7,8) nope=c(5,7,5,1,1) predsv=c(55,11,22,33,44) 

result: dfpred:

prednn  prednb  predsv   1       2       55   2       6       11   3       4       22   4       7       33   5       8       44 

how can in r?
thanks

you can try mget

data.frame(mget(ls(pattern='^pred'))) #    prednb prednn predsv #1      2      1     55 #2      6      2     11 #3      4      3     22 #4      7      4     33 #5      8      5     44 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -