[R] aggregate() - error message

Juliane Struve juliane_struve at yahoo.co.uk
Thu Sep 24 14:23:17 CEST 2009


Dear all,


thanks you very much for replying. However, this does not seem to solve the problem.
I still get the same error message when using TripsData[,2:3].

Is there anything else that could be wrong with this statement or the data ? What length is the error message referring to ?

Many thanks,

Juliane 


 Dr. Juliane Struve
Environmental Scientist
10, Lynwood Crescent
Sunningdale SL5 0BL
01344 620811 



----- Original Message ----
From: Paul Emberson <email at calidasoft.co.uk>
To: Juliane Struve <juliane_struve at yahoo.co.uk>
Cc: r-help at r-project.org
Sent: Thursday, 24 September, 2009 12:27:00
Subject: Re: [R] aggregate() - error message

Hi,

Are you trying to get columns 2 and 3 from TripsData in which case you need to say TripsData[,2:3] ?

Paul

Juliane Struve wrote:
> Dear list,
>  would anybody be able to tell me why the statement  Tripstatistics=aggregate(TripsData[2:3],by=list(Trip=Tripmatch),FUN="mean")
>  seems to work well with TripsData 1 but not with TripsData 2 ?
>  With TripsData 2 it yields  Error in FUN(X[[1L]], ...) : arguments must have same length
> 
> I can't see a difference in the two data sets. Could someone shed light on the error message ? Maybe that would help me figure out where the problem is.
>  Thanks very much for any help.  Juliane  PS: The examples below contain the  first 5 rows  of my two datafiles.    TripsData 1 
>            Trip Distance TimeDiff Tripmatch
> 7329 35,36 172.7453  0.0041    35,36
> 7371 36,35 172.7453  0.0004    35,36
> 7372 35,36 172.7453  0.0000    35,36
> 7373 36,35 172.7453  0.0004    35,36
> 7374 35,36 172.7453  0.0001    35,36
> 
>  TripsData 2
>              Trip Distance TimeDiff Tripmatch
> 1617 19,20 1087.365  0.0441    19,20
> 1899 20,19 1087.365  0.0207    19,20
> 1915 19,20 1087.365  0.0361    19,20
> 3285 20,19 1087.365  0.0356    19,20
> 3826 19,20 1087.365  0.0697    19,20
> 
> 
> 
> 
> ______________________________________________
> 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