I'm working with a large dataset and I used the melt function and the values in the table remained the same but when I applied the dcast function the values changed from species name, As Ns Ss
and numbers to all 0s or 1s
.
I've tried googling this specifically and have found nothing and have looked up the dcast function but am having a hard time understanding what in it would be causing the values to switch to 0s and 1s. This is my first time ever writing my own code and I'm not a trained programmer so I have spent hours trying to figure this out on my own and I can't think of anything else to try.
PhenotypeData_melt <- melt(PhenotypeData_wheat, id=c("Trial", "Trait"))
PhenotypeData_Spread <- dcast(PhenotypeData_melt, Trial ~ Trait + variable, value.var="value")
I haven't received any error messages. Although I do receive "Aggregation function missing: defaulting to length". I would like to fix this code so that the value stays as it is and isn't converted to 0s and 1s
.