Last active
September 12, 2018 08:40
-
-
Save zerweck/ff6f61f5d08986e1df56 to your computer and use it in GitHub Desktop.
[Export nested Lists] #R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# If you have nested lists or data.frames inside of a data.frame, | |
# print.data.frame can show these without help, but any variant | |
# of write.table will throw an error. This is because it uses the | |
# format.data.frame() function. This little function helps you do the same, | |
# so nested lists will be printed in one cell as long strings. | |
# To get the same output as print.data.frame, change the parameters as so: | |
## format.data.frame(df, digits = digits, na.encode = FALSE) | |
write.table.nested <- function(df, ...) { | |
df <- format.data.frame(df) | |
write.table(x = df, ...) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment