suppressPackageStartupMessages({
library(dplyr)
})
DF <- structure(list(
id = c("H00607", "H01059", "H09128", "H09039"),
name = c("Nafcillin", "Norfloxacin", "Brexpiprazole", "Eliglustat"), parent_key = c("H00091", "H00091", "H00091", "H00091"),
ingredients = c(
"Cyclosporine", "Cyclosporine", "Cyclosporine",
"Cyclosporine"
)
), class = c(
"spec_tbl_df", "tbl_df", "tbl",
"data.frame"
), row.names = c(NA, -4L), spec = structure(list(
cols = list(id = structure(list(), class = c(
"collector_character",
"collector"
)), name = structure(list(), class = c(
"collector_character",
"collector"
)), parent_key = structure(list(), class = c(
"collector_character",
"collector"
)), ingredients = structure(list(), class = c(
"collector_character",
"collector"
))), default = structure(list(), class = c(
"collector_guess",
"collector"
)), skip = 1L
), class = "col_spec"))
pt1 <- DF[, c(1, 2)]
pt2 <- DF[, c(3, 4)]
colnames(pt2) <- c("id", "name")
combined <- rbind(pt1, pt2)
combined
#> # A tibble: 8 x 2
#> id name
#> <chr> <chr>
#> 1 H00607 Nafcillin
#> 2 H01059 Norfloxacin
#> 3 H09128 Brexpiprazole
#> 4 H09039 Eliglustat
#> 5 H00091 Cyclosporine
#> 6 H00091 Cyclosporine
#> 7 H00091 Cyclosporine
#> 8 H00091 Cyclosporine
Created on 2021-01-02 by the reprex package (v0.3.0.9001)