[R] hash table access, vector access &c
dwinsemius at comcast.net
Tue Jul 5 20:39:09 CEST 2011
On Jul 5, 2011, at 2:10 PM, Sam Steingold wrote:
>> * David Winsemius <qjvafrzvhf at pbzpnfg.arg> [2011-07-05 13:21:57
>> On Jul 5, 2011, at 12:53 PM, Sam Steingold wrote:
>>> I am confused by the way the indexing works.
>> Actually I suspect you may be confused by how factors work. See
> probably both :-(
> being a lisper, I thought about factors as lisp symbols (and thus
> thought that they would be accepted everywhere strings are).
>> Have you considered:
>> ysmd.table[ as.character( ysmd$X.stock[]) ]
>> It appears that ysmd$X.stock[] is a factor, and if so, you
>> want the character value that its numeric representation points to.
>  "FLO"
> <hash> containing 0 key-value pair(s).
> NA : NULL
> so, as.character is not the answer.
My error. Note the difference in indexing functions. "[" is not "[["
> X.stock market.cap X52.week.low X52.week.high
> 100 FLO 2.984e+09 15.3133
> 22.37 1021580
> 100 21.3769
So you are here demonstrating that you should be using "[["
>> This is, of course, guesswork because you have not disclosed what
>> package hash` comes from, so I do not have the benefit of looking at
>> its help page.
> I just did this:
> hash-2.0.1 provided by Open Data.
David Winsemius, MD
West Hartford, CT
More information about the R-help