Extract names of dataframes passed with dots

后端 未结 2 1519
被撕碎了的回忆
被撕碎了的回忆 2020-12-11 03:27

One can use deparse(substitute()) combination to extract the parameter name inside the function like this function

names_from_dots <- functio         


        
2条回答
  •  长情又很酷
    2020-12-11 03:40

    You can try the following:

    names_from_dots <- function(...) sapply(substitute(list(...))[-1], deparse)
    
    names_from_dots(swiss, iris)
    # [1] "swiss" "iris" 
    

提交回复
热议问题