Closed alaila1 closed 1 year ago
Thanks for reaching out!
The issue is exactly what you described. The HEI2015_ASA24 function cannot handle missing data. I don't think there is a way to improve it, because essentially you need all dietary variables to calculate the HEI2015 and it is not wise for imputing what the missing values would be. Thus, you have to clean up your data first before using the HEI2015_ASA24 funciton. You may use the na.omit() function (https://www.rdocumentation.org/packages/photobiology/versions/0.10.6/topics/na.omit) to remove all rows with any NA values. For example, you may follow the following methods:
clean_Totals = na.omit(Totals)
#Calculate HEI2015 from ASA24
data_HEI <- HEI2015_ASA24(clean_Totals)
This should work perfectly. Let me know if it doesn't.
I have a dataset that has missing data. I am trying to calculate HEI based on ASA24 data, but I keep getting this error:
> Error in if (COHORT$TOTALKCAL[i] == 0) { :
> missing value where TRUE/FALSE needed`
Looking at the ASA24_exp data, there's no missing data there while my dataset does have missing data for some participants. I am wondering if there's an issue with missing data.
The following is the code I use:
System info: OS: Windows 10, x64 R version 4.0.3