[R] losing row.names in matrix operations

rcoder mpdotbook at gmail.com
Sat Aug 2 13:50:07 CEST 2008


Hi everyone,

I have a data frame, with the following format:

MatDate->
	row.names	ID1	ID2	ID3
1	date1
2	date1
3	date3
	etc

but I cannot perform a rollapply() statement on the matrix without
converting the matrix into a time series.
i.e. MatTs<-ts(MatDate)

Only then will my rollapply statement work:
MatMin<-rollapply(MatTs, 2,by=2, min, na.rm=F)

If I apply the rollapply() statement to the dataframe, I get the following
error: Error: could not find function "rollapply"

The problem is that when I convert the data.frame matrix into a time series
matrix, I lose the dates in the row.names column. I just want to know if
anyone could suggest a way to get around this problem, i.e. keep the
row.names column in place, and use the rollapply() statement as above.

Thanks,

rcoder
-- 
View this message in context: http://www.nabble.com/losing-row.names-in-matrix-operations-tp18788509p18788509.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list