Combine two dataframe columns in R -


this question has answer here:

suppose have dataframe such as:
b c
a
b b
d e

and want create new column in dataframe b , c combined (call d).

a b c d
aa
b b bb
d e ea

you can use paste.

  df1$d <- do.call(paste0, df1[c('b', 'c')]) 

or

  df1 <- transform(df1, d= paste0(b,c)) 

Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -