Make a list of numbered weeks

Share:

Description

Make a list of weeks for a given number of days.

Usage

1
  make_weeks_list(numweeks = 53)

Arguments

numweeks

Number of weeks you would like to get the daily week categories for. Default is 53 weeks, i.e. 53*7 = 371 days.

Details

E.g., for 15 days,

make_weeks_list(numweeks=17)

...would return:

week1
week1
week1
week1
week1
week1
week1
week2
week2
week2
week2
week2
week2
week2
week3
week3
week3

This is useful for categorizing e.g. daily satellite data by week.

Value

weeks_list, a list of the week category that each day falls into

Author(s)

Nicholas J. Matzke matzke@berkeley.edu

References

NASA (2001). "MODLAND Product Filename Convention." <URL: http://landweb.nascom.nasa.gov/cgi-bin/QA_WWW/newPage.cgi?fileName=hdf_filename>.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# Make the weeks_list
weeks_list = make_weeks_list(numweeks=53)
weeks_list

# Which week category you are in
day=1
weeks_list[day]
day=8
weeks_list[day]
day=100
weeks_list[day]
day=366
weeks_list[day]

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.