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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T21:12:30+00:00 2026-06-12T21:12:30+00:00

This would seem to be a simple task but I’m having difficulty executing it

  • 0

This would seem to be a simple task but I’m having difficulty executing it as well as finding examples of how it is done in R.

I have a data frame with about 75K records. One field has dates and it goes back about 11 years. I’ve used the following code to strip off the hours minutes seconds so I just have year-month-day

 dat$date=round.POSIXt(dat$date,units="day")

I am now trying to create a new field “FiscalYear” based on dates such that if the date is between 2008-07-01 and 2009-06-30 it gets assigned FY09…then between 2009-07-01 and 2010-06-30 it gets assigned to FY10, etc…

The method I’ve been trying is with ifelse using >= && <= to set the date ranges but this isn’t working. Any thoughts?

  • 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-12T21:12:31+00:00Added an answer on June 12, 2026 at 9:12 pm

    Basically, what Ben said. Here’s an example of what that’d look like in practice. (I’ve used a Date class object, since it sounds like you don’t need the hour/minute/second info.)

    date <- seq(from = as.Date("2010/5/30"), by="week", length=10) ## Example data
    
    cuts <- seq(from = as.Date("2000/7/1"), by="year", length=13) 
    labs <- paste0("FY", 1:12)
    
    cut(date, breaks = cuts, labels = labs)
    #  [1] FY10 FY10 FY10 FY10 FY10 FY11 FY11 FY11 FY11 FY11
    # Levels: FY1 FY2 FY3 FY4 FY5 FY6 FY7 FY8 FY9 FY10 FY11 FY12
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I thought this would be a relatively simple task with something like FMOD, but
I feel this being a simple task, but I don't seem to be able
This may seem to be an academic question, but still I would be very
This may seem like a basic question. I have a light-weight website and would
I know this can seem a weird question but for me it would be
I have this design which I cannot seem to get right, I would like
I know this is a task that can't be unique, but I can't seem
I seem to have a classic task, yet I can't find any examples on
So, I thought this would be simple and, well, I was wrong. Here is
This would seem to be the case in Firefox 3.5+, there I can instantiate

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.