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 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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

11th Aug 2022, 7:18 PM
C K
C K - avatar
1 Answer
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
11th Aug 2022, 7:25 PM
C K
C K - avatar