[R] Military Time Comparison

Jim Holtman jholtman at gmail.com
Mon Feb 27 12:24:46 CET 2012


what does 'str' of the object show?  are the columns factors/characters?  does the comparison have to consider the date?  
Sent from my iPad

On Feb 27, 2012, at 0:37, Edgar Alminar <eaalminar at ucsd.edu> wrote:

> Oh, haha -- sorry for the vagueness:
> 
> I was expecting to get the comparison to work. I also didn't mention that the dataset is much larger; I just wanted to give the first few rows. 
> 
> So, basically, I have a bunch of times in three columns, and I'm looking to compare them in which the command works correctly. 
> 
> Let's say, using the example below, that I want to get:
> 
>>> match2 = subset(match2, AEONTIME < INFTIME.x)
> 
> Well, with that exact syntax, it's not working because I'm getting back a dataset in which some AEONTIMEs are actually > INFTIME.x.
> 
> So, I feel like I'm just missing a piece of the syntax (i.e. as.date, as.character, but what works for time?)
> 
> I hope this helps. :-)
> 
> Thanks!
> 
> 
> On Feb 26, 2012, at 9:32 PM, David Winsemius wrote:
> 
>> 
>> On Feb 26, 2012, at 10:31 PM, Edgar Alminar wrote:
>> 
>>> Hello All,
>>> I have this dataset:
>>> 
>>>  RID VISCODE      SCRNO RECNO AEWHEN   AEONDATE AEONTIME INFPOINT.x  INFDATE.x INFTIME.x INFPOINT.y  INFDATE.y INFTIME.y
>>> 1   100     w00 IGI1480069     4      2 09/15/2009     1118          1 09/15/2009       947         14         -4      1117
>>> 2   100     w00 IGI1480069     8      2 09/15/2009     1132          1 09/15/2009       947         14         -4      1117
>>> 3   100     w00 IGI1480069     5      2 09/15/2009     1125          1 09/15/2009       947         14         -4      1117
>>> 
>>> 
>>> 
>>> I have AEONTIME, INFTIME.x, and INFTIME.y, and they are all military times.
>>> I'm trying to do a comparison like this:
>>> 
>>> match2 = subset(match2, AEONTIME < INFTIME.x)
>>> 
>>> But it's not working correctly.
>> 
>> Define what you expected. In the sample you offered none of those logical comparisons would be true so you should get a dataframe with zero rows. (And since you gave the result the same name, you have basically wiped out match2.)
>> 
>> 
>>> How do I do this? :-)
>> 
>> Do what?
>> 
>> -- 
>> 
>> David Winsemius, MD
>> Heritage Laboratories
>> West Hartford, CT
>> 
> 
> Edgar Alminar
> Clinical Operations
> Alzheimer's Disease Cooperative Study
> University of California, San Diego
> 9500 Gilman Drive, MC-0949
> La Jolla, CA 92093-0949
> Tel: (858) 622-8798
> Fax: (858) 622-5876
> Email: eaalminar at ucsd.edu
> 
> Confidentiality Notice- This e-mail message from the Alz...{{dropped:11}}
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list