Extract first word

前端 未结 3 641
误落风尘
误落风尘 2021-01-06 15:29

I have the following data frame dat :

brand (column name)
Channel clothes
Gucci perfume
Channel shoes
LV purses
LV scarves

And I want to cr

3条回答
  •  耶瑟儿~
    2021-01-06 15:46

    We can use the word from stringr

    library(stringr)
    word(df$brand, 1)
    #[1] "Channel" "Gucci"   "Channel" "LV"      "LV"     
    

提交回复
热议问题