This is the code for creating the list:
objs <- mget(ls("package:base"), inherits = TRUE)
funs <- Filter(is.function, objs)
I have tried this:
form_list <- for(i in names(funs)) {
formals(i)
}
It produces an empty object. Then I have tried
form_list <- sapply(names(funs), formals)
longer_args <- sapply(form_list, length)
longest_args <- which.max(longer_args)
long_funct <- funs[961]
evaluates:
$scan
funs_elem <- length(formals(scan))
funs_elem
[1] 22
It is there a shorter way to the answer? Excuse my English.
question from:
https://stackoverflow.com/questions/65932782/i-am-trying-to-obtain-the-lenght-of-all-the-formals-in-r-functions-in-order-to-k 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…