Case-insensitive search of a list in R

前端 未结 7 1974
不知归路
不知归路 2020-11-30 04:58

Can I search a character list for a string where I don\'t know how the string is cased? Or more generally, I\'m trying to reference a column in a dataframe, but I don\'t kn

相关标签:
7条回答
  • 2020-11-30 05:24

    Another way of achieving this is to use str_which(string, pattern) from the stringr package:

    library("stringr")
    str_which(string = tolower(colnames(iris)), pattern = "species")
    
    0 讨论(0)
提交回复
热议问题