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

Pass col_type argument to read_memento #4

Open
k5cents opened this issue Apr 23, 2019 · 0 comments
Open

Pass col_type argument to read_memento #4

k5cents opened this issue Apr 23, 2019 · 0 comments
Assignees

Comments

@k5cents
Copy link

k5cents commented Apr 23, 2019

I'm using read_memento() to scrape some saved .csv files for improved reproducibility. The function is great. Some of the columns need an explicit column type not picked up by automatic parsing in as = "parsed".

It'd be great if we could define the col_types = cols()) like you can in readr::read_csv().

Here's how I'm currently doing it. Reading as raw and parsing separately.

"https://projects.fivethirtyeight.com/polls-page/senate_polls.csv" %>%
  read_memento(timestamp = "2019-01-29", as = "raw") %>%
  read_csv(col_types = cols(
    question_id = col_character(),
    poll_id     = col_character(),
    pollster_id = col_character(),
    sponsor_ids = col_character(),
    start_date  = col_date("%m/%d/%y"),
    end_date    = col_date("%m/%d/%y"),
    created_at  = col_datetime("%m/%d/%y %H:%M")))
@k5cents k5cents changed the title Pass cols() argument to read_mementos() Pass col_type argument to read_memento Apr 23, 2019
@jonocarroll jonocarroll self-assigned this May 7, 2019
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

No branches or pull requests

2 participants