Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dat <- matrix(runif(50),nrow=10)
- rownames(dat) <- 10:1
- colnames(dat) <- 1:5
- dat
- 1 2 3 4 5
- 10 0.93428302 0.2637368 0.91326265 0.20931505 0.25215862
- 9 0.01458229 0.1401547 0.25761699 0.08444877 0.04543594
- 8 0.98966030 0.4418174 0.78787133 0.36977319 0.85497134
- 7 0.54360750 0.4014348 0.48607126 0.08431677 0.95499422
- 6 0.39402458 0.6774917 0.07525122 0.80501739 0.34954356
- 5 0.74283503 0.6652231 0.45576364 0.52726500 0.49623084
- 4 0.44952924 0.7003085 0.98825235 0.46539233 0.23546417
- 3 0.32351304 0.5867900 0.65499386 0.53018068 0.45590061
- 2 0.63876290 0.5140422 0.79265134 0.63175354 0.28500796
- 1 0.01185476 0.1773445 0.55828598 0.43911265 0.18718190
- xx <- sample(1:10,10,replace=FALSE)
- yy <- sample(1:5,10,replace=TRUE)
- zz <- 10:1
- n.dat <- cbind(xx,yy,zz)
- n.dat <- as.data.frame(n.dat)
- xx yy zz
- 1 5 3 10
- 2 10 4 9
- 3 1 3 8
- 4 8 5 7
- 5 7 2 6
- 6 6 1 5
- 7 2 4 4
- 8 9 2 3
- 9 3 5 2
- 10 4 1 1
- val <- daply(subset(n.dat,xx %in% n.dat$xx),"c",
- function(x) {
- d1=x$xx
- d2=x$yy
- res_tab_R["d1","d2"]
- } )
- 0.4558, 0.2093, and so on.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement