The complete project code is as follows:
set.seed(100)products <- c('A','B','C','D','E','F','G')user.a <- c( 3, 0, 2, 5, 5, 0,1)user.b <- c( 3, 5, 3, 5, 4, 2, 1)ratings.matrix <- as.data.frame(list(user.a,user.b))names(ratings.matrix) <- c("user.a","user.b")rownames(ratings.matrix) <- productshead(ratings.matrix)products <- c('A','B','C')user.a <- c(2,0,3)user.b <- c(5,2,0)user.c <- c(3,3,0)ratings.matrix <- as.data.frame(list(user.a,user.b, user.c))names(ratings.matrix) <- c("user.a","user.b","user.c")rownames(ratings.matrix) <- productshead(ratings.matrix)ratings.mat <- (as.matrix(ratings.matrix))sim.mat <- cor(t(ratings.mat), method = "Pearson")sim.matsvd.coms <- svd(ratings.mat)user.a.vector <- svd.coms$u[1,]product.B.vector ...