Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/78.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R从数据帧名称向量返回数据帧_R_Dplyr_Purrr_Base - Fatal编程技术网

R从数据帧名称向量返回数据帧

R从数据帧名称向量返回数据帧,r,dplyr,purrr,base,R,Dplyr,Purrr,Base,我有一个向量test_vector,它包含一个字符串;该字符串也是数据帧的名称。我需要一个函数,该函数允许我在测试向量中显示已知给定值的数据帧: test_vector = "x" x = tibble(y=seq(1,5)) testdata[1] 我想要的是一个围绕testdata[1]的函数,它返回数据帧x,而不是test_vector[1]的x值 R中是否存在这样的函数。我们可以使用get返回对象的值 get(test_vector[1]) -输出 # A tib

我有一个向量test_vector,它包含一个字符串;该字符串也是数据帧的名称。我需要一个函数,该函数允许我在测试向量中显示已知给定值的数据帧:

test_vector = "x"
x = tibble(y=seq(1,5))
testdata[1]
我想要的是一个围绕testdata[1]的函数,它返回数据帧x,而不是test_vector[1]的x值

R中是否存在这样的函数。

我们可以使用get返回对象的值

get(test_vector[1])
-输出

# A tibble: 5 x 1
#      y
#  <int>
#1     1
#2     2
#3     3
#4     4
#5     5
我们可以使用get返回对象的值

get(test_vector[1])
-输出

# A tibble: 5 x 1
#      y
#  <int>
#1     1
#2     2
#3     3
#4     4
#5     5