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

Read tables from Stack Overflow #61

Open
privefl opened this issue Dec 26, 2017 · 5 comments · May be fixed by #76
Open

Read tables from Stack Overflow #61

privefl opened this issue Dec 26, 2017 · 5 comments · May be fixed by #76

Comments

@privefl
Copy link

privefl commented Dec 26, 2017

People in Stack Overflow often paste the output of the print() from R to provide an example data frame.
This results in something like this:

to  RealAge
513 59.608
513 84.18
0   85.23
119 74.764
116 65.356

When pasting this inside quotes in readr::read_table, it's OK:

readr::read_table("to  RealAge
513 59.608
513 84.18
0   85.23
119 74.764
116 65.356")

Yet, when using the addin "Paste as tribble", it results in:

tibble::tribble(
   ~to..RealAge,
   "513 59.608",
    "513 84.18",
    "0   85.23",
   "119 74.764",
   "116 65.356"
  )

Is this a feature you want to add? Is it easy to do? Do you want me to try to make a PR?

@MilesMcBain
Copy link
Owner

Thanks for the suggestion, I do like this idea. It should be a fairly small change to enable space as a delimiter. My main concern originally was how this would interact with the delimiter guessing (I call it separator guessing in the code). but I've simplified that over time.

If you want to have a crack, feel free! I'm happy to review PRs. It should be a small change to guess_sep, the main effort will be creating a handful of good tests to go with the PR that test the interaction spaces with other delimiters. So you'd have some tests that show how numbers with spaces behave with tab delimiters, how space delimiters interact with other delimiters in data, etc.

@privefl
Copy link
Author

privefl commented Dec 27, 2017

I get the error could not find function ".rs.readUiPref" when trying to check my local fork of this package.

@MilesMcBain
Copy link
Owner

Interesting, I've not seen that before. That's an RStudio function and that test should not run outside of RStudio. What RStudio version are you on?

@privefl
Copy link
Author

privefl commented Dec 28, 2017

I have version 1.1.383 on this computer, which is a CentOS 7 (Linux).

@MilesMcBain
Copy link
Owner

That's the version I'm running. I'm developing on Ubuntu Mate 17.10.

Can you call .rs.readUiPref('num_spaces_for_tab') from the console and get a number back? I get 2.

Where did you see this error? Was it in a CI test report or when you kick of testing manually using devtools::test()?

jonocarroll added a commit to jonocarroll/datapasta that referenced this issue Jul 23, 2018
@jonocarroll jonocarroll linked a pull request Jul 23, 2018 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants