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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T12:57:37+00:00 2026-05-30T12:57:37+00:00

I have missing values for a lot of cases and the code below only

  • 0

I have missing values for a lot of cases and the code below only gives means for Days that have values for all the variables.
newsap <- na.omit(sap) seems to omit the whole observation and not just the individual missing values. Is there something I can do to get the means even though there are some missing cases?

aggregate(cbind(BattV, Ptemp, Temp,RH, VPD)~Day,data=subset(sap,Time>=12 & Time<=14),mean)

Date    Day Time    Species Chamber BattV   Ptemp   Temp    RH  VPD 
6/14/10 165 12  1   1   12.92   30.09                       
6/14/10 165 12.1    1   1   12.93   30.57                       
6/14/10 165 12.2    1   1   12.93   31.12                       
6/14/10 165 12.3    1   1   12.93   31.55                       
6/14/10 165 12.4    1   1   12.93   31.72                       
6/14/10 165 12.5    1   1   12.93   31.79                       
6/14/10 165 13  1   1   12.92   31.76                       
6/14/10 165 13.1    1   1   12.92   31.69                       
6/14/10 165 13.2    1   1   12.91   31.62                       
...
7/19/10 200 11.1    1   1   12.09   27.4    30.35       72.688
7/19/10 200 11.2    1   1   12.09   27.72   30.541      70.128
7/19/10 200 11.3    1   1   12.09   27.94   30.279      70.775
7/19/10 200 11.4    1   1   12.09   28.2    30.638      71.988
7/19/10 200 11.5    1   1   12.09   28.62   30.67       69.848
  • 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-30T12:57:38+00:00Added an answer on May 30, 2026 at 12:57 pm

    In this case, see ?mean and note the na.rm argument. You can pass extra arguments on the aggregated function via ... in ?aggregate, so we can specify na.rm = TRUE in the function call:

    aggregate(cbind(BattV, Ptemp, Temp,RH, VPD) ~ Day, 
              data=subset(sap,Time>=12 & Time<=14),
              mean, na.rm = TRUE)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a solution that is missing a lot of code coverage. I need
I have huge matrix with a lot of missing values. I want to get
I have a missing reference listed in my References list (in the VBA Code
I have a rather large text file that has a bunch of missing newlines,
i'm missing something fundamental here. i have a very simple custom class that draws
I have this code, I know I'm missing something but don't know what. It
I have a small front end to a webshop. All customers that go through
I have several finished, older PHP projects with a lot of includes that I
We have a WinForms app, written in VB.NET (CLR 2.0), that does a lot
I have a legacy class, with a lot of public double fields. All double

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.