Cannot use dput for data.table in R

前端 未结 3 2132
小蘑菇
小蘑菇 2020-12-03 17:57

I have following data.table for which I cannot use output of dput command to recreate it:

> ddt
   Unit Anything index new
1:    A      3.4     1   1
2:           


        
3条回答
  •  失恋的感觉
    2020-12-03 18:45

    The problem is that dput prints out external pointer address (this is something that data.table uses internally, and will reconstruct when required), which you can't really use.

    If you manually cut out the .internal.selfref part, it will work just fine, except for a one-time complaint from data.table for some operations.

    You could add an FR to data.table about this, but it will require modifying the base function from data.table, similar to how rbind is currently handled.

提交回复
热议问题