-1

I have a data set containing information regarding morphological traits of individuals of several species. Columns are about the individual id, species' name, trait types and trait values. I need to arrange the data in a manner where each traits should be as columns and species and individual id should be in rows. I have hundreds of individuals and several species

Blockquote

Blockquote

Gull
  • 95
  • 7

1 Answers1

1

You can use reshape function as shown below

reshape(data,idvar = c("sample", "species"), timevar = "trait", v.names = "value", dir = "wide")
onyambu
  • 49,350
  • 3
  • 19
  • 45