从列表中获取数据帧的名称 [英] Get the names of data frames from a list

查看:47
本文介绍了从列表中获取数据帧的名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

说我有以下内容:

df1 <- data.frame()
df2 <- data.frame()
mylist = list(df1, df2)

是否有一个函数可以向我返回这两个数据帧的名称,即返回我'df1' 'df2'?我知道names(mylist)只会返回我NULL.

Is there a function that will return me the names of these two data frames, i.e. returns me 'df1' 'df2'? I know that names(mylist) will just return me NULL.

推荐答案

mylist <- list()
mylist[["df1"]] <-df1
mylist[["df2"]] <-df2
names(mylist)

mylist[[deparse(substitute(df1))]] <-df1

这篇关于从列表中获取数据帧的名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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