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

  • SEARCH
  • Home
  • 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 1071553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T20:43:44+00:00 2026-05-16T20:43:44+00:00

I have the following dataframe ( df ) start end 1 14379 32094 2

  • 0

I have the following dataframe (df)

 start     end
1    14379   32094
2   151884  174367
3   438422  449382
4   618123  621256
5   698271  714321
6   973394  975857
7   980508  982372
8   994539  994661
9  1055151 1058824
.   .       .
.   .       .
.   .       .

And a long boolean vector with boolean values (vec).

I would like to filter out all ranges in df that contain at least one TRUE value in the corresponding locations in vec.

In other words, a row with start=x end=y will be outputted iff !any(vec[x:y]).

Any ideas on how to accomplish 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-16T20:43:45+00:00Added an answer on May 16, 2026 at 8:43 pm

    This is the same question as:
    Adding a column to a dataframe in R
    so it has the same answer… use apply, but with any instead of mean…

    > ranges <- apply(DF,1,function(row) !any(vec[ row[1]:row[2] ]))
    > DF[ranges,]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following dataframe ( df ) start end 1 14379 32094 2
I have the following data set which shows the start and the end of
Suppose I have the following dataframe: df <- data.frame(BR.a=rnorm(10), BR.b=rnorm(10), BR.c=rnorm(10), USA.a=rnorm(10), USA.b =
If I have the following dataframe called result > result Name CV LCB UCB
I have the following variable and dataframe welltypes <- c(LC,HC) qccast <- data.frame( LC_mean=1:10,
Lets have the following dataframe inside R: df <- data.frame(sample=rnorm(1,0,1),params=I(list(list(mean=0,sd=1,dist=Normal)))) df <- rbind(df,data.frame(sample=rgamma(1,5,5),params=I(list(list(shape=5,rate=5,dist=Gamma))))) df
I have the following R dataframe mydata session first last city 1 9cf571c8faa67cad2aa9ff41f3a26e38 cat+rat
I have following situation: I have loged user, standard authentication with DB table $authAdapter
I have following string String str = replace :) :) with some other string;
I have following foreach-loop: using System.IO; //... if (Directory.Exists(path)) { foreach(string strFile in Directory.GetFiles(path,

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.