R 为什么我无法访问数据框中的列
我是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 [
> 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