0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

R_基本統計量を自作(平均値)

Posted at

平均値

#平均値
result_mean <- function(x)
{
  sum<-0
  n<-length(x)
  for(i in 1:n)
  {
    sum <- sum+x[i]
  }
  mean<-sum/n
  return(mean)
}

#Rのもともとある関数mean()で動作確認

x<-c(10,20,30,40)
result_mean(x)
[1] 25
mean(x)
[1] 25
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?