select() starts with lowercase "a"

How can select variables that start with "a" (lowercase)?

library(dplyr)
df <- tibble(
  Apple = 1:2,
  aApple = 101:102,
  aAsia = c("SG", "CN"),
  Australia = c("y", "n"),
  aAustralia = c("Y", "N"),
  abook = 205:206
)

# Doesn't work!
df %>% 
  select(starts_with("a")) # picks uppercasse also
#> # A tibble: 2 x 6
#>   Apple aApple aAsia Australia aAustralia abook
#>   <int>  <int> <chr> <chr>     <chr>      <int>
#> 1     1    101 SG    y         Y            205
#> 2     2    102 CN    n         N            206
df %>% 
  select(starts_with("a",
                     ignore.case = FALSE))

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.