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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:49:32+00:00 2026-06-13T04:49:32+00:00

If I did this, I get correct result: a <- c(10,28,3) which(as.numeric(a) == min(as.numeric(a)))

  • 0

If I did this, I get correct result:

a <- c("10","28","3")
which(as.numeric(a) == min(as.numeric(a)))
[1] 3

But if there is NAs in the vector, then there is a problem

a <- c("10","28","3","NA")
which(as.numeric(a) == min(as.numeric(a)))
integer(0)
Warning messages:
1: In which(as.numeric(a) == min(as.numeric(a))) :
  NAs introduced by coercion
2: In which(as.numeric(a) == min(as.numeric(a))) :
  NAs introduced by coercion
  • 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-13T04:49:33+00:00Added an answer on June 13, 2026 at 4:49 am

    Two things.

    First, there’s a difference between the character string "NA" and the R data representation for missing values, NA. Remove the quotes around NA in your example to see:

    a <- c("10","28","3",NA)
    

    Second, when you’re using min with actual missing values (i.e. not the character strings "NA") you’ll want to use na.rm = TRUE:

    which(as.numeric(a) == min(as.numeric(a),na.rm = TRUE))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i did this to get the result from parse.com curl -X GET \ -H
I have asked this question before but did not get the satisfied answer as
Hello I asked this question to superuser but I did not get a good
This seems like a very simple problem, but I cannot get a scrollbox to
Did I not get enough sleep or what? This following code var frame=document.getElementById(viewer); frame.width=100;
I posted this question on Reddit Programming and did not get a single response.
Does file_get_contents maintain line breaks? I thought it did but I have tried this:
I'm trying to use this http://www.rcsb.org/pdb/software/rest.do REST services with Qt. I did some get
I did this but it didn't work. Can anyone help me? Thanks. $('.current_element').mouseover(function() {
i did this: this.combobox.ItemsSource = Common.Component.ModuleManager.Instance.Modules; to bind the combobox to a collection, which

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.