search for: top_no

Displaying 1 result from an estimated 1 matches for "top_no".

2005 Dec 21
2
Newbie - Summarize function
...nts to max; returning -Inf". Any suggetsions on how I can fix this would be greatly appreciated. Kind regards Andrew test <- read.table("test.csv", header=TRUE, sep=",") #function to calculate mean of "top" elements within a plot > g<-function(y) { + top_no <-max(y$top) + weight <- with(y,as.numeric(x>=x[order(x,decreasing=TRUE)[top_no]])) + wtd.mean(y$x,weight) + } > g(test) [1] 172.6667 #call to summarize function - use function g and summarise by stratum plot > test.2 <- with(test,summarize(test$x,llist(test$Stratum,test$plot),g))...