Go to TogaWare.com Home Page. Data Science Desktop Survival Guide
by Graham Williams
Duck Duck Go



CLICK HERE TO VISIT THE UPDATED SURVIVAL GUIDE

Indentation

20200105

resume
Use a consistent indentation. I prefer 2 spaces within both Emacs ESS and with a good font (e.g., Courier font in RStudio works well but Courier 10picth is too compressed). Try 4 if using a smaller font. Indenting 8 characters is probably too much, makes it difficult to read. There are plenty of tools to reindent to a different level as we choose. Keep lines to less than 80 characters even though displays can now support much longer lines. It seems easier to read.

Preferred

window_delete <- function(action, window)
{
  if (action %in% c("quit", "ask"))
  {
    ans <- TRUE
    msg <- "Terminate?"
    if (! dialog(msg))
      ans <- TRUE
    else
      if (action == "quit")
        quit(save="no")
    else
      ans <- FALSE
  }
  return(ans)
}

Not Ideal

window_delete <- function(action, window)
{
            if (action %in% c("quit", "ask"))
            {
                        ans <- TRUE
                        msg <- "Terminate?"
                        if (! dialog(msg))
                                ans <- TRUE
                        else
                                if (action == "quit")
                                        quit(save="no")
                                else
                                        ans <- FALSE
            }
            return(ans)
}

Always use spaces rather than the invisible tab character.


Support further development by purchasing the PDF version of the book.
Other online resources include the GNU/Linux Desktop Survival Guide.
Books available on Amazon include Data Mining with Rattle and Essentials of Data Science.
Popular open source software includes rattle and wajig.
Hosted by Togaware, a pioneer of free and open source software since 1984.
Copyright © 2000-2020 Togaware Pty Ltd. . Creative Commons ShareAlike V4.