type-coercion

How to flatten a list to a list without coercion?

China☆狼群 提交于 2019-11-26 04:42:20
问题 I am trying to achieve the functionality similar to unlist, with the exception that types are not coerced to a vector, but the list with preserved types is returned instead. For instance: flatten(list(NA, list(\"TRUE\", list(FALSE), 0L)) should return list(NA, \"TRUE\", FALSE, 0L) instead of c(NA, \"TRUE\", \"FALSE\", \"0\") which would be returned by unlist(list(list(NA, list(\"TRUE\", list(FALSE), 0L)) . As it is seen from the example above, the flattening should be recursive. Is there a