Skip to content

Room2: apply vaccine script added#8

Open
dokato wants to merge 1 commit intotlestang:mainfrom
dokato:apply_vaccine_R
Open

Room2: apply vaccine script added#8
dokato wants to merge 1 commit intotlestang:mainfrom
dokato:apply_vaccine_R

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