Description Usage Arguments Value Examples
This function computes the area of a polygon X.
1 | area(X)
|
X |
a polygon dataframe of x and y coordinates |
area of the polygon x.
1 2 3 4 5 6 7 8 9 10 11 12 13 | filename<-system.file('data/YET629_02_w1L488nm-L561nm_sequence-10000.zip', package='yeast')
roi <- read.ijzip(filename)
cordi <- roi$`001_001`$coords
X <- data.frame(X=cordi[,1], Y=cordi[,2])
area<-function(X){
X<-cbind(X$X, X$Y)
X<-rbind(X,X[1,])
x<-X[,1]; y<-X[,2]; lx<-length(x)
-sum((x[2:lx]-x[1:lx-1])*(y[2:lx]+y[1:lx-1]))/2
}
area(X)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.