Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

weekdays() is locale-sensitive, should only be used for formatting, not for calculations #3

Open
thiloplanz opened this issue May 17, 2014 · 1 comment

Comments

@thiloplanz
Copy link

The README file recommends:

For this part the weekdays() function may be of some help here.

This function returns strings that are locale-sensitive, though.

If one were to then use pattern matching to determine if a given day falls on the weekend, that code may not work on another person's machine (where the names are from a different language).

Maybe strftime (which can return a 0 - 6 number for the weekday) is a better choice, especially in a class about reproducible code.

@thiloplanz
Copy link
Author

An alternative is to keep using weekdays, but explicitly tell R to use an English locale.

This is done for example at https://github.com/Gianfranco-Campana/RepData_PeerAssessment1/blob/228f91625f6efd9722965ac4aa08e980f91ca2e5/PA1_template.md#change-my-locale-to-obtain-english-week-names-rather-then-italian-then-transform-date-in-posixt-format

  Sys.setlocale(category = "LC_ALL", locale = "C")

Iryna-Garbuz added a commit to Iryna-Garbuz/RepData_PeerAssessment1 that referenced this issue Jul 14, 2014
Imputing missing values
e-lo pushed a commit to e-lo/RepData_PeerAssessment1 that referenced this issue Jul 17, 2014
jonahlyn added a commit to jonahlyn/RepData_PeerAssessment1 that referenced this issue Aug 17, 2014
onlinebaba added a commit to onlinebaba/RepData_PeerAssessment1 that referenced this issue Sep 14, 2014
subzero76 added a commit to subzero76/RepData_PeerAssessment1 that referenced this issue Sep 21, 2014
chmnoh added a commit to chmnoh/RepData_PeerAssessment1 that referenced this issue Oct 18, 2014
acrost added a commit to acrost/RepData_PeerAssessment1 that referenced this issue Feb 15, 2015
draft, still working on problem rdpeng#3
tbaker-sc added a commit to tbaker-sc/RepData_PeerAssessment1 that referenced this issue Apr 18, 2015
yevgeniy007 added a commit to yevgeniy007/RepData_PeerAssessment1 that referenced this issue Jun 14, 2015
Final submission
jonsan21 added a commit to jonsan21/RepData_PeerAssessment1 that referenced this issue Aug 14, 2015
AkilaJayani added a commit to AkilaJayani/RepData_PeerAssessment1 that referenced this issue Dec 19, 2015
pabischoff added a commit to pabischoff/RepData_PeerAssessment1 that referenced this issue Jan 9, 2016
DDakhno added a commit to DDakhno/RepData_PeerAssessment1 that referenced this issue Apr 5, 2016
Read Where_is_PA1_template.Rmd? first!
braquel added a commit to braquel/RepData_PeerAssessment1 that referenced this issue Dec 5, 2016
ASonCourse added a commit to ASonCourse/RepData_PeerAssessment1 that referenced this issue Oct 27, 2017
mrglass1 added a commit to mrglass1/RepData_PeerAssessment1 that referenced this issue Mar 30, 2020
sarahkinley added a commit to sarahkinley/RepData_PeerAssessment1 that referenced this issue Dec 30, 2020
CliverF pushed a commit to CliverF/RepData_PeerAssessment1-1 that referenced this issue Feb 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant