Error in correlation with interaction in R

this is my dataset: Variable_1 <- c(3, 5, 6, 9, 12) Variable_2 <- c(5, 5, 7, 6, 10) Variable_3 <- c(0, 1, 3, 3, 5) Variable_4 <- c(6, 7, 5, 10, 10) X <- data.frame(Variable_1, Variable_2, Variable_3, Variable_4) I want to calculate the pairwise correlation of these variables, with interaction with a new variable (x).… Read More Error in correlation with interaction in R

model.matrix works for "month" column of df but gives unexpected output for "week" column

I am trying to construct a model matrix using model.matrix. Here’s my data, stored as a data frame called wILI: date value week month year 1997-10-01 0.002734167 1 10 1997 1997-10-08 0.003612784 2 10 1997 1997-10-15 0.004757731 3 10 1997 1997-10-22 0.006238000 4 10 1997 1997-10-29 0.008132015 5 10 1997 1997-11-05 0.010522688 6 11 1997… Read More model.matrix works for "month" column of df but gives unexpected output for "week" column