Question: I was wondering if anyone knows how I could keep rows that only have values <0.01 within a specific column with commas separating the values?

For instance

```
V1 V2 V3 V4 
A B C D 0.02,0.0001,0.03,0.15
D E F G 0.05
S E G A 0.02,0.01
A B C D 0.001,0.05,0.3

```

And I would keep only the columns where V4 is < 0.01 in any of the comma separated values.

```
A B C D 0.02,0.0001,0.03,0.15
A B C D 0.001,0.05,0.3

```

I appreciate the help!

Answer: 
An option with `base R` involves splitting the 'V4' by `,`, convert to numeric and check if `any` value less than 0.01 and then use that as index for subsetting

```
df1[sapply(strsplit(df1$V4, ","), function(x) any(as.numeric(x) < 0.01)),]

```
Here is a way to get values in `X` column in separate rows, select only those rows where there is atleast one value less than 0.01 and combine them together.

```
library(dplyr)

df %>%
  mutate(row = row_number()) %>%
  tidyr::separate_rows(X, sep = ",", convert = TRUE) %>%
  group_by(row) %>%
  filter(any(X < 0.01)) %>%
  group_by(V1, V2, V3, V4, .add = TRUE) %>%
  #Or a bit simpler
  #group_by(across(V1:V4), .add = TRUE) %>%
  summarise(X = toString(X)) %>%
  ungroup %>%
  select(-row)

#   V1    V2    V3    V4    X                       
#  <chr> <chr> <chr> <chr> <chr>                   
#1 A     B     C     D     0.02, 0.0001, 0.03, 0.15
#2 A     B     C     D     0.001, 0.05, 0.3     

```