Given the following list:
l <- list("foo123"=c(1:3), "foo456"=5, "foo789"=8)
print(l)
# $foo123
# [1] 1 2 3
#
# $foo456
# [1] 5
#
# $foo789
# [1]
When I unlist()
the list, the names get integers appended if they are duplicates.
unlist(l)
# foo1231 foo1232 foo1233 foo456 foo789
# 1 2 3 5 8
I would like to preserve names, so use.names=FALSE
is not ideal. Is this behaviour explained anywhere in the help page? Can it be modified?
Can unlist be configured to preserve names so that my result is:
# foo123 foo123 foo123 foo456 foo789
# 1 2 3 5 8
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…