One of undoubtedly many ways:
# kind of a pain to delete the blank rows. Try to give us full example
next time?
> txt<- "long lat value
+ 10 20 5
+ 6 2 3
+ 27-3 9
+ 10 20 10
+ 4 -1 0
+ 6 2 9
+ "
> DF2 <- read.table(textConnection
Thanks - that's great!
_
Choose the perfect PC or mobile phone for you
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide ht
try aggregate(), e.g.,
dat <- read.table(textConnection("long lat value
10 20 5
6 2 3
27-3 9
10 20 10
4 -1 0
6 2 9"), header = TRUE)
closeAllConnections()
aggregate(dat["value"], list(Long = dat$long, Lat = dat$lat), sum)
I
Try this:
aggregate(dt$value, list(long = dt$long, lat = dt$lat), FUN = sum)
On Mon, Jan 12, 2009 at 1:52 PM, Steve Murray wrote:
>
> Dear all,
>
>
>
> I have a dataframe of 3 columns, consisting of 'longitude', 'latitude'
> and a corresponding 'value'. Where identical 'longitude' and 'latitude'
Dear all,
I have a dataframe of 3 columns, consisting of 'longitude', 'latitude'
and a corresponding 'value'. Where identical 'longitude' and 'latitude'
pairs occur more than once, I want their corresponding 'value' to be
summed and the 'pair' to only appear once.
For example:
long lat
5 matches
Mail list logo