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

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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:32:46+00:00 2026-05-11T03:32:46+00:00

I have a CSV of file of data that I can load in R

  • 0

I have a CSV of file of data that I can load in R using read.csv()

Some of the data is missing, so I want to reduce the data frame down to set that consists entirely of non-missing data, i.e. if a NULL appears anywhere, I want to exclude that column and row from the filtered data set.

I know I can probably do this fairly simply with the inbuilt R vector operations, but I am not quite sure how to do this exactly?

To make my question a little more concrete, here is a quick sample of the data so you can see what I want to do.

DocID       Anno1    Anno7  Anno8 1           7        NULL   8 2           8        NULL   3 44          10       2      3 45          6        6      6 46          1        3      4 49          3        8      5 62          4        NULL   9 63          2        NULL   4 67          11       NULL   3 91          NULL     9      7 92          NULL     7      5 93          NULL     8      8 

So given this input, I need some code that will reduce the output to this.

DocID       Anno8 44          3 45          6 46          4 49          5 

As Anno8 is the only column with non-NULL data, and there are only four rows with non-NULL data.

  • 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. 2026-05-11T03:32:47+00:00Added an answer on May 11, 2026 at 3:32 am

    If x is your data.frame (or matrix) then

    x[ ,apply(x, 2, function(z) !any(is.na(z)))] 

    Since your example uses NULL, is.na(·) will be replaced by is.null(·)

    Alternatively you can look at subset(·).

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

Sidebar

Ask A Question

Stats

  • Questions 66k
  • Answers 66k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer I believe this feature is 'explicit interface implementation.' Using this… May 11, 2026 at 11:29 am
  • added an answer No, you'll definitely be in an outage. It does not… May 11, 2026 at 11:29 am
  • added an answer If a class is a member of a struct, then… May 11, 2026 at 11:28 am

Related Questions

I have a CSV of file of data that I can load in R
I have an application that reads a CSV file with piles of data rows.
I have a CSV data file with rows that may have lots of columns
I have a large collection of data in an excel file (and csv files).
I have a csv file of the format: 270291014011 ED HARDY - TRUE TO
I have a CSV file that holds about 200,000 - 300,000 records. Most of
I have a set of 10 CSV files, which normally have a an entry
I have a bunch of pretty large CSV (comma separated values) files and I
I have a .csv file that is frequently updated (about 20 to 30 times
I have a big string (let's call it a CSV file, though it isn't

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.