Reputation: 145
I just have a simple R question. I have a matrix with rownames A,B,C,D
Values
A 4
B 5
C 10
D 21
I just want to print or view the value corresponding to specific rowname. Example - The value for rowname B (which is 5)
Upvotes: 0
Views: 21
Reputation: 72813
You may simply subset by row and column name.
m["B", "Values"]
# [1] 5
Data:
m <- structure(c(4L, 5L, 10L, 21L), .Dim = c(4L, 1L), .Dimnames = list(
c("A", "B", "C", "D"), "Values"))
Upvotes: 1