R Coding Style

Posted on Jun 23, 2016 in Programming

Things under legendu.net/outdated are outdated technologies that the author does not plan to update any more. Please look for better alternatives.

** Things under legendu.net/outdated are outdated technologies that the author does not plan to update any more. Please look for better alternatives. **

  1. You can use the function tidy_souce in the R package formatR to format R code.
tidy_source('unformatted.r', file = 'formatted.r')

However, there is a bug in the package formatR. For example, the formatR fails to work with the following code.

if { # this is comment
    ...
}
  1. Avoid changing the type of object.