mjockers / syuzhet

An R package for the extraction of sentiment and sentiment-based plot arcs from text
334 stars 72 forks source link

cleanup #15

Closed Ironholds closed 8 years ago

Ironholds commented 8 years ago

Miscellaneous cleanup and tweaks:

  1. switch out if-else return statements for just if-statements. Because you're returning, you don't need to ensure an "else" - if the object evaluation in condition 2 wasn't distinct from condition 1, it'd not have hit condition 2, it would've returned. This also simplifies the if-checks (e.g. you don't need to ensure !scale_vals after checking for scale_vals: if it wasn't !scale_vals, we wouldn't be here).
  2. Add a check that 'bins' is numeric too.
  3. switch out unnecessary x and y assignments, and use seq_along(x) instead of 1:x, since in the case that x is 0, 1:x produces some weird stuff.
  4. Use <- uniformly.
mjockers commented 8 years ago

Thanks Ironholds.