OK. Then, perhaps something like this for the two company scenario; not suitable if you have more. Let me know if that is the case and we can work out something better.
library(dplyr, warn.conflicts = FALSE)
#> Warning: package 'dplyr' was built under R version 3.6.3
library(tibble)
honda_df <- structure(
list(EmployeeID = 1:4,
EmploymentType = structure(c(2L, 2L, 3L, 1L),
.Label = c("Manager", "Mechanic", "Painter"),
class = "factor")),
class = "data.frame", row.names = c(NA, -4L))
toyota_df <- structure(
list(EmployeeID = 5:8,
EmploymentType = structure(c(3L, 2L, 2L, 1L),
.Label = c("Manager", "Mechanic", "Painter"),
class = "factor")),
class = "data.frame", row.names = c(NA, -4L))
honda_df %>%
add_column(EmployeeCompany = "Honda") %>%
bind_rows(toyota_df) %>%
mutate(EmployeeCompany = if_else(is.na(EmployeeCompany),
true = "Toyota",
false = EmployeeCompany))
#> EmployeeID EmploymentType EmployeeCompany
#> 1 1 Mechanic Honda
#> 2 2 Mechanic Honda
#> 3 3 Painter Honda
#> 4 4 Manager Honda
#> 5 5 Painter Toyota
#> 6 6 Mechanic Toyota
#> 7 7 Mechanic Toyota
#> 8 8 Manager Toyota
Created on 2020-04-03 by the reprex package (v0.3.0)