Skip to content

Clarity slice_max() and slice_min() in introduction vignette #7671

@KittJonathan

Description

@KittJonathan

Hello there!

While reading the "Introduction to dplyr" article (here), I came across something that I think would need correcting : in the part on the slice functions, it's noted that

slice_min() and slice_max() select rows with highest or lowest values of a variable. Note that we first must choose only the values which are not NA.

I tried running the code without filtering out NAs for the variable of interest, and it seems to work :

starwars |> slice_max(height, n = 3) and starwars |> filter(!is.na(height)) |> slice_max(height, n = 3) return the same result.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions