I have a dataframe, that contains e.g. 5 rows and 3 columns:
I would like to select those rows, which contains for example text yellow (rows 1 and 4)?
I have a dataframe, that contains e.g. 5 rows and 3 columns:
I would like to select those rows, which contains for example text yellow (rows 1 and 4)?
Use the following to select rows that contain "yellow" in any column:
library(tidyverse)
result <- mydata %>%
filter_all(any_vars(. == "yellow"))
A base R option using subset
+ rowSums
subset(df,rowSums(df=="yellow")>0)