Dear R lists,
Would anyone help me with setting data frames according to the date?
X.RIC Date.G. Time.G. GMT.Offset Type Price
Volume Time
1 QAN.AX 01-DEC-2008 00:00:28.611 11 Trade 2.28 105 2008-12-01
11:00:28.611
2 QAN.AX 01-DEC-2008 00:00:43.155 11 Trade 2.28 250 2008-12-01
11:00:43.155
3 QAN.AX 01-DEC-2008 00:01:06.677 11 Trade 2.29 6439 2008-12-01
11:01:06.677
4 QAN.AX 01-DEC-2008 00:01:06.677 11 Trade 2.29 3699 2008-12-01
11:01:06.677
5 QAN.AX 02-DEC-2008 00:01:06.677 11 Trade 2.29 7212 2008-12-02
11:01:06.677
6 QAN.AX 01-DEC-2008 00:01:06.919 11 Trade 2.29 42 2008-12-01
11:01:06.919
7 QAN.AX 01-DEC-2008 00:02:46.452 11 Trade 2.28 974 2008-12-01
11:02:46.452
8 QAN.AX 03-DEC-2008 00:03:17.646 11 Trade 2.28 13847 2008-12-03
11:03:17.646
9 QAN.AX 01-DEC-2008 00:03:17.652 11 Trade 2.28 10000 2008-12-01
11:03:17.652
10 QAN.AX 01-DEC-2008 00:03:17.652 11 Trade 2.28 17 2008-12-01
11:03:17.652
my data looks like above, but definitely with more rows. Now I want a data
frame with only "2008-12-02" in the first part of the 8th
variable---Time.
Can anyone please help me with this? Thank you!
Cheers,
Carol
[[alternative HTML version deleted]]
On 05/01/2010 02:55 PM, Carol Gao wrote:> Dear R lists, > ... > Would anyone help me with setting data frames according to the date? > ... > my data looks like above, but definitely with more rows. Now I want a data > frame with only "2008-12-02" in the first part of the 8th variable---Time. >Hi Carol, I would do something like this: my.data.frame[format(my.data.frame$Time,"%Y-%m-%d") == "2008-12-02",] although there may be a better way by extracting only the day from the Time field. Jim