I have a data.frame of unknown length with recordings of SkinTemp for different people (id). I would like to create a vector with time stamps (1/32s) for each id. I don't know how long each recording is.
df<-data.frame(
SkinTemp=rnorm(65,37,0.5),
id=rep(1:10,c(5,4,10,6,7,8,9,8,4,4)))
edit:
I have worked out how to do it using rle by adapting this answer Numbering rows within groups in a data frame
df$Time <- sequence(rle(as.character(df$id))$lengths)/32
edit 2:
I have realised this does not work exactly as it starts from 1/32 instead of 0. The dplyr answer using (row_number -1)/32 works better.