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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T02:06:04+00:00 2026-05-30T02:06:04+00:00

I have a data frame that looks as follows (8 columns – the myPOSIX

  • 0

I have a data frame that looks as follows (8 columns – the myPOSIX column is in ‘y-m-d h:s’ format)

head(new)
Date.and.Time..UTC.    Receiver    Transmitter Latitude Longitude ndiffs29912  flag             
1    07/10/2010 15:53 VR2W-107619 A69-1303-29912 48.56225 -53.89144          NA FALSE 2010-10-07 
2    07/10/2010 15:56 VR2W-107619 A69-1303-29912 48.56225 -53.89144         180 FALSE 2010-10-07 
3    07/10/2010 16:00 VR2W-107619 A69-1303-29912 48.56225 -53.89144         240 FALSE 2010-10-07 
4    07/10/2010 16:24 VR2W-107619 A69-1303-29912 48.56225 -53.89144        1440 FALSE 2010-10-07 
5    07/10/2010 16:45 VR2W-104556 A69-1303-29912 48.56460 -53.88956        1260 FALSE 2010-10-07 
6    07/10/2010 16:47 VR2W-107619 A69-1303-29912 48.56225 -53.89144         120 FALSE 2010-10-07  
myPOSIX
15:53:00
15:56:00
16:00:00
16:24:00
16:45:00
16:47:00

My goal is to bin the detections into hour time bins. Then, for each time bin, I would like to calculate weighted means for latitude and longitude, using the number of detections per receiver as the weighting measure (ie the frequency of the different receiver names in each bin).
Any insight would be greatly appreciated – I’ve been trying to work out a code using the zoo and xts package for aggregating hourly detections, but have not succeeded.

  • 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-30T02:06:05+00:00Added an answer on May 30, 2026 at 2:06 am
    # Dummy data
    x <- data.frame(
      date=as.POSIXct(1:10000,origin="2005-01-01 12:00:00"),
    receiver=rep(letters[1:10],1000),
      Latitude=rep(letters[1:10],1000),
      Longitude=rep(letters[1:10],1000),
      ndiffs29912=rnorm(10000)+10)
    
    # Break dates into hours using cut append to data frame
    x$hour <- cut(x$date, breaks="hour")
    
    library(plyr) 
    # By hour and latitude, get weighted
    # mean of ndiffs based on number of receivers
    ddply(x, .(hour, latitude), function(x) data.frame(
    weighted.mean(x$ndiffs29912, length(x$receiver), na.rm=T))
    
    # By hour and longitude, get weighted
    # mean of ndiffs based on number of receivers
    ddply(x, .(hour, longitude), function(x) data.frame(
    weighted.mean(x$ndiffs29912, length(x$receiver), na.rm=T))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a data.frame that looks like this: > head(ff.df) .id pio caremgmt prev
I have a data.frame that looks like this > head(df) Memory Memory Memory Memory
I have a data.frame that looks like this: ID Date.A Date.B Variable A 01/01/2012
I have a semi-melted data frame that looks like this: head(final_melt) Group Source variable
I have data that looks like this: > head(data) date price volume 1 2011-06-26
I have data frame that looks like the following models cores time 1 4
I have a data frame that looks like this: site date var dil 1
I have a data.frame named pp that looks like this: > head(pp) X02R X03N
I have a column in a data frame that looks something like this: [1]
I have a data frame that looks like this, with two key columns and

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.