<p>For working with a relatively small dataset in tabular format, I would recommend <a href="https://cran.r-project.org/web/packages/dplyr/vignettes/dplyr.html" rel="nofollow noreferrer">dplyr</a>. You can read in a <code>excel</code> file using <a href="https://readxl.tidyverse.org" rel="nofollow noreferrer">readxl</a></p>

<pre><code>library(readxl)
library(dplyr)

df &lt;- read_excel(FILENAME)
</code></pre>

<p>To get the number of mutations per gene:</p>

<pre><code>df %&gt;% group_by(`Gene name`) %&gt;%
  summarise(num_mutations=n())
</code></pre>

<p>If you want to know if there are mutations in a particular gene:</p>

<pre><code>df %&gt;% filter(`Gene name` == QUERY)
</code></pre>

CC BY-SA 4.0
2018-05-18T11:20:09.763Z
2018-05-18T11:20:09.763Z
heathobrien
<p>I have a table with information about SNPs, the table has a total of 55127 rows.</p>

<p>How can I know the number of gene mutations in the table and if a gene is present?</p>

<p>The table is in xls format.</p>

<p><a href="https://i.sstatic.net/MfFs4.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/MfFs4.png" alt="enter image description here"></a></p>

CC BY-SA 4.0
2018-05-18T10:01:12.200Z
Hi Sofia, recommend  a package for **what**? Could you [edit] the question and explain what is your goal? Also I assume you mean SNP or what is a SNIP? As a side note all post are already signed with the account of the creator, please do not sign them in the body of the post.
llrs
CC BY-SA 4.0
2018-05-18T10:23:16.813Z
Thanks for the edits, but the main question stills remain. What is your goal, what do you want to do with this data? Do you have a question in mind, a disease, a problem, a treatment? Could you be more clear on this regard, otherwise is too unclear to try an answer
llrs
CC BY-SA 4.0
2018-05-18T10:26:39.350Z
thanks for the answer, i want to know the number of gene mutations. and to know if a certain gene is in the table.
Sofia
CC BY-SA 4.0
2018-05-18T10:33:10.563Z
It would be helpful to know the format of the data and the file size. Can you post an example of what the data look like.
heathobrien
CC BY-SA 4.0
2018-05-18T10:56:43.587Z
Please [edit] your question and explain exactly what you are trying to do. What output do you need? Do you want a list of SNPs per gene? A list of genes in the file? None of these need to be done in R (nor is R particularly well suited for this sort of simple text parsing), do you _need_ R? Also, what operating system are you using? We need to know that to know what tools you have easily available. Finally, what format is the file in? Is that an excel file? A csv? Tab separated? Space separated?
terdon
<r><snp><mutations>
how to do analysis of a table content SNP?
# how to do analysis of a table content SNP?

(Asked by: username_0 on 2018-05-18)

I have a table with information about SNPs, the table has a total of 55127 rows.

How can I know the number of gene mutations in the table and if a gene is present?

The table is in xls format.

[![enter image description here](https://i.sstatic.net/MfFs4.png)](https://i.sstatic.net/MfFs4.png)

**Tags:** r, snp, mutations
> **Comments:**
> **username_1**: Hi Sofia, recommend  a package for **what**? Could you [edit] the question and explain what is your goal? Also I assume you mean SNP or what is a SNIP? As a side note all post are already signed with the account of the creator, please do not sign them in the body of the post.  
> **username_1**: Thanks for the edits, but the main question stills remain. What is your goal, what do you want to do with this data? Do you have a question in mind, a disease, a problem, a treatment? Could you be more clear on this regard, otherwise is too unclear to try an answer  
> **username_0**: thanks for the answer, i want to know the number of gene mutations. and to know if a certain gene is in the table.  
> **username_2**: It would be helpful to know the format of the data and the file size. Can you post an example of what the data look like.  
> **username_3**: Please [edit] your question and explain exactly what you are trying to do. What output do you need? Do you want a list of SNPs per gene? A list of genes in the file? None of these need to be done in R (nor is R particularly well suited for this sort of simple text parsing), do you _need_ R? Also, what operating system are you using? We need to know that to know what tools you have easily available. Finally, what format is the file in? Is that an excel file? A csv? Tab separated? Space separated?  

---

## 1 answers

### Answer by username_2 on 2018-05-18. Score: 1

For working with a relatively small dataset in tabular format, I would recommend dplyr. You can read in a excel file using readxl
library(readxl)
library(dplyr)

df <- read_excel(FILENAME)

To get the number of mutations per gene:
df %>% group_by(`Gene name`) %>%
  summarise(num_mutations=n())

If you want to know if there are mutations in a particular gene:
df %>% filter(`Gene name` == QUERY)


---

