[R] unfurling rankings into a matrix of preferences

2015-07-27 Thread Dimitri Liakhovitski
I have 5 items in total (1:5), but I show a person only 4 items (1:4) and ask this person to rank items 1:4 in terms of preferences (1 is best, 2 is second best, 4 is worst), and I get a vector of ranks: ranks - c(2,4,3,1) # That means that this person liked item 4 best and item 2 worst. I would

Re: [R] unfurling rankings into a matrix of preferences

2015-07-27 Thread Bert Gunter
## I leave it to you to add the NA edges rk - c(2,4,3,1) outer(rk,rk,)+0 [,1] [,2] [,3] [,4] [1,]0110 [2,]0000 [3,]0100 [4,]1110 Cheers, Bert Bert Gunter Data is not information. Information is not knowledge. And

Re: [R] unfurling rankings into a matrix of preferences

2015-07-27 Thread Dimitri Liakhovitski
Wow! On Mon, Jul 27, 2015 at 5:28 PM, Bert Gunter bgunter.4...@gmail.com wrote: ## I leave it to you to add the NA edges rk - c(2,4,3,1) outer(rk,rk,)+0 [,1] [,2] [,3] [,4] [1,]0110 [2,]0000 [3,]0100 [4,]1110

Re: [R] unfurling rankings into a matrix of preferences

2015-07-27 Thread Dimitri Liakhovitski
With NAs it'd be: rk - c(2,NA,4,3,1, NA) outer(rk, rk, ) + 0 Wow, I still can't believe it - just one line! On Mon, Jul 27, 2015 at 5:31 PM, Dimitri Liakhovitski dimitri.liakhovit...@gmail.com wrote: Wow! On Mon, Jul 27, 2015 at 5:28 PM, Bert Gunter bgunter.4...@gmail.com wrote: ## I leave

Re: [R] unfurling rankings into a matrix of preferences

2015-07-27 Thread Bert Gunter
No it wouldn't. Presumably you have a typo and meant rk - c(2,4,3,1,NA) ## and set the (5,5) entry to 0 after -- Bert Bert Gunter Data is not information. Information is not knowledge. And knowledge is certainly not wisdom. -- Clifford Stoll On Mon, Jul 27, 2015 at 2:32 PM, Dimitri

Re: [R] unfurling rankings into a matrix of preferences

2015-07-27 Thread Dimitri Liakhovitski
Yes, correct, thank you, Bert! On Mon, Jul 27, 2015 at 5:46 PM, Bert Gunter bgunter.4...@gmail.com wrote: No it wouldn't. Presumably you have a typo and meant rk - c(2,4,3,1,NA) ## and set the (5,5) entry to 0 after -- Bert Bert Gunter Data is not information. Information is not