Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201839

How to looping over a column and if pattern matches, count related characters in other columns using R?

$
0
0

0

I have a data frame (picture is attached) with 1000 rows and 21 columns which the first column is miRNA gene names and other columns show each nucleotide in each position: (picture attached)

What I want is to make a loop over the first column and if my character pattern gets matched in the column for example "Ami-Mir-489" (don't consider p1 and p2) then for each position (pos_1, pos_2, ..., pos_20) calculate the frequency of each nucleotide separately.

enter image description here


Viewing all articles
Browse latest Browse all 201839

Trending Articles