r - Use Factor Vector to Lookup Value in Data Frame -


I have a vector

  & gt; Head (GBMPD) [1] Full oval completed completed   

I also have a data frame

  & gt; Head (gbmPredProb) compilation complete dead less 1 0,04535981 0,8639282 0,07698963 0,01372232 2 0,19031127 0,6680874 0,11708416 0,02451713 3 025004446 0,6789679 0,04827067 0,02271702 4, 09625138 07877128 0,09906595 0,01696983 5,115696875 0,7617585 0,04441733 0,03685539 6,14157307 0,7690410 0,06057754 0,02880836   

I'm in gbmPredProb To view values, you want to create a vector by using the levels in gbmPred:

0.8639282 0.1170841 0.6789679 0.7877128 0.7617585 0.02880836

How to do this in any R? Appreciate the help.

Edit *** Sorry copy and paste error. The first value is the second value in the .86 matches. The 11 matches DAD

is to obtain the value (compressed, etc.) through the value of the loop through value (GPMFED), then GBMPDPRB data frame with the same name as the value of the column with the index of the vector.

So, the first value is complete. View and receive GbmPredProb. The second value of 863 gbmPred is death. View and receive GbmPredProb. Thread value of 117 GBPpad has been completed. View and receive GbmPredProb .678

If you have a bunch of (line, call) The pair, which you want to take out of a matrix, is a good way to get them index by 2-column matrix where the first column is the row number of the elements you want and the second column is all the column numbers of the elements The ones you want to:

  GBPPPB [cbind (1: length (GBP) D), match (GBMPAD, name (GBMPDP rob))] # [1] 0.86392820 0.11708416 0.67896790 0.78771280 0.76175850 # [6] 0.02880836   

One advantage of this kind of approach is that large data This would be a good deal from the line-by-line approach on the frame: # GBPPPRB [Representative (1: 6, each = 1000),] # 6000x4 GBFFED - Representative (GBMPed, every = 1000) # Length 6000 Joyceer - Function (matte, VCC) mat (CBIL (VCC), work (i) mat, as (eg: 1: Length (VCC), match (week, name (mat))) RSVAVN & LT; - (Function (mat, VCC) character (vec [i])]) all.equal (josilber (gbmPredProb, gbmPred), rscriven (gbmPredProb, gbmPred)) # [1] Really libraries (microbainchmark) microbainmarkmark (jabilber (GBMPDP rob, GBMPD) ), RSIEQWWEN (GBMPDPARAb, GBMPD) #Unit: Microcompanies # XP Minute Leak Medieux Luke Max Naval # Jossilber (GBMDPDBBR, GBMPD) 328.524 398.8545 442.065 512.949 766.082 100 # RSIKerven (GBMPP Rob, GBMPD) 97843.015 111478.4360 117 294.079 123901.368 254645.966 100

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -