>> 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.
>

The Login column contain all numeric values . I don't understand why I need
to convert that variable to numeric?

login column contain data like this :

> sample$Login

[35881] .00      1.00     .00      1.00     .00      .00      1.00
2.00
[35889] 1.00     3.00     .00      .00      .00      1.00     .00
32.00
[35897] 2.00     4.00     .00      17.00    3.00     1.00     12.00
.00
[35905] 8.00     .00      3.00     7.00     .00      17.00    .00
4.00
[35913] 16.00    4.00     20.00    7.00     .00      22.00    18.00
1.00
[35921] 3.00     3.00     .00      .00      37.00    3.00     12.00
3.00
[35929] 2.00     11.00    .00      5.00     77.00    1.00     4.00
1.00
[35937] 9.00     18.00    3.00     3.00     4.00     14.00    2.00

The mode of Login is numeric only :

> mode(sample$Login)
[1] "numeric"
>

 And I am also using as.numeric(as.character(sample$Login), still it has
some warning and NA . I don't understand why this is happening.  could you
explain?

> avglog <- with(sample1, tapply(as.numeric(as.character(sample$Login)),
stdate, mean))
Warning message:
In tapply(as.numeric(as.character(sample$Login)), stdate, mean) :
  NAs introduced by coercion
> avglog
01/11/09 00:00 02/11/09 00:00 03/11/09 00:00 04/11/09 00:00 05/11/09 00:00
      22.04866       16.65358             NA       15.84970       16.58600
06/11/09 00:00 07/11/09 00:00
      16.20743       18.52379

Thanks & Rg
Mohan L

	[[alternative HTML version deleted]]

