如何访问R中表中的单个元素 [英] How to access single elements in a table in R
问题描述
如何从 R 中的表格中抓取元素。
How do I grab elements from a table in R.
我的数据如下所示:
V1 V2
1 12.448 13.919
2 22.242 4.606
3 24.509 0.176
等。 。
我基本上只是想单独抓取元素。我对所有 R 术语感到困惑,比如矢量,我只是希望能够得到各个元素。
I basically just want to grab elements individually. I'm getting confused with all the R terminology like vectors, and I just want to be able to get at the individual elements.
是有一个函数,我可以像 data [v1] [1]
那样获取第1行第1列中的元素?
Is there a function where I can just do like data[v1][1]
and get the element in row 1 column 1?
推荐答案
这是如此基本,我想知道你用什么书来学习?尝试
That is so basic that I am wondering what book you are using to study? Try
data[1, "V1"] # row first, quoted column name second, and case does matter
尽管最近有人投票,但我对我的措辞并不悔改。 R中有大量免费的初学者入门材料: https://cran.r- project.org/other-docs.html
I am unrepentant in my phrasing despite the recent downvote. There is a ton of free introductory material for beginners in R: https://cran.r-project.org/other-docs.html
这篇关于如何访问R中表中的单个元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!