R/RProjects/NWCCompare/R/skew.R

Defines functions skew

#' Function to return the skewness for a given data series
#' 
#' This function accepts a data frame containing daily data and returns the skewness
#' 
#' @param x data frame containing value data for the chosen timeseries
#' @return skew skewness for the given data frame
#' @export
#' @examples
#' data<-paste(system.file(package="NWCCompare"),"/data/qfiletempf.csv",sep="")
#' qfiletempf<-read.csv(data,stringsAsFactors=FALSE)
#' skew(qfiletempf)
skew <- function(x) {
  x1 <- mean(x$discharge,na.rm=TRUE)
  x2 <- median(x$discharge,na.rm=TRUE)
  x3 <- sd(x$discharge,na.rm=TRUE)
  skew <- (x1-x2)/x3
  return(skew)
}
jlthomps/EflowStats documentation built on May 19, 2019, 12:48 p.m.