How do I select variables in an R dataframe whose names contain a particular string?

前端 未结 3 934
臣服心动
臣服心动 2020-12-02 20:52

Two examples would be very helpful for me.

How would I select: 1) variables whose names start with b or B (i.e. case-insensitive) or 2) variables whose names contain

3条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-02 21:23

    I thought it was worth adding that select_vars is retired as of tidyverse version 1.2.1. Now, tidyselect::vars_select() is likely what you're looking for within the "tidyverse". See the documentation here.

提交回复
热议问题