How to remove inconsistencies from dataframe (time series)
问题 Let's say that we have this dataframe: x<- as.data.frame(cbind(c("A","A","A","B","B","B","B","B","C","C","C","C","C","D","D","D","D","D"), c(1,2,3,1,2,3,2,3,1,2,3,4,5,1,2,3,4,5), c(10,12.5,15,2,3.4,5.7,8,9.5,1,5.6,8.9,10,11,2,3.4,6,8,10.5), c(1,3,4,1,2,3,4,3,2,2,3,5,2,3,5,4,5,5))) colnames(x)<- c("ID", "Visit", "Time", "State") Column ID indicates subject ID. Column Visit indicates a series of visits Column Time indicates the time that has passed to reach a certain "State" Column State