beautypg.com

Ex: spacing – Google RLint: Reformatting R Code to Follow the Google Style Guide User Manual

Page 8

background image

Google Confidential and Proprietary

Ex: Spacing

Code: foo <-function(x){

return

(list

(

a = sum(x[,1]),

b = 1/3+1e-7*(x[1,1])) …

Warnings:

Place spaces around all binary operators (

=

,

+

,

-

,

<-

, etc.).

Place a space before left parenthesis, except in a function

call.

Corrected: foo <- function(x) {

return(list(

a = sum(x[, 1]),

b = 1/3 + 1e-7 * (x[1, 1]) ...