[R] Extract one element from yahooKeystats data

J Toll jctoll at gmail.com
Mon Apr 27 21:43:59 CEST 2009


I am trying to extract one particular piece of data(Float) from all
the data returned by yahooKeystats, but thus far I'm having no luck.
This is what I've got so far:

> library(fImport)
Loading required package: timeSeries
Loading required package: timeDate
> data<-yahooKeystats("IBM")
trying URL 'http://finance.yahoo.com/q/ks?s=IBM'
Content type 'text/html; charset=utf-8' length unknown
opened URL
.......... .......... .......... .......
downloaded 37 Kb
Read 151 items
> typeof(data)
[1] "list"
> data
                                                            Value
Symbol                                                        IBM
Date                                                   2009-04-27
Market Cap (intraday)              <span id="yfs_j10_ibm">132.36B
Enterprise Value (27-Apr-09)                              150.79B
Trailing PE (ttm intraday)                                  11.13
Fiscal Year Ends                                           31-Dec
Most Recent Quarter (mrq)                               31-Mar-09
Profit Margin (ttm)                                        12.21%
Operating Margin (ttm)                                     17.40%
Return on Assets (ttm)                                      9.80%
Return on Equity (ttm)                                     58.16%
Revenue (ttm)                                             100.84B
Revenue Per Share (ttm)                                    74.845
Qtrly Revenue Growth (yoy)                                -11.40%
Gross Profit (ttm)                                         45.66B
EBITDA (ttm)                                               23.01B
Net Income Avl to Common (ttm)                             12.31B
Diluted EPS (ttm)                                            9.01
Qtrly Earnings Growth (yoy)                                -1.00%
Total Cash (mrq)                                           12.30B
Total Cash Per Share (mrq)                                  9.314
Total Debt (mrq)                                           30.98B
Total DebtEquity (mrq)                                         NA
Current Ratio (mrq)                                         1.176
Book Value Per Share (mrq)                                 10.304
Operating Cash Flow (ttm)                                  18.81B
Levered Free Cash Flow (ttm)                               12.03B
Beta                                                         0.78
52-Week Change                                            -18.69%
S&P500 52-Week Change                                     -38.03%
52-Week High (24-Jul-08)                                   130.93
52-Week Low (21-Nov-08)                                     69.50
50-Day Moving Average                                       96.26
200-Day Moving Average                                      89.12
Average Volume (3 month)                                 11641500
Average Volume (10 day)                                  10376000
Shares Outstanding                                          1.32B
Float                                                       1.30B
% Held by Insiders                                          0.04%
% Held by Institutions                                     60.80%
Shares Short (as of 26-Mar-09)                             19.41M
Short Ratio (as of 26-Mar-09)                                 1.7
Short % of Float (as of 26-Mar-09)                          1.40%
Shares Short (prior month)                                 19.30M
Forward Annual Dividend Rate                                 2.00
Forward Annual Dividend Yield                               2.00%
Trailing Annual Dividend Rate                                2.00
Trailing Annual Dividend Yield                              2.00%
5 Year Average Dividend Yield                               1.30%
Payout Ratio                                                  21%
Dividend Date                                           09-Mar-09
Ex-Dividend Date                                        06-Feb-09
Last Split Factor (new per old)                               2/1
Last Split Date                                         27-May-99

From the help page, it says that yahooKeystats returns a dataframe,
but typeof() lists it as a list.  Is there a way to just pull out the
number of float shares?  Something along the lines of:

data$Float  or  data[Float]

Neither have worked for me.  Thanks.

James


More information about the R-help mailing list