Identifying dataframe columns by their first few characters

后端 未结 1 889
暗喜
暗喜 2021-01-23 06:46

I have a dataframe in which the column names begin with certain characters:

> colnames(df)
[1] \"p.crossfencing\"  \"p.livestockdrinking\"  \"v.livestocktrai         


        
相关标签:
1条回答
  • 2021-01-23 07:10

    Are you looking for df[,grep("^v.",names(df))]?

    0 讨论(0)
提交回复
热议问题