Given an R data frame with the fallowing variables: ID, DATE and RATING.
'''
data<-data.frame(ID=c(1,1,1,2,3,4),DATE=c('2019-01-01','2019-02-01','2019-03-01','2019-02-01','2019-02-01','2019-02-01'),RATING=c('A','B','C','B','B','C'))
'''
How can I obtain the new.data object as a matrix or data.frame? The rownames of the new.data are related to variable ID within the data's object.