|
Hi together,
while trying to write a minimal example for a problem that is bothering me, I discoverd that dput() does not work on data.tables. More precisely, the output of dput cannot be read in, most probably because the ".internal.selfref = <pointer: ..." syntax causes problems: library(data.table) DT <- data.table(A=1:2, B=2:3) dput(DT) structure(list(A = 1:2, B = 2:3), .Names = c("A", "B"), row.names = c(NA, -2L), class = c("data.table", "data.frame"), .internal.selfref = <pointer: 0x0000000000150788>) Trying to read the structure part gives: "Error: unexpected '<' in: " class = c("data.table", "data.frame"), .internal.selfref = <" Are there any workarounds? If not, is this a base-R problem or a data.table specific problem? Thanks Christoph |
|
Follow-up: Putting <pointer:...> in quotation marks works:
structure(list(A = 1:2, B = 2:3), .Names = c("A", "B"), row.names = c(NA, -2L), class = c("data.table", "data.frame"), .internal.selfref = "<pointer: 0x0000000000150788>") But why is that not inserted in the first place? Does that break something else? |
|
Hi. You can include the <pointer:...> part when posting, we know what is meant and can fix it up if we need to. It's an R thing, from ?deparseOpts : " warnIncomplete Some exotic objects such as environments, external pointers, etc. can not be deparsed properly. This option causes a warning to be issued if the deparser recognizes one of these situations. Using control = "all" comes closest to making deparse() an inverse of parse(). However, not all objects are deparse-able even with this option. A warning will be issued if the function recognizes that it is being asked to do the impossible. " > Follow-up: Putting <pointer:...> in quotation marks works: > > structure(list(A = 1:2, B = 2:3), > .Names = c("A", "B"), > row.names = c(NA, -2L), > class = c("data.table", "data.frame"), > .internal.selfref = "<pointer: 0x0000000000150788>") > > But why is that not inserted in the first place? Does that break something > else? > > -- > View this message in context: > http://r.789695.n4.nabble.com/dput-does-not-work-with-data-table-tp4519150p4519172.html > Sent from the datatable-help mailing list archive at Nabble.com. > _______________________________________________ > datatable-help mailing list > [hidden email] > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help > _______________________________________________ datatable-help mailing list [hidden email] https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help |
|
OK, thanks. Good to know it's not my lack of knowledge this time ;-)
|
| Powered by Nabble | Edit this page |
