Answers.Body: <p>You will need to &quot;read&quot; your data. There are packages that can read Excel files directly but I would save the data as csv first and then use <code>read.csv()</code>. The following would create a new column with your desired output:</p>
  <pre><code>data_frame<span class="math-container">$new_col &lt;- substring(data_frame$</span>col_with_seqs, 1, 20)
  </code></pre>
  <p>Alternatively you can just use Excel's <code>LEFT()</code> since your data is already in Excel:</p>
  <pre><code>=LEFT(A1, 20)
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-28T18:54:17.443Z
Answers.LastActivityDate: 2022-11-28T18:54:17.443Z
Answers.UserDisplayName: haci
Body: <p>I have an Excel sheet from the CRISPR library where I have sequences of gRNAs (with 30 nucleotides) in a column and I only need to keep the first 20 nucleotides for those gRNAs and delete the rest nucleotides. The column has 1000 rows that have 30 nucleotide gRNA sequences. How can I delete extra nucleotides using R</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-11-27T11:44:29.657Z
Comments.Text: Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
Comments.UserDisplayName: Community
Tags: <r><scrnaseq><bioconductor><crispr>
Title: Keep first 20 nucleotides of sequences using R
ThreadText: # Keep first 20 nucleotides of sequences using R
  
  (Asked by: username_0 on 2022-11-27)
  
  I have an Excel sheet from the CRISPR library where I have sequences of gRNAs (with 30 nucleotides) in a column and I only need to keep the first 20 nucleotides for those gRNAs and delete the rest nucleotides. The column has 1000 rows that have 30 nucleotide gRNA sequences. How can I delete extra nucleotides using R
  
  **Tags:** r, scrnaseq, bioconductor, crispr
  
  > **Comments:**
  > **username_1**: Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2022-11-28. Score: 2
  
  You will need to "read" your data. There are packages that can read Excel files directly but I would save the data as csv first and then use `read.csv()`. The following would create a new column with your desired output:
  
  ```
  data_frame$new_col <- substring(data_frame$col_with_seqs, 1, 20)
  
  ```
  
  Alternatively you can just use Excel's `LEFT()` since your data is already in Excel:
  
  ```
  =LEFT(A1, 20)
  
  ```
  
  
  ---
  
  