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 6867879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:21:51+00:00 2026-05-27T03:21:51+00:00

Possible Duplicate: removing specific rows from a dataframe Let’s say I have a data

  • 0

Possible Duplicate:
removing specific rows from a dataframe

Let’s say I have a data frame consisting of a number of rows, like this:

X <- data.frame(Variable1=c(11,14,12,15),Variable2=c(2,3,1,4))

Variable1    Variable2
11           2
14           3
12           1
15           4

Now, let’s say that I want to create a new data frame that is a duplicate of this one, only that I’m removing all rows in which Variable1 has a certain numerical value. Let’s say we have these numbers stored in a vector, v.

That is, if v contains the numbers 11 and 12, the new data frame should look like this:

Variable1    Variable2
14           3
15           4

I’ve been searching the net for quite some time now trying to figure out how to do something like this. Mainly, I would just need some kind of command saying removeRow(dataframe, row) or something like that.

  • 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-05-27T03:21:52+00:00Added an answer on May 27, 2026 at 3:21 am
     X <- data.frame(Variable1=c(11,14,12,15),Variable2=c(2,3,1,4))
    > X
      Variable1 Variable2
    1        11         2
    2        14         3
    3        12         1
    4        15         4
    > X[X$Variable1!=11 & X$Variable1!=12, ]
      Variable1 Variable2
    2        14         3
    4        15         4
    > X[ ! X$Variable1 %in% c(11,12), ]
      Variable1 Variable2
    2        14         3
    4        15         4
    

    You can functionalize this however you like.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Removing empty rows of a data file in R How would I
Possible Duplicate: Removing Widget from Home Screen when Uninstalled In Android, I have created
Possible Duplicate: Removing an activity from the history stack Suppose I have three activities
Possible Duplicate: Removing last comma in PHP? So I have the following code: <?php
Possible Duplicate: R script - removing NA values from a vector I could I
Possible Duplicate: Removing carriage return and new-line from the end of a string in
Possible Duplicate: Removing an activity from the history stack I am looking for a
Possible Duplicate: How to run a database script file from Delphi? I have a
Possible Duplicate: Removing unused strings during ProGuard optimisation I have an Android application with
Possible Duplicate: Removing HTML from a Java String I am having a problem removing

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.