This is the output that i got > dput( head(allspecies, 20) ) structure(list(Year = c(1980L, 1980L, 1980L, 1980L, 1980L, 1980L, 1980L, 1980L, 1980L, 1980L, 1980L, 1980L, 1981L, 1981L, 1981L, 1981L, 1981L, 1981L, 1981L, 1981L), Quarter = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L ), latitude = c(54.9, 54.4833, 54.4833, 53.9167, 53.9167, 54.7833, 58.8667, 58.25, 58.25, 57.9, 57.9, 57.9667, 56.5333, 56.5333, 56.5333, 56.5333, 54.7167, 54.7167, 54.7167, 54.45), longitude = c(6.1333, 7.55, 7.55, 0.9, 0.9, 1.0333, -2.3833, -3.15, -3.15, -3.3667, -3.3667, -2.8333, -2.2, -2.2, -2.2, -2.2, 7.3333, 7.3333, 7.3333, 7.55), Depth = c(33, 24, 24, 49, 49, 55, 76, 69, 69, 57, 57, 73, 46, 46, 46, 46, 20, 20, 20, 20), Area = c(6L, 6L, 6L, 4L, 4L, 4L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 6L, 6L, 6L, 6L ), Species = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c("Agonus cataphractus", "Amblyraja radiata", "Anarhichas lupus", "Arnoglossus laterna", "Buglossidium luteum", "Echiichthys vipera", "Eutrigla gurnardus", "Gadus morhua", "Glyptocephalus cynoglossus", "Hippoglossoides platessoides", "Lepidorhombus whiffiagonis", "Limanda limanda", "Lophius piscatorius", "Melanogrammus aeglefinus", "Merlangius merlangus", "Merluccius merluccius", "Microstomus kitt", "Molva molva", "Pleuronectes platessa", "Pollachius virens", "Scyliorhinus canicula", "Solea solea", "Squalus acanthias", "Trisopterus esmarkii", "Trisopterus luscus", "Trisopterus minutus" ), class = "factor"), CPUE = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)), .Names = c("Year", "Quarter", "latitude", "longitude", "Depth", "Area", "Species", "CPUE"), row.names = 15:34, class = "data.frame")
-- View this message in context: http://r.789695.n4.nabble.com/weighted-averages-for-two-variables-tp4630589p4630604.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.