From 46b6efc706d2bc783bc3e632ff651f6cc3d55363 Mon Sep 17 00:00:00 2001 From: Marcel Costa Date: Sat, 12 Feb 2022 12:05:34 +0100 Subject: [PATCH] =?UTF-8?q?A=C3=B1adida=20funci=C3=B3n=20sem.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- R/sem.R | 4 ++++ man/sem.Rd | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 R/sem.R create mode 100644 man/sem.Rd diff --git a/R/sem.R b/R/sem.R new file mode 100644 index 0000000..795ec06 --- /dev/null +++ b/R/sem.R @@ -0,0 +1,4 @@ +sem <- function(x, na.rm=F){ + sem<-sd(x, na.rm = na.rm)/sqrt(length(x)) + return(sem) +} diff --git a/man/sem.Rd b/man/sem.Rd new file mode 100644 index 0000000..862871b --- /dev/null +++ b/man/sem.Rd @@ -0,0 +1,17 @@ +\name{sem} +\alias{sem} +\title{sem} +\usage{ +sem(x, na.rm=T) +} +\arguments{ + \item{x}{A numeric vector or an R object but not a factor coercible to numeric by as.double(x).} + \item{na.rm}{A logical value indicating whether NA values should be stripped before the computation proceeds.} +} +\description{ +This function computes the Standard Error of the Mean of the values in x. If na.rm is TRUE then missing values are removed before computation proceeds. +} +\examples{ +v<-rnorm(10) +sem(v) +}