在函数中返回两个 Dataframe [重复]

7dl7o3gd  于 2023-06-19  发布在  其他
关注(0)|答案(1)|浏览(131)

此问题已在此处有答案

Returning multiple objects in an R function [duplicate](6个答案)
2天前关闭。
是否可以在这样的函数中返回两个 Dataframe :

test <- function(){
  my.df <- data.frame(
    col1 = sample(c(1,2), 10, replace = TRUE),
    col2 = as.factor(sample(10)))
  other.df <- data.frame(
    col3 = letters[1:10],
    col4 = sample(c(TRUE, FALSE), 10, replace = TRUE))
  return(my.df, other.df)
}
a,b=test()

相关问题