从R中的Named chr中提取字符串

时间:2017-09-08 11:35:09

标签: r string character

我想知道如何在R中没有名字的情况下提取所有字符串(例如" HH访谈的结果""楼层的主要材料"在下面的例子中)。

Test <-
structure(c("Result of HH interview", "Main material of floor", 
"District", "Area", "Wealth index quintile", "Household sample weight", 
"Education of household head", ""), .Names = c("HH9", "HC3", 
"hh7r", "hh6r", "windex5", "hhweight", "helevel", "RFloor"))

Test
                          HH9                           HC3 
     "Result of HH interview"      "Main material of floor" 
                         hh7r                          hh6r 
                   "District"                        "Area" 
                      windex5                      hhweight 
      "Wealth index quintile"     "Household sample weight" 
                      helevel                        RFloor 
"Education of household head"                            "" 

 str(Test)
 Named chr [1:8] "Result of HH interview" "Main material of floor" ...
 - attr(*, "names")= chr [1:8] "HH9" "HC3" "hh7r" "hh6r" ...

0 个答案:

没有答案