如何连接 R 中两个命令的结果

How to concatenate the results of two commands in R

我们如何将两个 R 命令 dim(filename)summary(filename) 的结果连接到一个输出文件中的文件名作为输出。

我试过了,但不正确:

output <- c(dim(filename), summary(filename)
OR 
output <- dim(filename); summary(filename)

感谢任何帮助。

当两个元素的class不同时,最好放在一个list中,以保留class

output <- list(dim(filename), summary(filename))