Ebert,Timothy Aaron
2022-Jun-13 20:21 UTC
[R] Combining Differnt columns in one single column
ID5 <- as.data.frame(ID_names1) colnames(ID5)<-"val" #rename the columns so they have the same name. ID6 <- as.data.frame(ID_names2) colnames(ID6)<-"val" rbind(ID5, ID6) This works for the first two, just keep doing the same thing for the others. Tim -----Original Message----- From: R-help <r-help-bounces at r-project.org> On Behalf Of anteneh asmare Sent: Monday, June 13, 2022 3:48 PM To: r-help at r-project.org Subject: [R] Combining Differnt columns in one single column [External Email] Dear All, I have the following column name in different data frame and different size ID_names1 <- paste0("id0000",1:9) ID_names2 <- paste0("id000",10:99) ID_names3 <- paste0("id00",100:999) ID_names4 <- paste0("id0",1000:9999) ID_names5 <- paste0("id",10000:50000) Dose it possible to combine in to a single column in r? Best, Hana ______________________________________________ R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_r-2Dhelp&d=DwICAg&c=sJ6xIWYx-zLMB3EPkvcnVg&r=9PEhQh2kVeAsRzsn7AkP-g&m=cjCY0UmRewiKkMVVxNu2riO8k4tZHD7s7R3R6SC-bwEM5u77LyExCSIzwI-q7Xu_&s=xrZArAFWnJf7ja13EEgxwBj-pMBEXBYSQgc6BhtNPAA&ePLEASE do read the posting guide https://urldefense.proofpoint.com/v2/url?u=http-3A__www.R-2Dproject.org_posting-2Dguide.html&d=DwICAg&c=sJ6xIWYx-zLMB3EPkvcnVg&r=9PEhQh2kVeAsRzsn7AkP-g&m=cjCY0UmRewiKkMVVxNu2riO8k4tZHD7s7R3R6SC-bwEM5u77LyExCSIzwI-q7Xu_&s=oUlYLeH_EF5rwea10resAheSjjvJ6nhUl8wT84OVXZM&eand provide commented, minimal, self-contained, reproducible code.
Dear Tim it works, But i want to treat them as a column name. Is it possible to treat as a column name ? Best, Hana On 6/13/22, Ebert,Timothy Aaron <tebert at ufl.edu> wrote:> ID5 <- as.data.frame(ID_names1) > colnames(ID5)<-"val" #rename the columns so they have the same name. > ID6 <- as.data.frame(ID_names2) > colnames(ID6)<-"val" > rbind(ID5, ID6) > > This works for the first two, just keep doing the same thing for the > others. > Tim > > -----Original Message----- > From: R-help <r-help-bounces at r-project.org> On Behalf Of anteneh asmare > Sent: Monday, June 13, 2022 3:48 PM > To: r-help at r-project.org > Subject: [R] Combining Differnt columns in one single column > > [External Email] > > Dear All, I have the following column name in different data frame and > different size > ID_names1 <- paste0("id0000",1:9) > ID_names2 <- paste0("id000",10:99) > ID_names3 <- paste0("id00",100:999) > ID_names4 <- paste0("id0",1000:9999) > ID_names5 <- paste0("id",10000:50000) > Dose it possible to combine in to a single column in r? > Best, > Hana > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_r-2Dhelp&d=DwICAg&c=sJ6xIWYx-zLMB3EPkvcnVg&r=9PEhQh2kVeAsRzsn7AkP-g&m=cjCY0UmRewiKkMVVxNu2riO8k4tZHD7s7R3R6SC-bwEM5u77LyExCSIzwI-q7Xu_&s=xrZArAFWnJf7ja13EEgxwBj-pMBEXBYSQgc6BhtNPAA&e> PLEASE do read the posting guide > https://urldefense.proofpoint.com/v2/url?u=http-3A__www.R-2Dproject.org_posting-2Dguide.html&d=DwICAg&c=sJ6xIWYx-zLMB3EPkvcnVg&r=9PEhQh2kVeAsRzsn7AkP-g&m=cjCY0UmRewiKkMVVxNu2riO8k4tZHD7s7R3R6SC-bwEM5u77LyExCSIzwI-q7Xu_&s=oUlYLeH_EF5rwea10resAheSjjvJ6nhUl8wT84OVXZM&e> and provide commented, minimal, self-contained, reproducible code. >