機略戦記

Maneuver warfare

R6でAll elements of public, private, and active must be namedと言われた時チェックすべき点

R6パッケージを使って作ったクラスについて、以下のエラーが出る事がある。

 R6::R6Class("XxxxXxxx", public = list(initialize = function(xxxxx) { でエラー: 
  All elements of public, private, and active must be named. 

R6で定義しているメソッドについて

  • mehotd_name = function() {}では無く、
  • mehotd_name <- function() {}を使うとこのようなエラーが起きるようだ。
XxxxXxxx <- R6::R6Class('XxxxXxxx',
  public = list(
    initialize = function(xxx) {
    },
    hoge <- function(xxx) { # ここで起きてる。
    }
  ),
  private = list(
    xxx = NA
  )
)