Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions episodes/04-code-readability.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,13 @@ Let's apply this to `eva_data_analysis.R`.

a. Edit the code as follows to use descriptive (and consistent) variable names:

- Change `data_f` to `input_file`
- Change data_t to output_file
- Change g_file to graph_file
- Change `data_f_file` to `input_file`
- Change `data_t_file` to `output_file`
- Change `g_file` to `graph_file`

*Be sure to change all the occurrences of each variable name.*

b. What other variable names in our code would benefit from renaming? Rename these too. Hint: variables w, t, tt and ttt could also be renamed to be more descriptive.
b. What other variable names in our code would benefit from renaming? Rename these too. Hint: variables t, tt and ttt could also be renamed to be more descriptive.

c. Commit your changes to your repository. Remember to use an informative commit message.

Expand All @@ -216,25 +216,26 @@ c. Commit your changes to your repository. Remember to use an informative commit
:::::::::::::::::: hint

Variables `t`, `tt` and `ttt` could also be renamed to be more descriptive.
- **Change `tt` to `duration_str`**: represents a string form of the duration, indicated by "_str".
- **Change `t` to `duration_dt`**: a datetime object parsed from the string, indicated by "_dt".
- **Change `ttt` to `duration_hours`**: the duration converted into (decimal) hours.

- **Change `t` to `duration_dt`**: a datetime object parsed from the string, indicated by "_dt".
- **Change `tt` to `duration_str`**: represents a string form of the duration, indicated by "_str".
- **Change `ttt` to `duration_hours`**: the duration converted into (decimal) hours.

::::::::::::::::::::::::
Rename these too.
:::::::::::::::::: hint

Variables `t`, `tt` and `ttt` could also be renamed to be more descriptive.
- **Change `tt` to `duration_str`**: represents a string form of the duration, indicated by "_str".
- **Change `t` to `duration_dt`**: a datetime object parsed from the string, indicated by "_dt".
- **Change `ttt` to `duration_hours`**: the duration converted into (decimal) hours.
- **Change `t` to `duration_dt`**: a datetime object parsed from the string, indicated by "_dt".
- **Change `tt` to `duration_str`**: represents a string form of the duration, indicated by "_str".
- **Change `ttt` to `duration_hours`**: the duration converted into (decimal) hours.

::::::::::::::::::::::::
c. Commit your changes to your repository. Remember to use an informative commit message.

:::::::: solution

Updated code after renaming `data_f`, `data_t` and `g_file` as well as variables `t`, `tt` and `ttt` to be more descriptive.
Updated code after renaming `data_f_file`, `data_t_file` and `g_file` as well as variables `t`, `tt` and `ttt` to be more descriptive.


```r
Expand Down
Loading