Open isabelchew opened 4 years ago
Thank you for reviewing my homework and giving comments. I very much appreciate your suggestions. However, round(diff(lifeExp), 3) means I am rounding the difference in three digits. For lag 1, the first value will be missing. Therefore, the new variable has fewer rows than the original variables. To keep the same length of the variable, I add NA for the first value (which is missing in this case).
Thanks again.
Got it, thanks for enlightening me! :)
You are welcome.
Peer-Review HW-02 for belalanik
Remarks:
In general, I think you have fulfilled the requirements for this assignment.
I like the range of graphs that you have. Allows me to learn from you by examining the code too!
I would try to have a description for each R chunk (rather than just putting the assignment no.) so that I know what the chunk is trying to accomplish, as well as providing some kind of analysis or narration whenever relevant.
I like your table showing the summary stats for each continent but some of the tables are a little confusing. For example, lines 70-74, I'm not sure if you meant to select country instead of continent. In lines 88-95, I suppose the table is meant to set up the data for the subsequent bar plot. The bar plot makes sense but I'm not sure if there's any value to showing the frequency table.
Perhaps it's a function of style, but I like my code to be as efficient as possible. A shorter way of filtering multiple countries might be to make it a vector, e.g. filter(country %in% c("Bangladesh", "Brazil", "Philippines") - I like this method because I can type less! Likewise, for the difference in life expectancy, would it be possible to filter directly without having to create a new variable 'lifeExp_status'?
I'm new to R but would it be possible to explain this line of code? mutate(lagLifeExp = c(NA, round(diff(lifeExp), 3))