Skip to content

fwrite to support secondary separator (sep2) for vectors in list columns #806

Description

@RyanHope

Since data.table includes the awesome fread function which supports sep2 for lists within cells I was completely shocked to find there is no way to write a data.table with lists in columns to a delimited text file.

I had to roll my own function to save my data.tables but its not very generic.

write.data.table <- function(x, file) {
  fileConn <-file(file)
  writeLines(c(paste(colnames(x),collapse="\t"),
               x[,paste(id,parent,layer,start,end,sapply(x,function(o) paste(o,collapse=",")),sapply(y,function(o) paste(o,collapse=",")),sep="\t")]
  ), fileConn)
  close(fileConn)
}

There has to be a better way.

Activity

  1. arunsrinivasan commented on Aug 14, 2015

    @arunsrinivasan
    Member

    Dup of #580 (even though this is about a specific case of fwrite - writing list columns, it falls under that issue).

  2. changed the title [-][feature request] write.data.table() aka "support for saving data.tables with lists in cells"[/-] [+]fwrite to support secondary separator (sep2) for vectors in list columns[/+] on Apr 7, 2016
  3. added this to the v1.9.8 milestone on Nov 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions