search for: stock_class

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

2005 Jan 24
1
lookups and joins
...sh 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 need the try since if there is a missing value I g...