[R] Grouping distances

Jhope jeanwaijang at gmail.com
Mon Jun 11 08:01:57 CEST 2012


Hi R-listers, 

I am trying to group my HTL data, this is a column of data of "Distances to
the HTL" data = turtlehatch. I would like to create an Index of distances
(0-5m, 6-10, 11-15, 16-20... up to 60). And then create a new file with this
HTLIndex in a column. 

So far I have gotten this far: 

HTL.index <- function (values, weights=c(0, 5, 10, 15, 20, 25, 30, 35, 40,
45, 50, 55, 60)) { 
hope <-values * weights 
return (apply(hope, 1, sum)/apply(values, 1, sum)) 
} 
write.csv(turtlehatch, "HTLIndex", row.names=FALSE) 
---- 

But I do not seem to be able to create a new column " in a new file. 

Please advise, Jean 

--
View this message in context: http://r.789695.n4.nabble.com/Grouping-distances-tp4632985.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list