1

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 feebackDates 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.

Stedy
  • 7,359
  • 14
  • 57
  • 77
user3201733
  • 17
  • 1
  • 2
  • 7
  • Providing actual or sample data would increase your chances of getting an answer (you could give the results of `dput(datacfs_date)` or `dput(head(datacfs_date))`, as suggested [here](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). – Vincent Zoonekynd Jan 18 '14 at 06:45

1 Answers1

0

Just make your labels, e.g.

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

Troy
  • 8,581
  • 29
  • 32
  • if i want to calculate 3 days (correlation of 3 days,weekly,biweely,months) as well..how do i do that? – user3201733 Jan 19 '14 at 04:49
  • Getting an error message > datacfs_date$FeedbackMonth<-paste0(year(datacfs_date$FeedbackDate),"-M",month(datacfs_date$FeedbackDate)) Error in eval.with.vis(expr, envir, enclos) : could not find function "paste0" – user3201733 Jan 20 '14 at 09:09