fork download
  1. library(magrittr)
  2.  
  3. p.combination = character(1000)
  4. for(i in 1:length(p.combination)){
  5. p.combination[i] = LETTERS[sample(1:26,5)] %>% paste0(collapse = ", ")
  6. }
  7.  
  8. p.com.allowed = character(1000)
  9. for(i in 1:length(p.com.allowed)){
  10. p.com.allowed[i] = LETTERS[sample(1:26,5)] %>% paste0(collapse = ", ")
  11. }
  12.  
  13. data = data.frame(p.combination = p.combination,
  14. p.com.allowed = p.com.allowed)
  15. player = LETTERS[1:26]
  16.  
  17.  
  18.  
  19. input.matrix0 = function(data, player, off){
  20. X = matrix(ncol = length(player), nrow = dim(data)[1])
  21. for(i in 1:dim(data)[1]){
  22. if(off) {
  23. colnames(X) = paste0("O_",player)
  24. coding = 1
  25. pp = data$p.combination
  26. } else {
  27. colnames(X) = paste0("D_",player)
  28. coding = -1
  29. pp = data$p.com.allowed
  30. }
  31. player.temp = pp[i] %>% gsub(", ", "|",.)
  32. index = grep(player.temp, player)
  33. X[i,index] = coding
  34. X[i,-index] = 0
  35. }
  36. return(X)
  37. }
  38.  
  39. input.matrix = function(data, player){
  40. X.off = input.matrix0(data, player, T)
  41. X.def = input.matrix0(data, player, F)
  42. return(cbind(X.off, X.def))
  43. }
  44.  
  45.  
  46.  
  47.  
  48. out = input.matrix(data,player)
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:1: error: class, interface, or enum expected
library(magrittr)
^
1 error
stdout
Standard output is empty