[R-sig-Geo] help to find this function

baptiste auguie ba208 at exeter.ac.uk
Sun Mar 29 19:16:17 CEST 2009


Hi,

could you provide an example for the data in "sample"?  (incidentally,  
note that sample is already the name of a built-in function)

I'm guessing you could do something like,

>
> library(doBy)
> summaryBy(count~ID, data= count_myData, FUN=sum)

tested with,

count_myData <- data.frame(ID=rep(c(1:4),each=4),  
count=abs(ceiling(rnorm(16,8,4))))


hope this helps,

baptiste

On 29 Mar 2009, at 17:54, gianni lavaredo wrote:

> Dear R user,
>
> Thanks for this sunday attention about my problem. I have a  
> data.frame like
> this example:
>
> count_myData
>
> ID: 1,1,1,1,2,2,2,3,3,3,3,3,4,4,4,4,4,4
> count: 4,4,4,4,3,3,3,5,5,5,5,5,6,6,6,6,6,6
>
> this data.frame derived from this code
>
> count_myData <- ddply(sample, .(ID), transform, sum = sum(Z >=0,  
> na.rm = T))
>
> with this I have the number of sample inside of area with ID 1, ID 2  
> ID 3
> etc etc.
> Now I need a data.frame like this
>
> new_myData
> ID:1,2,3,4
> count:4,3,5,6
>
> Thanks Gianni
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

_____________________________

Baptiste Auguié

School of Physics
University of Exeter
Stocker Road,
Exeter, Devon,
EX4 4QL, UK

Phone: +44 1392 264187

http://newton.ex.ac.uk/research/emag



More information about the R-sig-Geo mailing list