lintr no visible binding for global variable ‘.SD’

639 Views Asked by At

lintr throws error while using data.table functions like .SD, .SDcols, e.g:

/path/readData.R:130:29: warning: no visible binding for global variable ‘.SD’, Did you mean 'SSD'?
      DT[, "row.sum" := rowSums(.SD), .SDcols =  names(DT)]
                                ^~~

How can I fix this?

1

There are 1 best solutions below

1
On

Add linters: with_defaults(object_usage_linter = NULL) to your .lintr file.