[R] Extract one element from yahooKeystats data

David Winsemius dwinsemius at comcast.net
Tue Apr 28 00:55:45 CEST 2009


On Apr 27, 2009, at 3:43 PM, J Toll wrote:

> 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.

Well, a dataframe is a list after all.

>  Is there a way to just pull out the
> number of float shares?  Something along the lines of:
>
> data$Float  or  data[Float]

The first would give you a vector of all the values of Float in that  
dataframe. The second would probably not give you what you want,  
because that is a construction that would presume Float to be a  
logical vector.
>
> Neither have worked for me.  Thanks.

Define "worked". Around these parts "did not work" requires code that  
produces some sort of error message or <something> that departs from  
what you expected (which should also be explicitly stated).

>

David Winsemius, MD
Heritage Laboratories
West Hartford, CT



More information about the R-help mailing list