How to delete rows of R dataframe based on string match? Last Updated : 26 Apr, 2022 Summarize Comments Improve Suggest changes Share Like Article Like Report In this article, we will discuss how to delete rows of a dataframe based on string match in R Programming Language. For this grep() function can be used. This function searches for matches of certain character patterns in a vector of character strings and returns a boolean value as TRUE if that string is present else it returns FALSE. Syntax: grepl(pattern, string, ignore.case=FALSE) Parameter: pattern: regular expressions patternstring: character vector to be searched First with the help of grepl() we have obtained the rows which consist of specified substrings in it. Then with Not operator(!) we have removed those rows in our data frame and stored them in another data frame. Data frame in use: Data frame Example 1: R Strings<-c("Geeks","For","Geeks","GFG","Ram", "Ramesh","Gene","Siri") Id<-1:8 # df is our data frame name df<-data.frame(Id,Strings) print(df) # Removes the rows in Data frame # which consist "Ra" in it new_df=df[!grepl("Ra",df$Strings),] print(new_df) Output: Example 2: R Strings<-c("Geeks","For","Geeks","GFG","Ram", "Ramesh","Gene","Siri") Id<-1:8 # df is our data frame name df<-data.frame(Id,Strings) print(df) # Removes the rows in Data frame # which consist "Ge" in it new_df=df[!grepl("Ge",df$Strings),] print(new_df) Output: Comment More infoAdvertise with us Next Article Select Rows with Partial String Match in R DataFrame C code_blooded7 Follow Improve Article Tags : R Language R Programs R-DataFrame R DataFrame-Programs Similar Reads How to Delete Row(s) in R DataFrame ? In this article, we will see how row(s) can be deleted from a Dataframe in R Programming Language. Deleting a single row For this, the index of the row to be deleted is passed with a minus sign. Syntax: df[-(index), ] Example 1 :Â R # creating a data frame with # some data . df=data.frame(id=c(1,2,3 2 min read Extract rows from R DataFrame based on factors In this article, we will discuss how to extract rows from dataframe based on factors in R Programming Language. Method 1: Using indexing methods The data frame column can be accessed using its name (df$col-name) or by its index (df[[ col-indx ]]) to access a particular column. The data frame columns 3 min read Select Rows with Partial String Match in R DataFrame In this article, weâll discuss how to select rows with a partial string match in the R programming language. Method 1: Using stringr package The stringr package in R language is used mainly for character manipulations, locale-sensitive operations, altering whitespace, and Pattern-matching. Here we w 2 min read How to assign column names based on existing row in R DataFrame ? In this article, we will discuss how assign column names or headers to a DataFrame based on rows in R Programming Language. Method 1 : Using as.character() method unlist() method in R is used to simulate the conversion of a list to vector. It simplifies to produce a vector by preserving all componen 3 min read How to Remove Duplicate Rows in R DataFrame? In this article, we will discuss how to remove duplicate rows in dataframe in R programming language. Dataset in use:Method 1: Using distinct() This method is available in dplyr package which is used to get the unique rows from the dataframe. We can remove rows from the entire which are duplicates a 2 min read Select rows from a DataFrame based on values in a vector in R In this article, we will discuss how to select rows from a DataFrame based on values in a vector in R Programming Language. Method 1: Using %in% operator %in% operator in R, is used to identify if an element belongs to a vector or Dataframe. It is used to perform a selection of the elements satisfyi 5 min read Like