1

I have multiple data sets that contain some data collected over time. The current format is what an existing R package accepts for data analysis (growth curve data). I can see there are differences etc, but I'm wanting to do some sort of stats on the dataset as well.

However, it doesn't work for conventional analysis like Anova etc due to the way the data is structured

Is there a way to convert this data table to something more conventional within R rather than me manually copy-pasting in excel?

attached image for example and also attached one of the datasets via google drive

https://drive.google.com/file/d/1lg-5JXk1sXZfu1Eg6wZgqvJi7fm3hyGX/view?usp=sharing

enter image description here

camille
  • 16,432
  • 18
  • 38
  • 60
Brian
  • 41
  • 2
  • (1) You could edit your question and put some sample data there using `dput()` or `data.frame()`. Usally people on SO prefer not to click on external links. (2) If your data.frame is named `df` you could use `tidyr::pivot_longer(df, -time, values_to = "OD600", names_to = "strain")`. – Martin Gal Sep 09 '21 at 16:33
  • 1
    Aha, thats perfect. Just ran that snippet of code and its done what I needed. Will read some of that documentation to understand the function – Brian Sep 09 '21 at 16:47
  • Good luck with that. Reshaping (`pivot_longer`, `pivot_wider`) are vey useful and powerful tools. There are also some questions about reshaping multiple columns, see https://stackoverflow.com/questions/61570710/how-to-use-pivot-longer-to-reshape-from-wide-type-data-to-long-type-data-with-mu and https://stackoverflow.com/questions/68943887/having-trouble-with-spread-pivot-wider-from-long-with-varying-data-types – Martin Gal Sep 09 '21 at 16:52

0 Answers0