[R] Calculating frequencies of multiple values in 200 colomns
Allaisone 1
allaisone1 at hotmail.com
Thu Nov 9 20:44:15 CET 2017
Hi All
I have a dataset of 200 columns and 1000 rows , there are 3 repeated values under each column (7,8,10). I wanted to calculate the frequency of each value under each column and then apply the function maf () given that the frequency of each value is known. I can do the analysis step by step like this :-
> Values
A B C ... 200
1 7 10 7
2 7 8 7
3 10 8 7
4 8 7 10
.
.
.
1000
For column A : I calculate the frequency for the 3 values as follows :
count7 <- length(which(Values$A == 7))
count8 <- length(which(Values$A == 8))
count10 <- length(which(Values$A == 10))
count7 = 2, count8 = 1 , count10= 1.
Then, I create a vector and type the frequencies manually :
Freq<- c( count7=2 ,count8= 1,count10=1)
Then I apply the function maf () :-
maf(Freq)
This gives me the result I need for column A , could you please help me
to perform the analysis for all of the 200 columns at once ?
Regards
Allahisone
[[alternative HTML version deleted]]
More information about the R-help
mailing list