### 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" : [ "sortOrder" : [ { { "ascending" : true, "ascending" : true, ... ...
 { { "activeTab" : -1 "activeTab" : 1 } } \ No newline at end of file
 { { "left" : { "left" : { "panelheight" : 817, "panelheight" : 817, "splitterpos" : 340, "splitterpos" : 339, "topwindowstate" : "HIDE", "topwindowstate" : "NORMAL", "windowheight" : 855 "windowheight" : 855 }, }, "right" : { "right" : { "panelheight" : 817, "panelheight" : 817, "splitterpos" : 512, "splitterpos" : 511, "topwindowstate" : "NORMAL", "topwindowstate" : "NORMAL", "windowheight" : 855 "windowheight" : 855 } } ... ...
 { { "TabSet1" : 4, "TabSet1" : 3, "TabSet2" : 2, "TabSet2" : 3, "TabZoom" : { "TabZoom" : { } } } } \ No newline at end of file
 #' 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) }
man/sdareamat.Rd 0 → 100644
 % 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) }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!