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

Code Comments for R Journal Review #1

Open
leeper opened this issue Oct 2, 2019 · 7 comments

Comments

@leeper
Copy link

commented Oct 2, 2019

I am a reviewer of your manuscript for R Journal and am submitting a few comments on code here.

@leeper

This comment has been minimized.

Copy link
Author

commented Oct 2, 2019

When you have a constrained set of character string values that are allowed for a function argument, like in method here (https://github.com/shuowencs/SortedEffects/blob/master/R/u.Subpop.R#L44), you can specify them in the function signature as a vector c("ols", "logit", ...) and then use match.arg() to retrieve the default and validate a user-supplied value against that list of allowed values.

That prevents you from having to write code like: https://github.com/shuowencs/SortedEffects/blob/master/R/PEestimate.R#L19

@leeper

This comment has been minimized.

Copy link
Author

commented Oct 2, 2019

Rather than giving errors that ask for a correct argument value, the errors might be improved by saying what values are allowed (e.g., https://github.com/shuowencs/SortedEffects/blob/master/R/u.Subpop.R#L48 and subsequent lines).

@leeper

This comment has been minimized.

Copy link
Author

commented Oct 2, 2019

For bootstrap draws, why set a default value that you don't personally recommend? https://github.com/shuowencs/SortedEffects/blob/master/R/u.Subpop.R#L26

@leeper

This comment has been minimized.

Copy link
Author

commented Oct 2, 2019

@leeper

This comment has been minimized.

Copy link
Author

commented Oct 2, 2019

Missing variable definitions for wage2015 data: https://github.com/shuowencs/SortedEffects/blob/master/R/data.R#L33

@leeper

This comment has been minimized.

Copy link
Author

commented Oct 2, 2019

If plotting functions are meant to be convenient quick-use tools for the interactive user, I would be inclined to set default values to arguments like xlab and ylab so it's clear what is being presented: https://github.com/shuowencs/SortedEffects/blob/master/R/u.Subpop.R#L190

That's done in some places (e.g., https://github.com/shuowencs/SortedEffects/blob/master/R/SPE.R#L223) but it would be good to be consistent across the whole package.

@leeper

This comment has been minimized.

Copy link
Author

commented Oct 2, 2019

It's generally bad practice to set options() inside functions (https://github.com/shuowencs/SortedEffects/blob/master/R/PEestimate.R#L17). If you do it, you should reset to the previous value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.