0

I have a df with the following structure:

 $ Name     : chr  "Blank" "Blank" "Blank" "Blank" ...
 $ Time     : POSIXct, format: "2017-09-29 00:00:00" "2017-09-29 00:10:02" 
 "2017-09-29 00:20:03" "2017-09-29 00:30:04" ...
 $ meanOD572: num  100935 102148 107541 103944 103911 ..

What I need to do is get every single Name for every single Time, average, and then subtract the mean (OD572) from one of the specific Name values ("Blank") for that specific time point.

I am a bit new to R and I am struggling to solve this. Do any of you have an idea of how to solve this?

Thank you very much. I have tried some ways, but it would be something like:

newDf = df %>%
group_by(Name,Time) %>%
summarize(meanOD572 = mean(OD572, na.rm = TRUE)) %>%
group_by(Name, Time) %>%
meanOD572 <-- meanOD572 - meanOD572(Name == "LB")
Tiago Lubiana
  • 319
  • 1
  • 11
  • You may wish to start by posting a [minimal, complete, & verifiable example](https://stackoverflow.com/help/mcve) of your dataframe, & explain what you expect to get based on that example. At the moment, it's not very clear whether the specific name value is unique at each time point, or what logic you want to use if there are multiple values. Also read [this post](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) for making reproducible examples in R. – Z.Lin Oct 01 '17 at 02:35
  • Thank you very much. I am also new to stack overflow, I will study and rephrase the question – Tiago Lubiana Oct 03 '17 at 21:20

0 Answers0