简体   繁体   中英

Using paste0 in R as a concatenation of two columns is there a way to immediately rename the column similar to the AS function in SQL

columns look like this

 col1|col2|col3|col4|
    

When i want to create a new column

TEST <- df %>%
group_by(col1,paste0(col3,col4))

I get

 col1|col2|col3|col4|paste0(col4,col4)

is there a way i can rename it and get it be

col1|col2|col3|col4|AnyNameIWant
TEST <- df %>% group_by(col1,AnyNameIWant = paste0(col3,col4))

might be what you're looking for.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM