Reputation: 3
I am trying to access the name of a named num in R. My list looks like this:
correlationCoeffs
Line H.points.per.game V.points.per.game H.fg.made.per.game V.fg.made.per.game
0.3724764838 0.2315726001 0.2315726001 0.2156721183 0.2156721183
I know how to access specific numbers and specific entries as so:
correlationCoeffs[["Line"]]
0.3724764838
correlationCoeffs["Line"]
Line
0.3724764838
But I am looking to access the actual name for a given index (for example, given index 1, I want to get "Line" as the result).
Upvotes: 0
Views: 2557
Reputation: 61
Using names() and supplying the index can help with that.
names(correlationCoeffs[index])
Upvotes: 1