Skip to content
Prev 13562 / 15274 Next

Creating an index based on a time variable

You didn't follow the posting guide.  Your example is not reproducible,
and posting HTML that just gets converted to plain text doesn't help.

I assume that you currently have a data.frame as is output by read.csv.

Why are you converting it to a matrix?

I guess that what you want from your data.frame is most likely something
like this:

sector_returns <- read.csv("Sector.csv", head=TRUE)
sector_returns <- xts(sector_returns[,-1],
order.by=as.Date(sector_returns[,1], format="%m/%d/%Y"))


see 

?xts

and

?strftime

for more information.


Regards,

Brian
On Wed, 2015-10-21 at 15:05 -0400, Am Gut wrote: