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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:26:00+00:00 2026-05-25T12:26:00+00:00

I have a dataset with a datetime (POSIXct), a node (factor) and and a

  • 0

I have a dataset with a datetime (POSIXct), a “node” (factor) and and a “c” (numeric) columns, for example:

                 date node           c
1 2011-08-14 10:30:00    2 0.051236000
2 2011-08-14 10:30:00    2 0.081230000
3 2011-08-14 10:31:00    1 0.000000000
4 2011-08-14 10:31:00    4 0.001356337
5 2011-08-14 10:31:00    3 0.001356337
6 2011-08-14 10:32:00    2 0.000000000

I need to take the mean of column “c” for all pairs of “date” and “node”, so I did this:

tapply(data$c, list(data$node, data$date), mean)

The result I obtain is what I want, but in a strange structure:

num [1:5, 1:8923] 0 0 0.00092 0.00146 NA ...
 - attr(*, "dimnames")=List of 2
  ..$ : chr [1:5] "1" "2" "3" "4" ...
  ..$ : chr [1:8923] "2011-08-14 10:30:00" "2011-08-14 10:31:00" "2011-08-14 10:32:00" "2011-08-14 10:33:00" ...

Where an example output would be:

  2011-08-17 23:56:00 2011-08-17 23:57:00 2011-08-17 23:58:00
1        4.759077e-05        4.759077e-05        4.759077e-05
2        0.000000e+00        3.875248e-05        1.595690e-04
3        1.134391e-03        1.134391e-03        1.109730e-03
4        4.882813e-04        6.914658e-04        4.955846e-04
5        0.000000e+00        0.000000e+00        0.000000e+00

What I was going for was something like the original structure, with a datetime, the node factor and the “c” value. I cannot figure out how to achieve this. Any help would be appreciated.

Many thanks.

  • 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-25T12:26:01+00:00Added an answer on May 25, 2026 at 12:26 pm

    You might try…

    aggregate( c ~ node + date, data = data, FUN = mean )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have DataSet which has 3 columns. Name - insurance comp. name - treatmentDate
I have a DataSet that contains a few columns. One of these columns is
(R beginner here...) I have a dataset like: > head(q) Date Time System User
We have a single table (25 columns int, text and datetime) with about a
I have a dataset with a column containing date in DAY-MONTH-YEAR TIME format. That
I have DataSet. it returns date, and value by date. for ex: 01.01.2009 454
I have a dataset and it has a InsertQuery(String Name,String Surname,DateTime BDate) Now I
I have a Dataset with a Bunch of Columns used in a Report (DevExpress
I have the following dataset with daily collected data. R> toydata date group coef
Suppose I have: R> str(data) 'data.frame': 4 obs. of 2 variables: $ datetime: Factor

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.