Here is a version using the base function reshape
:
y <- reshape(x, direction="wide", v.names="time", timevar="cores",
idvar="models")
with the output
models time.1 time.2 time.3 time.4
1 4 0.000365 0.000259 0.000239 0.000220
5 8 0.000259 0.000249 0.000251 0.000258
With the hard work of reshaping done, you can extract the part you want:
res <- data.matrix(subset(y, select=-models))
rownames(res) <- y$models
colnames(res) <- substr(colnames(res),6,7)
And you get the matrix:
1 2 3 4
4 0.000365 0.000259 0.000239 0.000220
8 0.000259 0.000249 0.000251 0.000258