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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:44:00+00:00 2026-05-13T16:44:00+00:00

At some point in my script I like to see the number of missing

  • 0

At some point in my script I like to see the number of missing values
in my data.frame and display them.
In my case I have:

out <- read.csv(file="...../OUT.csv", na.strings="NULL")

sum(is.na(out$codeHelper))

out[is.na(out$codeHelper),c(1,length(colnames(out)))]

It works perfectly fine.
However, the last command obviously gives me the whole data.frame where the NA is TRUE, eg:

5561                  Yemen (PDR) <NA>
5562                  Yemen (PDR) <NA>
5563                  Yemen (PDR) <NA>
5564                  Yemen (PDR) <NA>
5565                  Yemen (PDR) <NA>
5566                  Yemen (PDR) <NA>
5567                  Yemen (PDR) <NA>
5568                  Yemen (PDR) <NA>
5601 Zaire (Democ Republic Congo) <NA>
5602 Zaire (Democ Republic Congo) <NA>
5603 Zaire (Democ Republic Congo) <NA>
5604 Zaire (Democ Republic Congo) <NA>
5605 Zaire (Democ Republic Congo) <NA>

With a big frame and a lot of NAs that looks pretty messy.
Important to me is only where the NA occurs i.e which country
(in the second column) has a missing value in the third column.

So how can i only display a single row for each country?

It should look something like this:

    1                  Yemen (PDR) <NA>
    2 Zaire (Democ Republic Congo) <NA>
    3                          USA <NA>
    4                     W. Samoa <NA>
  • 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-13T16:44:00+00:00Added an answer on May 13, 2026 at 4:44 pm

    unique(c(1,2,3,4,4))

    will give you

    1 2 3 4

    so

    unique(out[is.na(out$codeHelper),c(1,length(colnames(out)))])

    should be what you’re looking for?

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

Sidebar

Related Questions

I need a script that inserts a number at some point into a file
At some point I need to display a disabled (greyed out by disabled=disabled attribute)
I've written a script to geocode some points which has a structure basically like
I'm writing a script and at some point I call to command1 which does
I have written some Python scripts in Eclipse where at some point I have
At some point of my program I have an atom formed by what previously
At some point I must have moved files from one location to another using
In my application at some point, I have to call the Propel library version
I would like to modify the script below so that it creates paragraphs out
I have loaded a logarithmic swept sine (with some short fade in/fade out) into

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.