Hi All, Iâm trying to evaluate the frequency of different strings in each row of a data.frame : INPUT: ID G1 G2 G3 G4 ⦠GN 1 AA BB AB AB ⦠2 BB AB AB AA ⦠3 AC CC AC AA ⦠4 BB BB BB BBâ¦
The number of different strings can vary in each row. My solution has been: for (i in 1:length(INPUT[,1])){ b=as.data.frame(table(t((INPUT[i,2:5])))) <some operations using the string values and frequencies> (e.g. b for i==1 is: AA 1 BB 1 AB 2 ) } However my dataframe contains thousands rows and this script takes a lot of time. Could someone suggest me a faster way? Thank you very much, Mario Falchi [[alternative HTML version deleted]]
______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.