Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose datapasta::dpasta() #280

Open
hadley opened this issue Aug 28, 2019 · 2 comments
Open

Expose datapasta::dpasta() #280

hadley opened this issue Aug 28, 2019 · 2 comments
Labels

Comments

@hadley
Copy link
Member

@hadley hadley commented Aug 28, 2019

Since it's so helpful for turning data frames into nice tribbles/data.frames. Reprex could either depend on datapasta, or if it's too heavy a dependency we could implement a minimal version ourselves.

@jennybc jennybc added the feature label Nov 1, 2019
@jennybc

This comment has been minimized.

Copy link
Member

@jennybc jennybc commented Nov 1, 2019

I poked around and thought about this.

I think it makes sense to inline a minimal version here, possibly with some involvement from @MilesMcBain if he was interested. Since datapasta exists, we could tackle the 80% most common use cases, which would simplify things a lot, and refer people to datapasta if their needs aren't met.

We only need to go from R object to a human-friendly deparsed version, whereas datapasta also aims to ingest text, which brings in a readr dependency.

@MilesMcBain

This comment has been minimized.

Copy link

@MilesMcBain MilesMcBain commented Nov 3, 2019

Go forth and minimally re-implement with my blessing if that's the route you choose. It'll be a WHILE before I have any bandwidth for something like this - an infant and a toddler will see to that 😉

What would be cool though is if the deparse bit could be split out into something we could both take dependency on. There was quite a bit of progress made on this by @krlmlr in deparse - this has an (unexported) deparse_tribble() so it might even be "done" for your purposes. I thought hard about taking dependency on it but in the end didn't for a couple of reasons:

  • I prefer the commas to align in tribbles (right justified output)
  • It doesn't wrap data.frames
    • To do this well it helps if you have some idea of the indent level of where the deparsed output is going to be printed. But this opens up a whole can of worms and now you need to get chatty with the rstudioapi
    • It's also fraught to try to do this after the text output has been baked. It's easier if you can do it with some knowlegde of the data types so you don't accidentally split on delimeters that are embedded in text data.

There's other things it might be nice to do properly like:

  • list column support
  • native support for common things like factors and dates/datetimes (probably should be addressed in tribble if at all)

edit: excuse spelling

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.