Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
重载R中的get函数_R - Fatal编程技术网

重载R中的get函数

重载R中的get函数,r,R,我对R非常陌生(问题在于对象类的顺序。当查看方法时,它将查看类的第一个元素,依此类推。当使用map函数时,如果您按照以下方式设置,它应该适合您: map <- function() { self <- environment() # this/self in other OO languages data <- new.env() # where the key/value pairs will be stored class(self) <-

我对R非常陌生(问题在于对象类的顺序。当查看方法时,它将查看类的第一个元素,依此类推。当使用map函数时,如果您按照以下方式设置,它应该适合您:

map <- function() {
  self <- environment()   # this/self in other OO languages
  data <- new.env()       # where the key/value pairs will be stored
  class(self) <- c('map', class(self))
  return(self)
}

map问题在于对象类的顺序。当查看方法时,它将查看类的第一个元素,依此类推。使用map函数时,如果您按照以下方式设置,它应该适合您:

map <- function() {
  self <- environment()   # this/self in other OO languages
  data <- new.env()       # where the key/value pairs will be stored
  class(self) <- c('map', class(self))
  return(self)
}
map Define
get.default Define
get.default