Combine / combine two ggplot aesthetics

Let's say I have two ggplot aesthetics:

a.1 <- aes(v.1=1, v.2=2)
a.2 <- aes(v.3=3)

Is there a way to combine the already built aesthetics? In my example, it would be something like this:

a.merged <- aes(v.1=2, v.2=2,v.3=3)

I know that aes_string can be used to create aesthetics from a character vector that can be concatenated, but I look at the case when two aesthetics are already built, and I want to avoid having to convert them to characters first.

+4
source share
1 answer
> c(a.1,a.2)
$v.1
[1] 1

$v.2
[1] 2

$v.3
[1] 3

aes - " ", c() , , "". , , , , c():

a.merged <- c(a.1,a.2)
class(a.merged) <- "uneval"

, modifyList :

> modifyList(a.1, a.2)
List of 3
 $ v.1: num 1
 $ v.2: num 2
 $ v.3: num 3
> attributes(modifyList(a.1, a.2))
$names
[1] "v.1" "v.2" "v.3"

$class
[1] "uneval"
+6

All Articles