git
GitHub
NULL
[[]]
$
@
slot()
dplyr::case_when
try()
suppressWarnings()
suppressMessages()
purrr
map_*()
map2_*()
walk()
imap()
pmap()
reduce()
map_df*()
pluck()
flatten()
NextMethod()
$print()
lubridate::period()
lobstr::ast():
recurse_call()
list2()
do.call
Consider this code to count the number of Gentoo penguins in the penguins data set. We see that there are 124 Gentoo penguins.
penguins
sum("Gentoo" == penguins$species) # output: 124
One subtle error can arise in trying out %in% here instead.
%in%
species_vector <- penguins |> select(species) print("Gentoo" %in% species_vector) # output: FALSE
species_unlist <- penguins |> select(species) |> unlist() print("Gentoo" %in% species_unlist) # output: TRUE
species_pull <- penguins |> select(species) |> pull() print("Gentoo" %in% species_pull) # output: TRUE
If you want to look up the manual pages for the %in% operator with the ?, use backticks:
?
?`%in%`
and we find that %in% is a wrapper for the match() function.
match()