[R] R: Re: R: Re: Information Frequency problem calculation

arun smartpink111 at yahoo.com
Tue Oct 8 18:43:16 CEST 2013


Dear Jarod,

How about this?


a<- read.table(text="NAME1    NAME2    RNA
mauro    francesco    E234
luca    giuseppe    E5578
luca    franco    E5569
maria    luca    E4556
maria    mauro    E4556
luisa    mara    E4755
mara    luca    E234
luigi    veronica    E234
mauro    veronica    E235
francesco mauro      E236
mauro francesco  E234
luca   giuseppe  E5576",sep="",header=TRUE,stringsAsFactors=FALSE)
vec1<- as.character(interaction(a[,1:2],sep="_"))

cbind(freq=sapply(split(a,vec1),function(x) nrow(unique(x))))
#                freq
#francesco_mauro    1
#luca_franco        1
#luca_giuseppe      2
#luigi_veronica     1
#luisa_mara         1
#mara_luca          1
#maria_luca         1
#maria_mauro        1
#mauro_francesco    1
#mauro_veronica     1

A.K.


----- Original Message -----
From: "jarod_v6 at libero.it" <jarod_v6 at libero.it>
To: smartpink111 at yahoo.com
Cc: 
Sent: Tuesday, October 8, 2013 11:48 AM
Subject: R: Re: R: Re: [R] Information Frequency problem calculation

Dear Master, I want to count separate it is another category

>----Messaggio originale----
>Da: smartpink111 at yahoo.com
>Data: 08/10/2013 17.30
>A: "jarod_v6 at libero.it"<jarod_v6 at libero.it>
>Ogg: Re: R: Re: [R] Information Frequency problem calculation
>
>I have another doubt.  If you have "francesco- mauro" (francesco in 1st 
column and mauro in 2nd column) and the RNA category is say E238.  Would you 
count the sum of groups as 2 for "mauro-francesco" or do they count as 
separate?
>
>
>



More information about the R-help mailing list