Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8069031
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T12:52:55+00:00 2026-06-05T12:52:55+00:00

I have big data frame with various numbers of columns and rows. I would

  • 0

I have big data frame with various numbers of columns and rows. I would to search the data frame for values of a given vector and remove the rows of the cells that match the values of this given vector. I’d like to have this as a function because I have to run it on multiple data frames of variable rows and columns and I wouls like to avoid for loops.

for example

ff<-structure(list(j.1 = 1:13, j.2 = 2:14, j.3 = 3:15), .Names = c("j.1","j.2", "j.3"), row.names = c(NA, -13L), class = "data.frame")

remove all rows that have cells that contain the values 8,9,10

I guess i could use ff[ !ff[,1] %in% c(8, 9, 10), ] or subset(ff, !ff[,1] %in% c(8,9,10) )

but in order to remove all the values from the dataset i have to parse each column (probably with a for loop, something i wish to avoid).

Is there any other (cleaner) way?

Thanks a lot

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T12:52:57+00:00Added an answer on June 5, 2026 at 12:52 pm

    apply your test to each row:

    keeps <- apply(ff, 1, function(x) !any(x %in% 8:10))
    

    which gives a boolean vector. Then subset with it:

    ff[keeps,]
    
       j.1 j.2 j.3
    1    1   2   3
    2    2   3   4
    3    3   4   5
    4    4   5   6
    5    5   6   7
    11  11  12  13
    12  12  13  14
    13  13  14  15
    > 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a big data.frame (1.9M records, with 20 columns). One of the columns
I have a big data.frame with a mix of integer, character and strings columns.
I'm struggling with the following. If have a (big) data frame with the following:
I have some data structures: all_unordered_m is a big vector containing all the strings
i have a very big data frame((35000 line) but i want to get specific
I have a big data frame taking about 900MB ram. Then I tried to
Suppose that you have a big Data Entry Web Application Like Microsoft CRM ,
I have been playing around with using graphs to analyze big data. Its been
I have a big problem dealing with data I try to download in my
I have a big chunk of HTML which is a template for some data

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.