Merge two objects from right to left.

x %<-% y

Arguments

x

A named list or vector

y

A named list or vector. Any duplicated names are detected in x will be covered by y

Value

a list

Examples

# two lists x <- list(a = 1, b = "foo", c = 3) y <- list(b = 2, d = 4) x %<-% y
#> $a #> [1] 1 #> #> $b #> [1] 2 #> #> $c #> [1] 3 #> #> $d #> [1] 4 #>
y %<-% x
#> $b #> [1] "foo" #> #> $d #> [1] 4 #> #> $a #> [1] 1 #> #> $c #> [1] 3 #>
# one list and one vector x <- c(foo = 1, bar = 2) y <- list(foo = "foo") x %<-% y
#> $foo #> [1] "foo" #> #> $bar #> [1] 2 #>
y %<-% x
#> $foo #> [1] 1 #> #> $bar #> [1] 2 #>
# two vectors x <- c(a = 1, b = "foo", c = 3) y <- c(b = 2, d = 4) x %<-% y
#> $a #> [1] "1" #> #> $b #> [1] 2 #> #> $c #> [1] "3" #> #> $d #> [1] 4 #>
y %<-% x
#> $b #> [1] "foo" #> #> $d #> [1] 4 #> #> $a #> [1] "1" #> #> $c #> [1] "3" #>
# duplicated names in x x <- list(a = 1, b = "foo", b = 3) y <- list(b = 2, d = 4) x %<-% y
#> $a #> [1] 1 #> #> $b #> [1] 2 #> #> $d #> [1] 4 #>
y %<-% x # be careful, since "3" will cover on "foo" in x, then on "2" in y
#> $b #> [1] 3 #> #> $d #> [1] 4 #> #> $a #> [1] 1 #>