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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:30:20+00:00 2026-06-10T04:30:20+00:00

I made a small example for my data: mth <- c(rep(1,10)) day <- c(rep(10,5),rep(11,5))

  • 0

I made a small example for my data:

mth <- c(rep(1,10))  
day <- c(rep(10,5),rep(11,5))  
hr <- c(3,4,5,6,7,3,4,5,6,7)  
v <- c(3,4,5,4,3,3,4,5,4,3)  
A <- data.frame(cbind(mth,day,hr,v)) 

What I need to do is to get how many value < 4 on a daily basis, I tried to use the function rle, but was not able to get what I need. The output should look like:

mth <- c(rep(1,2))  
day <- c(10,11)  
v <- c(2,2)  #each 2 here is the sum of 1(3)+1(3) for Oct. and Nov.  
A <- data.frame(cbind(mth,day,v))  

Thank you for your help!

  • 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-06-10T04:30:22+00:00Added an answer on June 10, 2026 at 4:30 am

    With ddply it’s easy

    library(plyr)
    ddply(A, .(mth, day), function(x)  sum(x$v<4))
    #    mth day V1
    # 1   1  10  2
    # 2   1  11  2
    

    or you could use summarize

    ddply(A, .(mth, day), summarize, less4 = sum(v <4))
    #   mth day less4
    # 1   1  10  2
    # 2   1  11  2
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I made a small example HTML page to get JQuery's getJSON method working. It
I have made a small example in order to understand how boost::bind () works
I've made a small example with a Person class, which contains a list of
I made small sample example in jws that is running on local machine. I
I made small program to divide large pictures and take part of them. When
I made a small project where i try to change the name from edit
I made a small project with Northwind database to illustrate the problematic. Here is
I made a small winforms application to monitor a certain folder for new pdf
I've made a small game that uses level, and level is just a int
I've made a small program which has 2 buttons and each does certain thing.

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.