Hello!
I need some help writing a script to find the most common value across several matrices. I have a data table with hundreds of rows. Each row has a sequence column (eg ABCDABCD) and I have created a column to show the positions of a certain letter within that sequence (eg The location of A is [1,5,0,0]).
(I am fairly new at writing scripts so right now my matrices have 0 listed when there are no more positions containing that letter. If there is an obvious, more efficient way to find multiple positions within a string, please let me know. Otherwise, is there a way to exclude 0 as one of the modes?)
I now would like to look at all the positions called out in all rows and find the most common positions.
What I have:
row matrix column
1 [2, 3, 6, 8, 0, 0]
2 [2, 4, 5, 10, 0, 0]
3 [2, 7, 9, 10, 0, 0]
What I want:
A list showing the modes in order of most occurrences to least
position 2 - 3 occurrences
position 10 - 2 occurrences
I attached the script I currently have that contains the position finding formula,
Thank you!