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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:40:01+00:00 2026-06-12T11:40:01+00:00

I am using match for getting if an element is in a list. For

  • 0

I am using match for getting if an element is in a list. For example my list is:

  c("a","b","h","e"...) and so on

if I want to see if element h is in the list I am using match in this way:

  if ("h" %in% v){do something}

How I can get the position of where it finds the element in the list?
Thanks

  • 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-12T11:40:02+00:00Added an answer on June 12, 2026 at 11:40 am

    If you want to know the position use which

    l <- c("a","b","h","e")
    which(l=='h') 
    [1] 3   # It'll give you the position, 'h' is the third element of 'l'
    

    Note that l is a vector, not a list as you mentioned.

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

Sidebar

Related Questions

I am trying to create a budget using a Match function, but I can't
I'm attempting to get the height of an element using jQuery, but am receiving
Code to determine the lat element of a list, using pattern matching: @tailrec def
I am getting the following error: try { Element.update(status, This product doesn't exist.); }
I want help in getting a value from one xml into another using xsl,
I am using match() against() to match up different values across tables which are
I'm trying to implement a database search, by using match , against and fulltext
I'm trying to validate usernames in PHP using preg_match() but I can't seem to
I am using Boost to match substrings in a string. Io iterate over the
I'm using pcrecpp to match and expression in my C++ program. The relevant code

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.