2

I have data that looks on the surface as follows: enter image description here

The data is structured as follows:

str(minstest)
List of 948
 $ : Named int [1:5] 4 6 11 16 75
  ..- attr(*, "names")= chr [1:5] "Mass " "Bite " "Burn " "Cyst " ...
 $ : Named int 37
  ..- attr(*, "names")= chr "Impaired skin integrity "
 $ : Named int 2
  ..- attr(*, "names")= chr "Abrasion "
 $ : Named int 33
  ..- attr(*, "names")= chr "Infection of nail "
 $ : Named int 34
  ..- attr(*, "names")= chr "Lesion "

What I want to do is replace the numbers in the V1 vector with the names. Further, I would like to separate each name into distinct columns.

I tried multiple permutations of a recommendation that I found at: How to print names of values in R

Unfortunately, no option I have tried thus far has worked.

Community
  • 1
  • 1
  • 2
    Welcome to Stack Overflow! [How to make a great R reproducible example?](http://stackoverflow.com/questions/5963269) Can you add output of `dput(minstest)`. – zx8754 Apr 05 '16 at 06:49
  • How about `lapply(minstest, names)` – akrun Apr 05 '16 at 06:53
  • I have unfortunately tried that before. I get an error that the command implies a different number of rows. I tried a variation on apply also. – sehrWayward Apr 05 '16 at 22:43
  • Here is a snippet: > dput(minstest) structure(list(structure(c(4L, 6L, 11L, 16L, 75L), .Names = c("Mass ", "Bite ", "Burn ", "Cyst ", "Gout ")), structure(37L, .Names = "Impaired skin integrity "), structure(2L, .Names = "Abrasion "), structure(33L, .Names = "Infection of nail "), structure(34L, .Names = "Lesion "), structure(c(39L, 110L ), .Names = c("Creation of graft fistula for dialysis ", "Skin care: graft site ")), structure(3L, .Names = "Blister "), structure(c(3L, 4L, 21L, 23L), .Names = c("Blister ", "Mass ", "Abscess ", "Mycosis ")), – sehrWayward Apr 12 '16 at 00:53

0 Answers0