0
How can I access the n'th row of a specific column or vice-versa, if I don't know the exact index of the item
1 Resposta
0
For example, to access the price of apple in this dataframe👉https://www.sololearn.com/learning/1147/4987/12808/2 you just input the index of apple form the first column. But what if the column has too many items to know the exact index?
The above☝ dataframe:
x <- data.frame(
"product"=c("Banana", "Apple", "Orange"),
"price"=c(5.99, 2.49, 3.0))
print(x$price[2]) #to get the price of an apple