meanareamat.Rd 1.24 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/operationareamat.R
\name{meanareamat}
\alias{meanareamat}
\title{Function for getting the mean value of an area on a matrix.}
\usage{
meanareamat(m, rowmin, rowmax, colmin, colmax)
}
\arguments{
\item{m}{A matrix object}
Ahmad Alkadri's avatar
Ahmad Alkadri committed
11
12
13
14
15
16
17
18
19
20
21
22

\item{rowmin}{The first row for subsetting. Taking an example from the description above,
the rowmin is 1}

\item{rowmax}{The last row for subsetting. Taking an example from the description above,
the rowmax is 3}

\item{colmin}{The first column for subsetting. Taking an example from the description above,
the colmin is 2}

\item{colmax}{The last column for subsetting. Taking an example from the description above,
the colmax is 5}
23
24
25
26
27
28
29
30
31
32
33
34
35
36
}
\value{
The mean value of the subsetted area of matrix m
}
\description{
A function for calculating the mean value of an area of a matrix.
For example if we want to get the mean value of part of a 10x10 matrix, starting from
2nd column, 1st row to 3rd row, 5th column, we'll get the values of this smaller matrix
(3x4 to be precise) and then we'll calculate the mean of all of them.
}
\examples{
m <- matrix(rnorm(100, mean = 0, sd = 1), nrow = 10, ncol = 10)
meanarea <- meanareamat(m, rowmin = 1, rowmax = 3, colmin = 2, colmax = 5)
}