For fixed date planning with a 2 Weeks sprint, I will determine how many sprints I have between two dates, April 1, 2020, and June 4, 2020. The number of weeks between the two dates is 9, 1 weeks. Does this mean there are 4,5 sprints?
I advise that there is no such thing as half a Sprint and to round to a whole number. So, for your calculation, I'd say you have four Sprints.
Related
I have a set of many different kind of observations that contain the Date of observations on special days (sam1, sam2, sam3). My aim is now to perform a wilcox.test() to find out if there is a significant difference between the observations on these special days and not special days. So I need to find a method to find suitable days to use as a control group. I want to try out at least 3 different control groups. The special days are very different, some represent a whole season, some only rainy days, some only cold days, some stormy weather. So they can be spread over the whole 2 years, some might only occur in one single month.
Start <- as.Date("2016-01-01")
End <- as.Date("2017-12-31")
all_dates <- seq(from = Start, to = End, by = 1)
set.seed(1)
sam1<- sample(dates, 30)
sam2<- sample(dates, 5)
sam3<- sample(dates, 120)
all_dates represents my observation period. sam1-3 contain the days of different observations. What I want to do now is to find:
The closest days to my important observations (same number of days that are in the sample)
Random days in roughly the same time the important observations took place (also same number of days as in the sample). It must not be the closest days, but roughly around the same time like in the same months or only 1 before/later.
Any days (I know how to do that, no help needed there)
My idea was to cut out the days of important observations from my whole observation period and then apply a routine that selects my control group days. That is where I stuck now. Any ideas?
I have a couples of weeknumbers of interest. Lets take '202124' (this week) as an example. How can I subtract x weeks from this week number?
Lets say I want to know the week number of 2 weeks prior, ideally I would like to do 202124 - 2 which would give me 202122. This is fine for most of the year however 202101 - 2 will give 202099 which is obviously not a valid week number. This would happen on a large scale so a more elegant solution is required. How could I go about this?
convert the year week values to dates subtract in days and format the output.
x <- c('202124', '202101')
format(as.Date(paste0(x, 1), '%Y%W%u') - 14, '%Y%V')
#[1] "202122" "202052"
To convert year week value to date we also need day of the week, I have used it as 1st day of the week.
How can a day or week or month, essentially a range of time be represented by a single number?
The next interval would represent a number 1 more than the number for the previous interval, just how the next second is 1 more than the previous second, in timestamp representation.
Given a bunch of such numbers, the larger number simply means its representing a time interval afterwards in time, when compared to a number smaller than it.
Just realized if I stick to UTC and represent the day as YYYYMMDD, this becomes a number that I am looking for.
20180420 // 20 april 2018
20180421 // 21 april 2018
20180510 // 10 may 2018
20190101 // 1 jan 2019
This works for representing a day perfectly, I think.
For week, maybe do ceil() of days of current month divided by 7 for representing week as a number W and then using the format: YYYYMMW.
2018043 // 3rd week of april 2018
2018045 // 5th week of april 2018, though may not be the 5th week semantically but representation model works, greater than 4th week of april 2018 and smaller number than 1st week of may 2018
For month, simply YYYYMM works.
I feel so smart right now! 😄
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 3 years ago.
Improve this question
Am I crazy, I've always thought there were 52 weeks in a year, a check on google returns numerous results stating the same...
But if I create a simple spreadsheet, with column A containing 1 to 365 and column B containing INT(A1 / 7) repeated 365 times, column B contains the week index corresponding to the 'julian' day in column A.
The weeks go from 0 to 52, this is actually 53 weeks. If the 1st of January is on day 0, then the 31st of December must overlay into week 1 of the next year.
Can some help explain why we say 52 weeks and not 53?
Sorry I know this isn't strictly a coding question, but is is very relative to a lot of problems with dates and coding.
There are 52 complete weeks in a year. The year has 365 days, leaving one extra day. A leap year has 366 days, adding a second extra day. This makes 52 1/7 weeks in a normal year and 52 2/7 weeks in a leap year..
An ISO week-numbering year (also called ISO year informally) has 52 or 53 full weeks, that is 364 or 371 days instead of the usual 365 or 366 days. The extra week is sometimes referred to as a leap week, although ISO 8601 does not use this term.
The ISO week date system is effectively a leap week calendar system that is part of the ISO 8601 date and time standard issued by the (ISO) since 1988 and, before that, it was defined in ISO (R) 2015 since 1971. It is used (mainly) in government and business for fiscal years, as well as in timekeeping. This was previously known as "Industrial date coding". The system specifies a week year atop the Gregorian calendar by defining a notation for ordinal weeks of the year.
Weeks start with Monday. Each week's year is the Gregorian year in which the Thursday falls. The first week of the year, hence, always contains 4 January. ISO week year numbering therefore slightly deviates from the Gregorian for some days close to 1 January.
I work for a utility company and I am writing a report where I need to count how many consecutive times a meter has estimated 1, 2, 3, 4 or more times. For example, if a meter estimated in February, and March, had a normal read in April, then started estimating again in May, June, July and August, then I want to have a column that tells me that the meter estimated 4 consecutive times. Right now it is telling me 6, since it is not stopping at the regular read. HELP!