0

I wonder how to extract all strings (like "Result of HH interview" "Main material of floor" in following example) without names in R.

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" ...
halfer
  • 19,824
  • 17
  • 99
  • 186
MYaseen208
  • 22,666
  • 37
  • 165
  • 309
  • 2
    Just use `unname(Test)` or `as.vector(Test)` to remove the name attributes or `attr(Test, "names") <- NULL` – akrun Sep 08 '17 at 11:36
  • 1
    Thanks @akrun for very useful comment. Would appreciate if you convert your comment to answer – MYaseen208 Sep 08 '17 at 11:38

0 Answers0