search for: stockclass

Displaying 1 result from an estimated 1 matches for "stockclass".

2005 Jan 24
1
lookups and joins
...ne in SQL at present. I am looking for an R'ish technique for looking up new columns on a data frame. As a simple, hardwired example I have tried the following: # This gives me two columns, one the lookup value and the second one # the result column, ie my lookup table. stcl = read.csv("stockclass.csv") stockclass = as.vector(stcl$stock_class) # This gives me what appears to be a dictionary or map names(stockclass) = as.vector(stcl$stock_group) getstockclass = function(stock_group) { try(stockclass[[stock_group]], TRUE) } csg$stk_class=factor(sapply(csg$stock_group, getstockclass)) I...