Remove Multiple Values from Vector in R Last Updated : 31 Aug, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report In this article, we are going to discuss how to remove multiple values from the vector in R Programming Language. We are going to remove multiple values using %in% operator Syntax: vector <- vector[! vector %in% c(elements)] where, vector is the input vectorelements is the values to be removed%in% operator checks the vector elements are present in the actual vector Example 1: R program to remove multiple values from the vector R # create a vector a=c(1,2,"Sravan",4,5,"Bobby",4,5,6,"Ojaswi","Rohith",56.0) # display a print(a) # Remove multiple values a <- a[! a %in% c("Sravan",4,6, "Rohith")] print("---------") # display a print(a) Output: [1] "1" "2" "Sravan" "4" "5" "Bobby" "4" "5" [9] "6" "Ojaswi" "Rohith" "56" [1] "---------" [1] "1" "2" "5" "Bobby" "5" "Ojaswi" "56" Example 2: R program to remove multiple values from the vector R # create a vector a=c(1,2,"Sravan",4,5,"Bobby",4,5,6,"Ojaswi","Rohith",56.0) # display a print(a) # Remove multiple values a <- a[! a %in% c("Sravan",1,2)] print("---------") # display a print(a) Output: [1] "1" "2" "Sravan" "4" "5" "Bobby" "4" "5" [9] "6" "Ojaswi" "Rohith" "56" [1] "---------" [1] "4" "5" "Bobby" "4" "5" "6" "Ojaswi" "Rohith" [9] "56" Comment More infoAdvertise with us Next Article List distinct values in a vector in R G gottumukkalabobby Follow Improve Article Tags : R Language R Programs R-Vectors R Vector-Programs Similar Reads Remove NA Values from Vector in R In this article, we are going to discuss how to remove NA values from the vector. Method 1: Using is.na() We can remove those NA values from the vector by using is.na(). is.na() is used to get the na values based on the vector index. !is.na() will get the values except na. Syntax: vector[!is.na(vect 2 min read Substitute DataFrame Row Names by Values in Vector in R In this article, we will discuss how to substitute dataframe row names by values in a vector in R programming language. Dataframe in use: We can substitute row names by using rownames() function Syntax: rownames(dataframe) <- vector where, dataframe is the input dataframevector is the new row val 2 min read List distinct values in a vector in R In this article, we will discuss how to display distinct values in a vector in R Programming Language. Method 1: Using unique() For this, the vector from which distinct elements are to be extracted is passed to the unique() function. The result will give all distinct values in a vector. Syntax: uni 2 min read How to Remove Specific Elements from Vector in R? In this article, we will discuss how to remove specific elements from vectors in R Programming Language. Remove elements using in operatorThis operator will select specific elements and uses ! operator to exclude those elements. Syntax: vector[! vector %in% c(elements)]In this example, we will be us 2 min read How to Remove Rows in R DataFrame? In this article, we will discuss how to remove rows from dataframe in the R programming language. Method 1: Remove Rows by Number By using a particular row index number we can remove the rows. Syntax: data[-c(row_number), ] where. data is the input dataframerow_number is the row index position Exam 2 min read Replace NA values with zeros in R DataFrame In this article, we will discuss how to replace NA values with zeros in DataFrame in R Programming Language. The NA value in a data frame can be replaced by 0 using the following functions. Method 1: using is.na() function is.na() is an in-built function in R, which is used to evaluate a value at a 3 min read Like