Skip to content

Error: Column Ratings must be length 1, not 0 #6

@robinpellegrims

Description

@robinpellegrims

For some reason, omdbapi sometimes returns an empty value for the Ratings field (probably a bug on their side). But when this happens, this library's functions throw the following error:

Error: Column 'Ratings' must be length 1, not 0

Can be handled more gracefully? It is still interesting to get all the other fields as a result.

Example call:
find_by_id('tt6911608', type='movie', include_tomatoes = TRUE)

Omdb api response:
{"Title":"Mamma Mia! Here We Go Again","Year":"2018","Rated":"PG-13","Released":"20 Jul 2018","Runtime":"114 min","Genre":"Comedy, Musical","Director":"Ol Parker","Writer":"Ol Parker (screenplay by), Richard Curtis (story by), Ol Parker (story by), Catherine Johnson (story by), Judy Craymer (originally conceived by), Catherine Johnson (based on the original musical by)","Actors":"Lily James, Amanda Seyfried, Meryl Streep, Dominic Cooper","Plot":"In this sequel to Mamma Mia!, Sophie learns about her mother's past while pregnant herself.","Language":"English","Country":"UK, USA","Awards":"N/A","Poster":"https://m.media-amazon.com/images/M/MV5BMjEwMTM3OTI1NV5BMl5BanBnXkFtZTgwNDk5NTY0NTM@._V1_SX300.jpg","Ratings":[],"Metascore":"N/A","imdbRating":"N/A","imdbVotes":"N/A","imdbID":"tt6911608","Type":"movie","DVD":"N/A","BoxOffice":"N/A","Production":"Universal Pictures","Website":"N/A","Response":"True"}

I'm guessing the issue is in using dplyr::as_data_frame on the following line:

ret <- dplyr::as_data_frame(tmp)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions