我的数据集包含如feedbackDate
和子类别(问题)和位置(6个月数据)等信息。时间计算是通过将问题的子类别与其feebackDate
进行交叉列表,然后计算每对交叉列表问题的Pearson相关分数。见下面R相关分数计算
#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
代码现在的问题是我如何计算这个上每两周或每月的,而不是6点月的数据每周的相关性。
提供实际或样本数据会增加你获得一个答案 的机会相关(你可以给dput的'结果(datacfs_date)'或'dput(头(datacfs_date)) ', 所建议[这里](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example)。 –