[R] Re :argument is not numeric or logical
David Winsemius
dwinsemius at comcast.net
Sun May 2 16:28:29 CEST 2010
On May 2, 2010, at 10:22 AM, Mohan L wrote:
>
>
>
>
> Your code has a different name for the sample object. And it would
> be more informative if you offered str on "sample1".
>
> This is the result of str on "sample1".
> > str(sample1)
> 'data.frame': 35943 obs. of 17 variables:
> $ stdate : Factor w/ 7 levels "01/11/09 00:00",..: 1 1 1 1 1 1
> 1 1 1 1 ...
So stdate is not a date variable but that is probably not your problem
since it looks like the time portion of your not-dates are all
"00:00". tapply can work with this information
>
snipped
> $ Login : Factor w/ 419 levels ".00","1.00","10.00",..: 114
> 283 217 216 14 1 2 2 407 327 ...
So "Login" is not a numeric class variable. Read the FAQ about the
proper way to convert that variable to numeric without loosing
information.
--
David.
> $ EISent : Factor w/ 250 levels ".00","1.00","10.00",..: 1 132
> 23 132 2 1 1 1 1 2 ...
> $ EIReceived : num 12 5 43 0 8 2 11 12 4 0 ...
> $ PMSent : Factor w/ 298 levels ".00","1.00","10.00",..: 1 1 1
> 1 1 1 1 1 1 1 ...
> $ PMReceived : num 8 4 61 1 12 8 0 9 1 0 ...
>
>
> What I am trying is: I have 7 days data in .csv format. I need to
> the average Login for first day(1/11/2009) , from this average I
> have to calculate index divisor(ID). Then I have to calculate the
> average Login for all 7 days and need to multiple each day Login
> average with index divisor(ID), like this
>
> stdate LoginAverage Index
> 1/11/2009 29.50 LoginAverage*ID
>
> This what I am trying? Any help will be appreciated
>
> Thanks for your time.
>
> Thanks & Rg
> Mohan L
>
>
>
David Winsemius, MD
West Hartford, CT
More information about the R-help
mailing list