Yung Chih Ou | 26 Dec 13:37 2012
Picon

data comparison

Dear all:

I have six vector from six DIF detection results.
as below:
> difMH[[100]]$DIFitems
 [1]  1  9 19 21 22 24 25 27 29 30 34 38 40
> difMH[[90]]$DIFitems
 [1]  1  2  9 14 18 19 21 22 25 28 30 34 38 39
> difMH[[80]]$DIFitems
 [1]  1  8  9 19 21 22 24 25 26 28 30 34 38
> difMH[[70]]$DIFitems
 [1]  1  8  9 10 16 18 21 22 25 28 30 32 34 38 39
> difMH[[60]]$DIFitems
 [1]  1  9 19 21 22 23 25 27 30 34 36 38 39
> difMH[[50]]$DIFitems
 [1]  1  9 10 11 17 18 21 22 23 25 28 30 34 38 39

I have two questions.

first, how to combine these to a matrix?

second, how to compare them with "1 9 21 22 25 30 34 38"
how much units hit?
how much units are false-alarm?

thanks!

Rui Barradas | 26 Dec 15:44 2012
Picon

Re: data comparison

Hello,

Try the following.

# 1.
idx <- seq(50, 100, by = 10)
mat <- matrix(difMH[idx]$DIFitems, ncol = length(idx))

# 2.
comp <- c(1, 9, 21, 22, 25, 30, 34, 38)
hit <- lapply(difMH[idx], function(x) length(intersect(x$DIFitems, comp)))
falarm <- lapply(difMH[idx], function(x) length(setdiff(x$DIFitems, comp)))

Hope this helps,

Rui Barradas
Em 26-12-2012 12:37, Yung Chih Ou escreveu:
> Dear all:
>
> I have six vector from six DIF detection results.
> as below:
>> difMH[[100]]$DIFitems
>   [1]  1  9 19 21 22 24 25 27 29 30 34 38 40
>> difMH[[90]]$DIFitems
>   [1]  1  2  9 14 18 19 21 22 25 28 30 34 38 39
>> difMH[[80]]$DIFitems
>   [1]  1  8  9 19 21 22 24 25 26 28 30 34 38
>> difMH[[70]]$DIFitems
>   [1]  1  8  9 10 16 18 21 22 25 28 30 32 34 38 39
>> difMH[[60]]$DIFitems
(Continue reading)

Rui Barradas | 26 Dec 15:53 2012
Picon

Re: data comparison

Hello,

Sorry, my previous post is wrong, to make of it a matrix use

do.call(cbind, lapply(idx, function(i) difMH[[i]]$DIFitems))

Hope this helps,

Rui Barradas
Em 26-12-2012 14:44, Rui Barradas escreveu:
> Hello,
>
> Try the following.
>
> # 1.
> idx <- seq(50, 100, by = 10)
> mat <- matrix(difMH[idx]$DIFitems, ncol = length(idx))
>
> # 2.
> comp <- c(1, 9, 21, 22, 25, 30, 34, 38)
> hit <- lapply(difMH[idx], function(x) length(intersect(x$DIFitems, 
> comp)))
> falarm <- lapply(difMH[idx], function(x) length(setdiff(x$DIFitems, 
> comp)))
>
>
> Hope this helps,
>
> Rui Barradas
> Em 26-12-2012 12:37, Yung Chih Ou escreveu:
(Continue reading)

arun | 26 Dec 18:01 2012
Picon

Re: data comparison

Hi,

Assuming the data structure is similar to this example:
 difMH<-list(c(1,9,19,21,22,24,25,27,29,30,34,38,40),c(1,2,9,14,18,19,21,22,25,28,30,34,38,39),c(1,8,9,19,21,22,24,25,26,28,30,34,38),c(1,8,9,10,16,18,21,22,25,28,30,32,34,38,39),c(1,9,19,21,22,23,25,27,30,34,36,38,39),c(1,9,10,11,17,18,21,22,23,25,28,34,38,39))
names(difMH)<-c(100,90,80,70,60,50)
 difMH<-lapply(difMH,function(x) data.frame(DIFitems=x,newcol=seq_along(x)))
res1<-sapply(difMH,`[`,1)
res2<-t(sapply(res1,`[`,1:max(sapply(res1,length))))

 res2
#             [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12]
#100.DIFitems    1    9   19   21   22   24   25   27   29    30   
34    38
#90.DIFitems     1    2    9   14   18   19   21   22   25    28   
30    34
#80.DIFitems     1    8    9   19   21   22   24   25   26    28   
30    34
#70.DIFitems     1    8    9   10   16   18   21   22   25    28   
30    32
#60.DIFitems     1    9   19   21   22   23   25   27   30    34   
36    38
#50.DIFitems     1    9   10   11   17   18   21   22   23    25   
28    34
  #           [,13] [,14] [,15]
#100.DIFitems    40    NA    NA
#90.DIFitems     38    39    NA
#80.DIFitems     38    NA    NA
#70.DIFitems     34    38    39
#60.DIFitems     39    NA    NA
#50.DIFitems     38    39    NA
(Continue reading)


Gmane