[R] aggregate() - error message

Juliane Struve juliane_struve at yahoo.co.uk
Thu Sep 24 12:52:15 CEST 2009


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







More information about the R-help mailing list