如何使用变量访问列。 [英] How to access column with a variable.
本文介绍了如何使用变量访问列。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在变量中有列名。我想从csv访问该列,我该怎么做?
我尝试过的事情:
RawData< - read.csv(DataCombined.csv)
colName< - grp2 $ Col1 [1]
我想访问RawData $ colName。但是我收到错误,说$ colName无效。
任何人都可以帮助我获得价值。
解决方案
Col1 [1]
我想访问RawData
colName。但我收到错误说
colName无效。
任何人都可以帮助我获得价值。
I have column name in a variable. I want to acess that column from a csv how will I do it?.
What I have tried:
RawData <- read.csv("DataCombined.csv")
colName <- grp2$Col1[1]
I want to access RawData$colName. But I am getting error saying $colName is not valid.
Can anyone help me in getting the value.
解决方案
Col1[1]
I want to access RawData
colName. But I am getting error saying
colName is not valid.
Can anyone help me in getting the value.
这篇关于如何使用变量访问列。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文