Note that there are some explanatory texts on larger screens.

plurals
  1. POComparing two columns "by the sequence" and making new column
    primarykey
    data
    text
    <p>The problem is really hard to explain but let me tell you what I want to get from this data. So, I have a data with like 20 different columns and two of them are already showed here.</p> <pre><code>Sequence modifications AAAAGAAAVANQGKK [14] Acetyl (K)|[15] Acetyl (K) AAAAGAAAVANQGKK [14] Acetyl (K)|[15] Acetyl (K) AAIKFIKFINPKINDGE [4] Acetyl (K)|[7] Acetyl (K)|[12] Acetyl (K) AAIKFIKFINPKINDGE [4] Acetyl (K)|[7] Acetyl (K)|[12] Acetyl (K) AAIKFIKFINPKINDGE [7] Acetyl (K)|[12] Acetyl (K) AAIKFIKFINPKINDGE [4] Acetyl (K)|[7] Acetyl (K) AAIYKLLKSHFRNE [5] Biotin (K)|[8] Acetyl (K) AAKKFEE [3] Acetyl (K)|[4] Acetyl (K) </code></pre> <p>As you see in the same sequence there can be a different modifications. Sometimes there can be 3x Acetyl, simetimes 2x acetyl, sometimes only once and in other case there won't be any modification. There are only 2 modifications I am interested in "Biotin and Acetyl", others are not important. The numbers of modifications is dependent on the number of "K" in the sequence. For example if there are 3 "K" in the sequence the numbers of possible modifications i 0, 1, 2, 3 and never more than 3. So I would like to group those sequences (1000 rows) depending on the number of "K" in the sequence and the number and type of the modification which it has without smashing the other columns. </p> <p>What I want to get from this data by R, it's a different groups of the sequences with specified modification. For example:</p> <pre><code>First Group: (number of "K" in the sequence = 2, and both modified by acetyl) Sequence modifications AAAAGAAAVANQGKK [14] Acetyl (K)|[15] Acetyl (K) AAIYKLLKSHFRNE [5] Acetyl (K)|[8] Acetyl (K) Second Group: (number of "K" in the sequence = 2, and one modified by acetyl, second nothing) Third Group: (number of "K" in the sequence = 3, and one modified by acetyl, second acetyl, and last is biotin) </code></pre> <p>I have to include all of the possiblities. That's what I think would be best on this "part" of the script which I am trying to write. Maybe you have any other suggestions how to interprate that data.</p> <p>Second problem is that: I calculated the mean of the values in 3 different columns and I would like to put the result in the same data but in another column. How to do that ?</p> <pre><code>tbl_imp$mean &lt;- rowMeans(subset(tbl_imp, select = c("x", "y", "w")), na.rm = TRUE) tbl_imp$mean &lt;- data.frame(tbl_imp$mean) </code></pre> <p>The code I used to calculate the means of the rows. I just don't know how to make a new column in the data I have and put there my results of mean. ?transform function should I use ?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload