Let's say I have the following data.frame that associates the package name R with the CRAN task view that belongs to:
dictionary <- data.frame(task.view = c(rep("High.Performance.Computing", 3), rep("Machine.Learning", 3)), package = c("Rcpp", "HadoopStreaming", "rJava", "e1071", "nnet", "RWeka"))
Then I count the number of times each package is called from one of four tools written by the student:
package.referals <- data.frame(Rcpp = c(1, 0, 1, 1), HadoopStreaming = c(1, 0, 0, 0), rJava = c(1, 0, 0, 1), e1071 = c(1, 1, 1, 1), nnet = c(1, 0, 0, 0), RWeka = c(1, 0, 0, 1), row.names = paste("student pkg", 1:4)) # Rcpp HadoopStreaming rJava e1071 nnet RWeka # student pkg 1 1 1 1 1 1 1 # student pkg 2 0 0 0 1 0 0 # student pkg 3 1 0 0 1 0 0 # student pkg 4 1 0 1 1 0 1
How can I restructure the columns of my package.referals data.frame above based on my data.frame package task view relationships?
eg. I would like the result to be
data.frame(High.Performance.Computing = c(3, 0, 1, 2), Machine.Learning = c(3, 1, 1, 2), row.names = paste("student pkg", 1:4))
I tried the following, but I got stuck when trying to restructure it into the output file that I would like (summation and transfer):
require(data.table)