Skip to content

Provide a convenience method for filtering lists from the server #464

Description

@toph-allen

#463 (in flight at time of writing) modifies search_content() to return a list of Connect class objects.

Right now, the best way to filter this list within R is to use purrr::keep(). Perhaps this is the best way, but perhaps there's a way we can make this easier.

my_content <- search_content(client, "owner:@me")
# > length(my_content)
# [1] 237

MINIMUM_R_VERSION <- "4.0"

# Use purrr::keep to filter with arbitrary predicates
old_content <- purrr::keep(my_content, function(x) {
  isTRUE(as.numeric_version(x$content$r_version) < as.numeric_version(MINIMUM_R_VERSION))
})

length(old_content)
# [1] 48

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions