Answers.Body: <p>Assuming you're trying to write R code, array references can use boolean values, and <code>in</code> is useful when you want to select from more than one value:</p>
  <pre><code>ccle_panc &lt;- ccle_dataset<span class="math-container">$data[ , ccle_dataset$</span>colAnnotation$SAMPLE_NAME %in% c(&quot;KP4&quot;, &quot;DC1&quot;, &quot;DC2&quot;)]
  </code></pre>
  <p>You can find more information about vector and array subsetting with boolean and numerical values here:</p>
  <p><a href="https://datacarpentry.org/R-ecology-lesson/01-intro-to-r.html#Subsetting_vectors" rel="nofollow noreferrer">https://datacarpentry.org/R-ecology-lesson/01-intro-to-r.html#Subsetting_vectors</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-03-03T23:03:54.887Z
Answers.LastActivityDate: 2022-03-03T23:03:54.887Z
Answers.UserDisplayName: gringer
Answers.Body: <p>Assuming that you have a dataframe/tibble situation; you can also use the tidyverse approach and the comment from @gringer:</p>
  <pre><code>ccle_dataset$data %&gt;%
  filter(SAMPLE_NAME %in% c(&quot;KP4&quot;, &quot;DC1&quot;, &quot;DC2&quot;))
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-03-04T11:16:54.463Z
Answers.LastActivityDate: 2022-03-04T11:16:54.463Z
Answers.UserDisplayName: flavinsky
Body: <p>I'm working with the CCLE dataset and I'm trying to subset the data to just 3 cell lines of interest but not sure how to it.</p>
  <p>Currently, I have been subsetting one by one but is there an easier way?</p>
  <pre><code>ccle_panc &lt;- ccle_dataset$data[ , ccle_dataset$colAnnotation$SAMPLE_NAME==&quot;KP4&quot;, &quot;&quot;, &quot;&quot;]
  </code></pre>
  
Tags: <r><rna-seq><subset>
Title: subsetting more than one ccle sample
ThreadText: # subsetting more than one ccle sample
  
  (Asked by: username_0 on 2022-03-03)
  
  I'm working with the CCLE dataset and I'm trying to subset the data to just 3 cell lines of interest but not sure how to it.
  
  Currently, I have been subsetting one by one but is there an easier way?
  
  ```
  ccle_panc <- ccle_dataset$data[ , ccle_dataset$colAnnotation$SAMPLE_NAME=="KP4", "", ""]
  
  ```
  
  **Tags:** r, rna-seq, subset
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2022-03-03. Score: 1 | Accepted answer
  
  Assuming you're trying to write R code, array references can use boolean values, and `in` is useful when you want to select from more than one value:
  
  ```
  ccle_panc <- ccle_dataset$data[ , ccle_dataset$colAnnotation$SAMPLE_NAME %in% c("KP4", "DC1", "DC2")]
  
  ```
  
  You can find more information about vector and array subsetting with boolean and numerical values here:
  
  <https://datacarpentry.org/R-ecology-lesson/01-intro-to-r.html#Subsetting_vectors>
  
  
  ---
  
  ### Answer by username_2 on 2022-03-04. Score: 0
  
  Assuming that you have a dataframe/tibble situation; you can also use the tidyverse approach and the comment from @username_1:
  
  ```
  ccle_dataset$data %>%
  filter(SAMPLE_NAME %in% c("KP4", "DC1", "DC2"))
  
  ```
  
  
  ---
  
  