为什么函数 c() 接受未记录的参数? [英] Why does function c() accept an undocumented argument?

查看:24
本文介绍了为什么函数 c() 接受未记录的参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本函数 c() 的文档显示其默认参数为

The documentation for the base function c() shows its default arguments as

c(..., recursive = FALSE)

现在,如果我们定义

lst <- list(x = 1:5, y = 6:10)

然后将列表与

c(lst, recursive = TRUE)
# x1 x2 x3 x4 x5 y1 y2 y3 y4 y5 
#  1  2  3  4  5  6  7  8  9 10 

列表折叠,名称保留.

但我们也可以使用另一个未公开的参数 use.names 来删除名称.

But we can also use another, undocumented argument, use.names, to remove the names.

c(lst, recursive = TRUE, use.names = FALSE)
# [1]  1  2  3  4  5  6  7  8  9 10

为什么不 use.names 记录为 c() 的参数之一?

推荐答案

我认为这是由于 recursive=TRUE 我认为必须使用与 unlist 相同的代码代码>.use.names 参数在 ?unlist 中描述.

I think that it is due to the recursive=TRUE which I believe must use the same code as unlist. The use.names parameter is described in ?unlist.

这篇关于为什么函数 c() 接受未记录的参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆