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)
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"))
1.4m articles
1.4m replys
5 comments
57.0k users