Hello!
I have this data frame that currently has species and density in column form, and I am trying to turn the data into a species by density matrix. Basically, I want all the species to be turned into column headers, and their densities to be in the rows, with "depth" being in column 1.
Here is an example of the dataframe:
structure(list(Species = c("Achnanthidium", "Actinastrum gracillimum",
"Actinastrum hantzschii", "Ankistrodesmus arcuatus"), Density = c(236.319,
3700, 5623.813, 53.24729)), class = "data.frame", row.names = c(NA,
-4L))
I want it to look like this, without having to manually do it for hundreds of rows:
structure(list(Depth = 0, Achnanthidium = 236.319, `Actinastrum gracillimum` = 3700,
`Actinastrum hantzschii` = 5623.813, `Ankistrodesmus arcuatus` = 53.24729), row.names = 1L, class = "data.frame")
Can anyone help?
Thank you so much!!!