Suppose you have 4 related vectors:
a.id-c(1:25, 1:25, 1:25)
a.vals - c(101:175)# same length as a.id (the values for those IDs)
a.id.levels - c(1:25)
a.id.ratings - rep(letters[1:5], times=5)# same length as a.id.levels
What I would like to do is specify a rating from a.ratings
Sounds like you have two different tables and are trying to mine one
based on the other. Try
ref - data.frame( levels = 1:25,
ratings = rep(letters[1:5], times=5) )
db - data.frame( vals=101:175, levels=c(1:25, 1:25, 1:25) )
levels.of.interest - ref$levels[ ref$rating==a ]
On Thu, 2007-03-29 at 19:55 -0400, Paul Lynch wrote:
Suppose you have 4 related vectors:
a.id-c(1:25, 1:25, 1:25)
a.vals - c(101:175)# same length as a.id (the values for those IDs)
a.id.levels - c(1:25)
a.id.ratings - rep(letters[1:5], times=5)# same length as a.id.levels
On Thu, 29 Mar 2007, Paul Lynch wrote:
Suppose you have 4 related vectors:
a.id-c(1:25, 1:25, 1:25)
a.vals - c(101:175)# same length as a.id (the values for those IDs)
a.id.levels - c(1:25)
a.id.ratings - rep(letters[1:5], times=5)# same length as a.id.levels
What I would like
Adai-- Thanks a lot! This is just what I was looking for. I was
almost sure there had to be a neat of doing this.
Bert-- Thanks for the tip.
Marc-- Not quite, although your solution works fine for the case I
gave. What I had in mind for a.id was an arbitrary sequence of the
numbers in the