ps1 = ps(x = p_dbl())
ps1$values = list(x = 1)
ps2 = ps(y = p_lgl())
pu = ps_union(list(ps1, ps2))
# same as:
pu = c(ps1, ps2)
pu
pu$values
pu$values$x = 2
pu$values
# p1 is unchanged:
ps1$values
# Prefixes automatically created for named elements.
# This allows repeating components.
pu2 = c(one = ps1, two = ps1, ps2)
pu2
pu2$values
Run the code above in your browser using DataLab