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

Room2: apply vaccine script added #8

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dokato
Copy link
Collaborator

@dokato dokato commented Feb 10, 2022

No description provided.

Copy link
Collaborator Author

@dokato dokato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general it's a nicely written function, but with no docs it's hard to follow.

@@ -0,0 +1,16 @@
apply_vaccine_to_population <- function(population, ndoses, threshold_age) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add (roxygen) documentation to this function

apply_vaccine_to_population <- function(population, ndoses, threshold_age) {
for (individual in population) {
if (ndoses > 0) {
if (indiv["age"] > threshold_age || indiv["isAtRisk"]) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably you meant individual here

inject_first_jab(indiv)
}
}
ndoses <- ndoses - 1
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should check max/min values of ndoses

for (individual in population) {
if (ndoses > 0) {
if (indiv["age"] > threshold_age || indiv["isAtRisk"]) {
if (indiv["hasFirstJab"]) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should consider all the cases in that condition

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

Successfully merging this pull request may close these issues.

1 participant