Skip to content
Prev 58638 / 398502 Next

selecting by date (was Matrix Indexing)

This is about indexing a data frame: `matrix indexing' is something 
different.
On Sun, 7 Nov 2004, Kim Fai Wong wrote:

            
Well, it isn't going to work as the file is not Comma Separated Values.
Perhaps you need to look at ?read.table and tell us exactly what you 
propose to use.  I am guessing the first column will become row names.

When you have read this in, `inputframe' is a data frame, and not a 
matrix.
dates <- as.Date(row.names(inputframe), format="%m/%d/%y")
inputframe[dates >= start_date & dates < end_date, ]

where start_date and end_date are dates (not character strings in some 
strange non-ISO format).
Your reading the posting guide and following its advice would be 
appreciated, including reading `An Introduction to R'.