create a new column in R, using timepoints corresponding to a rating in another column.
Tidyverse solution:
install.packages("dplyr", dependencies = TRUE)
library(dplyr)
dataframe.df %>%
as.data.frame() %>%
mutate(Timepoint = as.numeric(gsub("[a-zA-Z]+", "", Timepoint))) %>%
group_by(Replicate, Stimulus, Subject) %>%
mutate(start_end_time = ifelse(Timepoint != max(Timepoint), min(Timepoint), max(Timepoint))) %>%
ungroup()