Re: [R] Question on creating Date variable

2013-01-01 Thread David Winsemius
,2) #y AM_PM #1 2013-01-01 11:00:00AM #2 2013-01-01 11:15:00AM A.K. ----- Original Message - From: Christofer Bogaso To: David Winsemius ; David L Carlson > Cc: r-help@r-project.org Sent: Tuesday, January 1, 2013 12:40 AM Subject: Re: [R] Question on creating D

Re: [R] Question on creating Date variable

2013-01-01 Thread jim holtman
ead(y1,2) > #y AM_PM > #1 2013-01-01 11:00:00AM > #2 2013-01-01 11:15:00AM > A.K. > > > > > > ----- Original Message - > From: Christofer Bogaso > To: David Winsemius ; David L Carlson > > Cc: r-help@r-project.org > Sent: Tu

Re: [R] Question on creating Date variable

2013-01-01 Thread arun
#    y AM_PM #1 2013-01-01 11:00:00    AM #2 2013-01-01 11:15:00    AM A.K. - Original Message - From: Christofer Bogaso To: David Winsemius ; David L Carlson Cc: r-help@r-project.org Sent: Tuesday, January 1, 2013 12:40 AM Subject: Re: [R] Question on creating Date var

Re: [R] Question on creating Date variable

2013-01-01 Thread David Winsemius
On Dec 31, 2012, at 9:40 PM, Christofer Bogaso wrote: On 01 January 2013 03:00:18, David Winsemius wrote: On Dec 31, 2012, at 11:57 AM, David Winsemius wrote: On Dec 31, 2012, at 11:54 AM, Christofer Bogaso wrote: On 01 January 2013 01:29:53, David Winsemius wrote: On Dec 31, 2012, at

Re: [R] Question on creating Date variable

2013-01-01 Thread Rui Barradas
Hello, The format AM/PM should be for display purposes only, when you use format() you get a variable of class "character", not of classes "POSIXct" "POSIXt" . Produce a variable y with as.POSIXct (without AM/PM) for arithmetics and another formated for display. Hope this helps, Rui Barrada

Re: [R] Question on creating Date variable

2012-12-31 Thread Christofer Bogaso
On 01 January 2013 03:00:18, David Winsemius wrote: On Dec 31, 2012, at 11:57 AM, David Winsemius wrote: On Dec 31, 2012, at 11:54 AM, Christofer Bogaso wrote: On 01 January 2013 01:29:53, David Winsemius wrote: On Dec 31, 2012, at 11:35 AM, Christofer Bogaso wrote: On 01 January 2013 0

Re: [R] Question on creating Date variable

2012-12-31 Thread arun
" "2012-12-31 15:25:00 PM" "2012-12-31 15:51:00 PM" str(ifelse(format(res,"%H:%M")>=12, paste(res,"PM"), paste(res,"AM")))  #chr [1:15] "2012-12-31 11:00:00 AM" "2012-12-31 11:14:00 AM" ... str(res) # POSIXct[1:15], format: &q

Re: [R] Question on creating Date variable

2012-12-31 Thread David Winsemius
On Dec 31, 2012, at 11:57 AM, David Winsemius wrote: On Dec 31, 2012, at 11:54 AM, Christofer Bogaso wrote: On 01 January 2013 01:29:53, David Winsemius wrote: On Dec 31, 2012, at 11:35 AM, Christofer Bogaso wrote: On 01 January 2013 00:17:50, David Winsemius wrote: On Dec 31, 2012, at

Re: [R] Question on creating Date variable

2012-12-31 Thread David L Carlson
uot;2012-12-31 03:31 PM" "2012-12-31 02:38 PM" -- David L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77843-4352 > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-hel

Re: [R] Question on creating Date variable

2012-12-31 Thread David Winsemius
On Dec 31, 2012, at 11:54 AM, Christofer Bogaso wrote: On 01 January 2013 01:29:53, David Winsemius wrote: On Dec 31, 2012, at 11:35 AM, Christofer Bogaso wrote: On 01 January 2013 00:17:50, David Winsemius wrote: On Dec 31, 2012, at 9:12 AM, Christofer Bogaso wrote: Hello all, Let say

Re: [R] Question on creating Date variable

2012-12-31 Thread Christofer Bogaso
On 01 January 2013 01:29:53, David Winsemius wrote: On Dec 31, 2012, at 11:35 AM, Christofer Bogaso wrote: On 01 January 2013 00:17:50, David Winsemius wrote: On Dec 31, 2012, at 9:12 AM, Christofer Bogaso wrote: Hello all, Let say I have following (numeric) vector: > x [1] 11.00 11.25 1

Re: [R] Question on creating Date variable

2012-12-31 Thread David Winsemius
On Dec 31, 2012, at 11:35 AM, Christofer Bogaso wrote: On 01 January 2013 00:17:50, David Winsemius wrote: On Dec 31, 2012, at 9:12 AM, Christofer Bogaso wrote: Hello all, Let say I have following (numeric) vector: > x [1] 11.00 11.25 11.35 12.01 11.14 13.00 13.25 13.35 14.01 13.14 14.5

Re: [R] Question on creating Date variable

2012-12-31 Thread Christofer Bogaso
On 01 January 2013 00:17:50, David Winsemius wrote: On Dec 31, 2012, at 9:12 AM, Christofer Bogaso wrote: Hello all, Let say I have following (numeric) vector: > x [1] 11.00 11.25 11.35 12.01 11.14 13.00 13.25 13.35 14.01 13.14 14.50 14.75 14.85 15.51 14.64 Now, I want to create a 'Date' va

Re: [R] Question on creating Date variable

2012-12-31 Thread David Winsemius
On Dec 31, 2012, at 9:12 AM, Christofer Bogaso wrote: Hello all, Let say I have following (numeric) vector: > x [1] 11.00 11.25 11.35 12.01 11.14 13.00 13.25 13.35 14.01 13.14 14.50 14.75 14.85 15.51 14.64 Now, I want to create a 'Date' variable (i.e. I should be able to do all calculat

Re: [R] Question on creating Date variable

2012-12-31 Thread Rui Barradas
Hello, Try the following. x <- scan(text = "11.00 11.25 11.35 12.01 11.14 13.00 13.25 13.35 14.01 13.14 14.50 14.75 14.85 15.51 14.64 ") hours <- floor(x) mins <- (100*x) %% 100 as.POSIXct(paste(Sys.Date(), hours, mins), format = "%Y-%m-%d %H %M") As you can see, there are three values of

[R] Question on creating Date variable

2012-12-31 Thread Christofer Bogaso
Hello all, Let say I have following (numeric) vector: > x [1] 11.00 11.25 11.35 12.01 11.14 13.00 13.25 13.35 14.01 13.14 14.50 14.75 14.85 15.51 14.64 Now, I want to create a 'Date' variable (i.e. I should be able to do all calculations pertaining to date/time and also time-series plotting