My dataset contains information such as feedbackDate
and Subcategory(issue) and location (6 months data). The temporal calculation was by cross tabulating the subcategory of issues with their feebackDate
s and then calculating Pearson correlation score for every pair of cross tabulated issues. See the code below
#weekly correlation
require(ISOweek)
datacfs_date$FeedbackWeek <- ISOweek(datacfs_date$FeedbackDate)
raw_timecor_matrix <- table(datacfs_date$SubCategory, datacfs_date$FeedbackWeek)
raw_timecor_matrix <- t(raw_timecor_matrix)
timecor_matrix <- cor(raw_timecor_matrix)
#Invert correlation to get distance matrix
inverse_tcc <- 1-timecor_matrix
Now the question is how do I calculate this on biweekly and monthly basis instead of weekly correlation of six months data.
Just make your labels, eg
datacfs_date$FeedbackMonth<-paste0(year(datacfs_date$FeedbackDate),"-M",month(datacfs_date$FeedbackDate))
datacfs_date$FeedbackBiWeek<-paste0(year(datacfs_date$FeedbackDate),"-W",(ceiling(week(datacfs_date$FeedbackDate)/2)*2)-1,":",(ceiling(week(datacfs_date$FeedbackDate)/2)*2))
and correlate on those
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.