I’m struggling a lot right now and it would be great if someone could help me to fix the problem for my master thesis.
I have a huge data frame because heart rates were measured by seconds.
- I have 4 timepoints (timepoint 0, timepoint 1, timepoint 2 and timepoint 3).
- Timepoint 1 to 3 consist of 661 rows each (661 seconds per timepoint).
- Timepoint 0 only refers to one row, but the problem is that it starts with second 1 instead of second 0.
What I want is, that timepoint 0 shows second 0 and timepoint 1 shows second 1 and so on.
For better understanding, here are two tables showing the old version and the desired version I’d like to have (not in excel but in r studio):
Atm I’m only able to replace the TS_0 = 1 with TS_0 = 0 for timepoint 0 but I cannot change every row manually afterwards by using
df$TS_0[df$TS_0 == 1] <- 0, df$TS_0[df$TS_0 == 2] <- 1 and so on…
My question is, is there anyway to change TS_0 = 1 to 0 with timepoint = 0 so that all the following rows change automatically?
I appreciate any help! Thank you 🙂
Read more here: Source link