Commit 622cf5ea authored by Ahmad Alkadri's avatar Ahmad Alkadri 🎧

Added three new functions for statistical operations on a subsetted part of a matrix

parent b8186958
{
"path" : "~/Documents/These/Works/Current models/R_packages/rterahertz",
"path" : "~/Documents/These/Works/Current models/R_packages/rterahertz/R",
"sortOrder" : [
{
"ascending" : true,
......
{
"activeTab" : -1
"activeTab" : 1
}
\ No newline at end of file
{
"left" : {
"panelheight" : 817,
"splitterpos" : 340,
"topwindowstate" : "HIDE",
"splitterpos" : 339,
"topwindowstate" : "NORMAL",
"windowheight" : 855
},
"right" : {
"panelheight" : 817,
"splitterpos" : 512,
"splitterpos" : 511,
"topwindowstate" : "NORMAL",
"windowheight" : 855
}
......
{
"TabSet1" : 4,
"TabSet2" : 2,
"TabSet1" : 3,
"TabSet2" : 3,
"TabZoom" : {
}
}
\ No newline at end of file
build-last-errors="[]"
build-last-errors-base-dir="~/Documents/These/Works/Current models/R_packages/rterahertz/"
build-last-outputs="[{\"output\":\"==> devtools::document(roclets = c('rd', 'collate', 'namespace'))\\n\\n\",\"type\":0},{\"output\":\"Updating rterahertz documentation\\n\",\"type\":2},{\"output\":\"Loading rterahertz\\n\",\"type\":2},{\"output\":\"Warning: The existing 'NAMESPACE' file was not generated by roxygen2, and will not be overwritten.\\n\",\"type\":2},{\"output\":\"Documentation completed\\n\\n\",\"type\":1},{\"output\":\"==> R CMD INSTALL --preclean --no-multiarch --with-keep.source rterahertz\\n\\n\",\"type\":0},{\"output\":\"* installing to library ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library’\\n\",\"type\":1},{\"output\":\"* installing *source* package ‘rterahertz’ ...\\n\",\"type\":1},{\"output\":\"** using staged installation\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"** R\\n\",\"type\":1},{\"output\":\"** byte-compile and prepare package for lazy loading\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"** help\\n\",\"type\":1},{\"output\":\"*** installing help indices\\n\",\"type\":1},{\"output\":\"** building package indices\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"** testing if installed package can be loaded from temporary location\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"** testing if installed package can be loaded from final location\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"** testing if installed package keeps a record of temporary installation path\\n\",\"type\":1},{\"output\":\"* DONE (rterahertz)\\n\",\"type\":1},{\"output\":\"\",\"type\":1}]"
build-last-outputs="[{\"output\":\"==> devtools::document(roclets = c('rd', 'collate', 'namespace'))\\n\\n\",\"type\":0},{\"output\":\"Updating rterahertz documentation\\n\",\"type\":2},{\"output\":\"Loading rterahertz\\n\",\"type\":2},{\"output\":\"Warning: The existing 'NAMESPACE' file was not generated by roxygen2, and will not be overwritten.\\n\",\"type\":2},{\"output\":\"Documentation completed\\n\\n\",\"type\":1},{\"output\":\"==> R CMD INSTALL --preclean --no-multiarch --with-keep.source rterahertz\\n\\n\",\"type\":0},{\"output\":\"* installing to library ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library’\\n\",\"type\":1},{\"output\":\"* installing *source* package ‘rterahertz’ ...\\n\",\"type\":1},{\"output\":\"** using staged installation\\n\",\"type\":1},{\"output\":\"** R\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"** byte-compile and prepare package for lazy loading\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"** help\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"*** installing help indices\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"** building package indices\\n\",\"type\":1},{\"output\":\"** testing if installed package can be loaded from temporary location\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"** testing if installed package can be loaded from final location\\n\",\"type\":1},{\"output\":\"\",\"type\":1},{\"output\":\"** testing if installed package keeps a record of temporary installation path\\n\",\"type\":1},{\"output\":\"* DONE (rterahertz)\\n\",\"type\":1},{\"output\":\"\",\"type\":1}]"
compile_pdf_state="{\"errors\":[],\"output\":\"\",\"running\":false,\"tab_visible\":false,\"target_file\":\"\"}"
files.monitored-path=""
find-in-files-state="{\"handle\":\"\",\"input\":\"\",\"path\":\"\",\"regex\":true,\"results\":{\"file\":[],\"line\":[],\"lineValue\":[],\"matchOff\":[],\"matchOn\":[]},\"running\":false}"
......
/var/folders/c6/tg6sdkps6px9bnqlhd8bgm980000gp/T//RtmpbmdqKv/preview-31283b403343.html
/var/folders/c6/tg6sdkps6px9bnqlhd8bgm980000gp/T//RtmpbmdqKv/preview-313c484c33ef.html
/private/var/folders/c6/tg6sdkps6px9bnqlhd8bgm980000gp/T/RtmpoAUr4S/preview-46d4b45546d.dir/LICENSE.html
/private/var/folders/c6/tg6sdkps6px9bnqlhd8bgm980000gp/T/RtmpoAUr4S/preview-46d34a9e6b6.dir/LICENSE.html
/private/var/folders/c6/tg6sdkps6px9bnqlhd8bgm980000gp/T/RtmpoAUr4S/preview-46d7e69d1bc.dir/LICENSE.html
/private/var/folders/c6/tg6sdkps6px9bnqlhd8bgm980000gp/T/RtmpoAUr4S/preview-46d5548ce7a.dir/LICENSE.html
/private/var/folders/c6/tg6sdkps6px9bnqlhd8bgm980000gp/T/RtmpoAUr4S/preview-46d41ca57b9.dir/LICENSE.html
/var/folders/c6/tg6sdkps6px9bnqlhd8bgm980000gp/T//RtmpRVTisb/preview-31b4306d33f.html
/Users/alkadri/Documents/These/Works/Current data/Essai_Terahertz/Essai_02072019/Essai_1_peuplier/image_correction.R="F54D62AD"
/Users/alkadri/Documents/These/Works/Current models/R_packages/rterahertz/DESCRIPTION="ED7C675B"
/Users/alkadri/Documents/These/Works/Current models/R_packages/rterahertz/LICENSE.md="26FD2F15"
/Users/alkadri/Documents/These/Works/Current models/R_packages/rterahertz/NAMESPACE="311E7F2A"
/Users/alkadri/Documents/These/Works/Current models/R_packages/rterahertz/R/correctingmatTHz.R="1AFE8C53"
/Users/alkadri/Documents/These/Works/Current models/R_packages/rterahertz/R/matrixlineextractions.R="AAFF1D0C"
/Users/alkadri/Documents/These/Works/Current models/R_packages/rterahertz/R/operationareamat.R="9B6DCEB2"
/Users/alkadri/Documents/These/Works/Current models/R_packages/rterahertz/R/plottingfunctions.R="630E2B53"
/Users/alkadri/Documents/These/Works/Current models/R_packages/rterahertz/README.Rmd="E09D53C9"
/Users/alkadri/Documents/These/Works/Current models/R_packages/rterahertz/README.md="3CBD3EB8"
......
#' Function for getting the mean value of an area on a matrix.
#'
#' @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.
#'
#' @usage meanareamat(m, rowmin, rowmax, colmin, colmax)
#'
#' @param m A matrix object
#'
#' @return The mean value of the subsetted area of matrix m
#'
#' @examples
#' m <- matrix(rnorm(100, mean = 0, sd = 1), nrow = 10, ncol = 10)
#' meanarea <- meanareamat(m, rowmin = 1, rowmax = 3, colmin = 2, colmax = 5)
meanareamat <- function(m, rowmin, rowmax, colmin, colmax){
m_n <- m[rowmin:rowmax,colmin:colmax]
mean_m <- mean(m_n)
rm(m_n)
return(mean_m)
}
#' Function for getting the median value of an area on a matrix.
#'
#' @description A function for calculating the median value of an area of a matrix.
#' For example if we want to get the median 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 median of all of them.
#'
#' @usage medianareamat(m, rowmin, rowmax, colmin, colmax)
#'
#' @param m A matrix object
#'
#' @return The median value of the subsetted area of matrix m
#'
#' @examples
#' m <- matrix(rnorm(100, mean = 0, sd = 1), nrow = 10, ncol = 10)
#' medianarea <- medianareamat(m, rowmin = 1, rowmax = 3, colmin = 2, colmax = 5)
medianareamat <- function(m, rowmin, rowmax, colmin, colmax){
m_n <- m[rowmin:rowmax,colmin:colmax]
median_m <- median(m_n)
rm(m_n)
return(median_m)
}
#' Function for getting the standard deviation value of an area on a matrix.
#'
#' @description A function for calculating the standard deviation value of an area of a matrix.
#' For example if we want to get the standard deviation 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 standard deviation of all of them.
#'
#' @usage sdareamat(m, rowmin, rowmax, colmin, colmax)
#'
#' @param m A matrix object
#'
#' @return The standard deviation value of the subsetted area of matrix m
#'
#' @examples
#' m <- matrix(rnorm(100, mean = 0, sd = 1), nrow = 10, ncol = 10)
#' sdarea <- sdareamat(m, rowmin = 1, rowmax = 3, colmin = 2, colmax = 5)
sdareamat <- function(m, rowmin, rowmax, colmin, colmax){
m_n <- m[rowmin:rowmax,colmin:colmax]
sd_m <- sd(m_n)
rm(m_n)
return(sd_m)
}
% 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}
}
\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)
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/operationareamat.R
\name{medianareamat}
\alias{medianareamat}
\title{Function for getting the median value of an area on a matrix.}
\usage{
medianareamat(m, rowmin, rowmax, colmin, colmax)
}
\arguments{
\item{m}{A matrix object}
}
\value{
The median value of the subsetted area of matrix m
}
\description{
A function for calculating the median value of an area of a matrix.
For example if we want to get the median 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 median of all of them.
}
\examples{
m <- matrix(rnorm(100, mean = 0, sd = 1), nrow = 10, ncol = 10)
medianarea <- medianareamat(m, rowmin = 1, rowmax = 3, colmin = 2, colmax = 5)
}
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/operationareamat.R
\name{sdareamat}
\alias{sdareamat}
\title{Function for getting the standard deviation value of an area on a matrix.}
\usage{
sdareamat(m, rowmin, rowmax, colmin, colmax)
}
\arguments{
\item{m}{A matrix object}
}
\value{
The standard deviation value of the subsetted area of matrix m
}
\description{
A function for calculating the standard deviation value of an area of a matrix.
For example if we want to get the standard deviation 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 standard deviation of all of them.
}
\examples{
m <- matrix(rnorm(100, mean = 0, sd = 1), nrow = 10, ncol = 10)
sdarea <- sdareamat(m, rowmin = 1, rowmax = 3, colmin = 2, colmax = 5)
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment