Replace a vector by named vector

tidai(x, y, fac = FALSE, keep_origin = FALSE)

Arguments

x

a vector need to be replaced

y

named vector

fac

consider the factor?

keep_origin

keep_origin?

Value

vector

Examples

tidai(c("a", "a", "b", "d"), c("a" = "red", b = "blue"))
#> [1] "red"  "red"  "blue" NA    
tidai(c("a", "a", "b", "c"), c("red", "blue"))
#> [1] "red"  "red"  "blue" "red" 
tidai(c("A" = "a", "B" = "b"), c("a" = "red", b = "blue"))
#>      A      B 
#>  "red" "blue" 
tidai(factor(c("A" = "a", "B" = "b", "C" = "c")), c("a" = "red", b = "blue", c = "green"))
#>       A       B       C 
#>   "red"  "blue" "green"