Skip to content
Prev 176 / 15274 Next

ts-plotting?

Dear Arshia,

in those cases (and not only in those cases!) str() is your friend which
will tell you that the series in EuStockMarkets are of type ts, whereas the
data on IBM stock is not.

library(fBasics)
IBM = yahooImport(query =
"s=IBM&a=11&b=1&c=1999&d=0&q=31&f=2000&z=IBM&x=.csv",
try = TRUE)
str(IBM) 
#
data(EuStockMarkets)
str(EuStockMarkets)

Now, having said this, you can convert IBM to an ts object (but have a look
at the contributed packages 'its' and 'zoo' too, in order to get acquainted
how to deal with irregular series). However, in order to get time labels
beneath your x-axes it would suffice to save the 'rownames(IBM)' into a
nicely date format first, and then use pretty() such that your labels are
not utterly cluttered in your graph and plot them. This approach has been
outlined many time on R-Help, try a Google search through the archives.

Hopefully, these pointers have helped you by figuring out what is going on
and why, as well as to solve the problem by yourself.

Cheers,
Bernhard
--------------------------------------------------------------------------------
The information contained herein is confidential and is inte...{{dropped}}