R/sums.R

sums <-
function (coords,dim,xmin=min(coords[,1]),xmax=max(coords[,1]),ymin=min(coords[,2]),ymax=max(coords[,2])){


	xints<-((xmax-xmin)/dim);
	yints<-((ymax-ymin)/dim);

	xbins<-seq(from=xmin, to=xmax-xints, by=xints);
	ybins<-seq(from=ymin, to=ymax-yints, by=yints);



	bins<-cbind(c(sapply(xbins,rep,dim)), rep(ybins,dim));
	cnts<-matrix(apply(bins,1,belongtoint,vect=coords,int.x=xints,int.y=yints),nrow=dim,byrow=TRUE);


}

Try the GriegSmith package in your browser

Any scripts or data that you put into this service are public.

GriegSmith documentation built on May 2, 2019, 12:07 p.m.