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

Refactoring R/strings.R #32

Open
reikookamoto opened this issue Oct 25, 2023 · 1 comment
Open

Refactoring R/strings.R #32

reikookamoto opened this issue Oct 25, 2023 · 1 comment
Assignees

Comments

@reikookamoto
Copy link
Collaborator

reikookamoto commented Oct 25, 2023

You probably have more insight into this but what's the best way to use variables from other files? Do you just source that file or call it from the package namespace, so recodeflow:::variable_details_columns?

Originally posted by @yulric in #24 (comment)

@reikookamoto
Copy link
Collaborator Author

reikookamoto commented Oct 25, 2023

R Packages states that environments can be used to manage data that multiple functions need access to. However, the emphasis seems to be on the fact that, with an environment, values can be modified after the package has been loaded. I don't think this scenario applies to us since the value that the variable is assigned to doesn't change.

Another solution (shown in the first code block of Section 7.4 of the previous link) would be to define an internal function that returns a variable.

That being said, I wonder if the most simple solution is to delete R/strings.R and replace each variable with the corresponding string. I'm leaning towards this approach since the majority of variables are holding onto one or two-word strings. And in some cases, it would be shorter to write out the string than the variable name.

Thoughts?

@reikookamoto reikookamoto self-assigned this Oct 25, 2023
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