R是否有一种优雅的方式递归地将任意深度列表(包含列表和向量)转换为路径向量?例如,转换这样的:递归对象列表
list(
home = list(
jerry = c("R", "bla"),
mary = "xx"
),
tmp = c("foo", "bar"),
c("etc")
)
要一个对象作为这样的:unlist
c(
"/home/jerry/R",
"/home/jerry/bla",
"/home/mary/xx",
"/tmp/foo",
"/tmp/bar",
"/etc"
)
谢谢。我已经把'etc'改成了一个向量,而不是一个名字。现在它运作良好。 – Jeroen