Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/81.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_Dataframe - Fatal编程技术网

R 为什么我无法访问数据框中的列

R 为什么我无法访问数据框中的列,r,dataframe,R,Dataframe,我是R的新手,我需要一些关于为什么我不能正确访问数据帧的帮助 > str(new_df) List of 1 <~~~~ SEE THIS LINE (note to OP, sorry for commenting on the question - RS) $ :'data.frame': 16 obs. of 2 variables: ..$ x: num [1:16] 2002 2003 2004 2005 2006 ... ..$ y: num [

我是R的新手,我需要一些关于为什么我不能正确访问数据帧的帮助

> str(new_df)
List of 1    <~~~~  SEE THIS LINE  (note to OP, sorry for commenting on the question - RS)
 $ :'data.frame':   16 obs. of  2 variables:
  ..$ x: num [1:16] 2002 2003 2004 2005 2006 ...
  ..$ y: num [1:16] 457320 431640 412090 389090 396020 ...
> new_df$x
NULL
>str(新的
1个新的_df$x的列表
无效的
使用
is(new_df)
您将看到它是一个data.frame列表。在这种情况下,您必须使用
new_df[[1]]
来访问列表的第一个元素,即data.frame。

使用
is(new_df)
,您将看到它是data.frame的列表。在这种情况下,您必须使用
new_df[[1]]
访问列表的第一个元素data.frame