Incorrect use of dietaryindex function #314
jamesjiadazhan
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In R, the data users put in the arguments (or parameters) will fill in the default locations for the function, if you do not specify them. This may result in errors.
For example, for the following function:
MED_NHANES_FPED(
FPED_PATH = NHANES_20172018$FPED,
NUTRIENT_PATH = NHANES_20172018$NUTRIENT,
DEMO_PATH = NHANES_20172018$DEMO,
FPED_PATH2 = NHANES_20172018$FPED2,
NUTRIENT_PATH2 = NHANES_20172018$NUTRIENT2
)
The example filled FPED_PATH2 and NUTRIENT_PATH2 as the first and second argument, so the function will assume what you put are FPED_PATH and NUTRIENT_PATH.
The correct use is this if user is only interested in the second day data:
MED_NHANES_FPED(
DEMO_PATH = NHANES_20172018$DEMO,
FPED_PATH2 = NHANES_20172018$FPED2,
NUTRIENT_PATH2 = NHANES_20172018$NUTRIENT2
)
In the future, if users are not absolutely familiar with the function, they should specify which parameters they want to pass their data input.
Beta Was this translation helpful? Give feedback.
All reactions