Guest User

Untitled

a guest
Dec 17th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.98 KB | None | 0 0
  1. sapply(1:nrow(aux),function(x){
  2. r=which(M$Project==aux$Projecte[x] & M$Product==aux$Producte[x])
  3. c=which(names(M)==aux$Atribut[x])
  4. l=aux$meanss[x]
  5. M[r,c]<<-l
  6. })
  7.  
  8. no_cores <- detectCores()-2
  9. cl <- makeCluster(no_cores)
  10. clusterExport(cl,c("aux","M"))
  11. parSapply(cl,1:20,function(x){
  12. r=which(M$Project==aux$Projecte[x] & M$Product==aux$Producte[x])
  13. c=which(names(M)==aux$Atribut[x])
  14. l=aux$meanss[x]
  15. M[r,c]<<-l
  16. })
  17.  
  18. structure(list(Project = c("11I040119", "11I040119", "11I040119",
  19. "11I040119", "11I040119", "11I040119", "11I040119", "11I040119",
  20. "11I040119", "11I040119", "11I040119", "11I040119", "11I040119"
  21. ), Product = c("Brulerie St. Denis (BOLD)", "Ethical Beans (BOLD)",
  22. "Folgers (BOLD)", "Illy drip coffe (BOLD)", "Illy Espresso Coffee (BOLD)",
  23. "Just Us (BOLD)", "Lavazza caffè espresso (BOLD)", "Lavazza Crema e gusto (BOLD)",
  24. "Lavazza Tierra (BOLD)", "Medaglia d'Oro (BOLD)", "Seattle Best 4 (BOLD)",
  25. "Starbucks café Verona (BOLD)", "Tully's (BOLD)"), Thing1 = c(0,
  26. 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), Thing2 = c(0, 0, 0, 0, 0,
  27. 0, 0, 0, 0, 0, 0, 0, 0)), row.names = c(NA, 13L), class = "data.frame")
  28.  
  29. structure(list(Projecte = c("11I040119", "11I040119", "11I040119",
  30. "11I040119", "11I040119", "11I040119", "11I040119", "11I040119",
  31. "11I040119", "11I040119", "11I040119", "11I040119", "11I040119",
  32. "11I040119", "11I040119"), Producte = c("Brulerie St. Denis (BOLD)",
  33. "Ethical Beans (BOLD)", "Folgers (BOLD)", "Illy drip coffe (BOLD)",
  34. "Illy Espresso Coffee (BOLD)", "Just Us (BOLD)", "Lavazza caffè espresso (BOLD)",
  35. "Lavazza Crema e gusto (BOLD)", "Lavazza Tierra (BOLD)", "Medaglia d'Oro (BOLD)",
  36. "Seattle Best 4 (BOLD)", "Starbucks café Verona (BOLD)", "Tully's (BOLD)",
  37. "Brulerie St. Denis (BOLD)", "Ethical Beans (BOLD)"), Thing = c("Thing1",
  38. "Thing1", "Thing1", "Thing1", "Thing1", "Thing1", "Thing1", "Thing1",
  39. "Thing1", "Thing1", "Thing1", "Thing1", "Thing1", "Thing2", "Thing2"
  40. ), Value = c(0.142857142857143, 0.242857141154153, 0.614285715988704,
  41. 0, 0, 0.0714285714285714, 1.01428570917674, 0, 0.971428564616612,
  42. 0.5, 0.357142857142857, 0.642857142857143, 0.714285714285714,
  43. 3, 5)), row.names = c(NA, 15L), class = "data.frame")
  44.  
  45. Project Product Thing1 Thing2
  46. 1 11I040119 Brulerie St. Denis (BOLD) 0.14285714 3
  47. 2 11I040119 Ethical Beans (BOLD) 0.24285714 5
  48. 3 11I040119 Folgers (BOLD) 0.61428572 0
  49. 4 11I040119 Illy drip coffe (BOLD) 0.00000000 0
  50. 5 11I040119 Illy Espresso Coffee (BOLD) 0.00000000 0
  51. 6 11I040119 Just Us (BOLD) 0.07142857 0
  52. 7 11I040119 Lavazza caffè espresso (BOLD) 1.01428571 0
  53. 8 11I040119 Lavazza Crema e gusto (BOLD) 0.00000000 0
  54. 9 11I040119 Lavazza Tierra (BOLD) 0.97142856 0
  55. 10 11I040119 Medaglia d'Oro (BOLD) 0.50000000 0
  56. 11 11I040119 Seattle Best 4 (BOLD) 0.35714286 0
  57. 12 11I040119 Starbucks café Verona (BOLD) 0.64285714 0
  58. 13 11I040119 Tully's (BOLD) 0.71428571 0
Add Comment
Please, Sign In to add comment