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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:55:07+00:00 2026-06-08T09:55:07+00:00

I have two distinct vectors from which I’ve indexed every possible combination of perfect

  • 0

I have two distinct vectors from which I’ve indexed every possible combination of perfect matches:

starts <- c(54, 54, 18, 20, 22, 22, 33, 33, 33, 37, 42, 44, 44, 51, 11, 17, 19, 19, 19, 19, 22, 23, 23, 24, 24)
ends <- c(22, 14, 14, 14, 14, 14, 14, 14, 14, 24, 24, 25, 25, 25, 25, 26, 26, 29, 30, 31, 32, 33, 33, 33, 33)

which(outer(starts, ends, "=="), arr.ind=TRUE)

Now, instead of trying to find exact matches, I’d like to find combinations of components that fall within a certain range of each other: say +/- 5. I’ve made a range (-5:5) and tried introducing it as a function in place of “==”, but it hasn’t really worked out.

Thank you very much.

  • 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-08T09:55:11+00:00Added an answer on June 8, 2026 at 9:55 am

    You can do this by writing a small helper function that does the comparison:

    cmp <- function(x, y, cutoff=5){abs(x-y) <= cutoff}
    
    which(outer(starts, ends, cmp), arr.ind=TRUE)
    
           row col
      [1,]   3   1
      [2,]   4   1
      [3,]   5   1
      [4,]   6   1
      [5,]  16   1
      [6,]  17   1
      [7,]  18   1
           ... etc.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two classes (MVC view model) which inherits from one abstract base class.
I have two distinct Django projects, which I want to run on a single
I have two select queries: SELECT MONTH(date) AS month, count(DISTINCT ip) FROM table_name WHERE
I have two sql queries as following SELECT rc.stateId,rs.stateName FROM (SELECT DISTINCT cityid FROM
I have a treesort function which performs two distinct tasks, each with its own
I have two distinct files, myguide.fig (and its corresponding mygui.m) which contains the definition
I have a dilemma, I have two UIPickerViews which show when two distinct views
I have a page which has two distinct parts : a left side of
I have two distinct (no inheritance) interfaces: IInvestable and IPricable and two classes: IndexClass
I have two distinct scenarios. One, where there is a many to many case,

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.