Skip to content

Pass col_type argument to read_memento #4

@k5cents

Description

@k5cents

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")))

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions