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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T06:07:06+00:00 2026-05-20T06:07:06+00:00

Is there an argument in summary (or another command) to force R to calculate

  • 0

Is there an argument in summary (or another command) to force R to calculate values when there is “no data” in every cell?

In my questionnaire subjects did not provide all information; and for those cells I entered -nodata-. For cells where the answer is not applicable (based on the previous question in q.) I entered -1. The summary looks like this:

> summary(qs$ESC) 
      -1 -nodata-      0.5        1       12       15        3 
      49        3        1        1        1        1        1 

What I want is calculated summary. Is there a way to tell R to disregard -nodata- and -1?

  • 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-20T06:07:07+00:00Added an answer on May 20, 2026 at 6:07 am

    I don’t really understand what kind of summary you want to compute.

    If you use NA instead of your “-nodata-” and “-1” codes, they would be automatically taken into account when using the summary function :

    For example :

    R> v <- c(NA, NA, 0.5, 1, 12, 15, 3)
    R> summary(v)
       Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
        0.5     1.0     3.0     6.3    12.0    15.0     2.0 
    R> table(v)
    v
    0.5   1   3  12  15 
      1   1   1   1   1 
    

    You can see that here v is considered as numeric, as there is no string value in it. When you introduce the “-nodata-” value it will be treated either as a character or as a factor variable.

    You can also use the exclude argument of the table function to automatically ignore some values :

    R> v <- c(-1, "-nodata-", 0.5, 1, 12, 15, 3)
    R> table(v)
    v
         0.5        1       -1       12       15        3 -nodata- 
           1        1        1        1        1        1        1 
    R> table(v, exclude=c(-1, "-nodata-"))
    v
    0.5   1  12  15   3 
      1   1   1   1   1 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a command-line argument that would force firefox.exe to launch a new process
Is there a way to parse the argument values passed to a JavaScript function
Is there a Vim shortcut for jumping to the argument list of the current
Is there a function in Common Lisp that takes a string as an argument
Feedback summary I will now close this thead (I think there will be no
Is there any such equivalent of Java String myMethod (MyClass argument) {...} in Python?
Is there any argument, performance wise, to do filtering in the join, as opposed
Summary for those who might not want to read that much: How do I
Every time I get a new data set the first thing I do is
Is there any argument for using the numeric limits macros (e.g. INT64_MAX ) over

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.