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
[email protected]
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

_______________________________________________
R-sig-Geo mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to