Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/list/4.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中创建多个列表_R_List - Fatal编程技术网

函数在R中创建多个列表

函数在R中创建多个列表,r,list,R,List,我希望能够创建一个返回3个列表的函数。例如: Objects <- function(SetType, 2Type){ 1Set <- list() 1Set$type <- SetType 2Set <- list() 2Set$type <- 2Type 3Set <- list() return(1Set) return(2Set) return(3Set) } Objects也请检查此项 对象执行此操作返回(列表(1

我希望能够创建一个返回3个列表的函数。例如:

Objects <- function(SetType, 2Type){
  1Set <- list()
  1Set$type <- SetType
  2Set <- list()
  2Set$type <- 2Type
  3Set <- list()

  return(1Set)
  return(2Set)
  return(3Set)
}
Objects也请检查此项


对象执行此操作
返回(列表(1集、2集、3集))
非常简单,谢谢!很高兴今天天气好
Objects <- function(SetType, 2Type){
  1Set <- list()
  1Set$type <- SetType
  2Set <- list()
  2Set$type <- 2Type
  3Set <- list()

  return(list(1Set,2Set,3Set))
}
Ret=Objects(SetType, 2Type)
1Set=Ret[[1]]
2Set=Ret[[2]]
3Set=Ret[[3]]