股票beta值的均值

In statistics, mean is defined as the ‘average’ value that you get when you add all the values and divide them by the total number of values.

在统计中,均值定义为将所有值相加并除以值总数后得到的“平均值”值。

This tutorial is focused on finding the mean of the values using three different methods.

本教程着重于使用三种不同的方法查找值的平均值。



查找输入值列表的平均值 (Find the mean of an input list of values)

In this method, we are creating a list including some values and try to find the mean of those values.

在这种方法中,我们正在创建一个包含一些值的列表,并尝试查找这些值的平均值。

Example 1

例子1

x <- c(21,32,43,54,65,76,87,98)      #calculates the mean for the given values
mean(x)Output -->  59.5

In the above code, we first created a list ‘x’ containing some values. Then, with the help of function mean(), we can find the mean of the values in the list ‘x’.

在上面的代码中,我们首先创建了一个包含一些值的列表“ x”。 然后,借助mean()函数,我们可以在列表“ x”中找到值的平均值。

Example 2

例子2


x <- c(2.5,3.7,6.8,5.7,6.8,4.6)       #calculates the mean for the decimal values
mean(x)--> 5.016667


在文本文件中查找值的平均值 (Find the mean of the values in a text file)

In this method, you will get to know how you can find the mean of the values which are stored in a text file.

通过这种方法,您将了解如何找到存储在文本文件中的值的平均值。

x <- read.table('testvalues.txt')    #This will read the text file
mean(x$V1)    #This will calculate the mean of the values in the text file
--> 75.33333


查找存储在CSV文件中的值的平均值 (Find the mean of the values stored in a CSV file)

In this method, we are importing a CSV file, which includes some values in it. Then, as you did in the above steps, you can find the mean of the values using function mean().

在这种方法中,我们要导入一个CSV文件,其中包含一些值。 然后,与上述步骤一样,可以使用mean()函数找到值的均值。

The below code demonstrated the importing and reading of a CSV file.

下面的代码演示了CSV文件的导入和读取 。


x <- read.csv('testdata1.csv')

The above image shows the values which are present in the CSV file. In the next step, we can calculate the mean of these values. For that purpose run the below code.

上图显示了CSV文件中存在的值。 在下一步中,我们可以计算这些值的平均值。 为此,请运行以下代码。


mean(x$Values)  #calculates the mean for the values present in CSV file--> 68.92857


结论 (Conclusion)

R is a great statistical analysis language. It offers a range of functions for mathematical computations. In this tutorial, we have used mean() function to find the mean of given values. You can find the mean of values by creating a list of values, a text file or a CSV file as shown above as well.

R是一种出色的统计分析语言。 它提供了一系列用于数学计算的功能。 在本教程中,我们使用了mean()函数来查找给定值的均值。 您还可以通过创建值列表,文本文件或CSV文件(如上所示)来找到值的平均值。

I hope you got some good understanding of finding the mean of values using different methods. That’s all for now, happy learning!!!

希望您对使用不同方法求出均值的方法有所了解。 现在就这些,学习愉快!!!

翻译自: https://www.journaldev.com/38103/find-the-mean-of-values-in-r

股票beta值的均值

股票beta值的均值_如何在R中找到值的均值相关推荐

  1. rstudio中位数的公式_如何在R中找到中位数

    rstudio中位数的公式 In this tutorial, let's learn how we can find the median in R. Median is defined as th ...

  2. r求矩阵某一列的标准偏差_如何在R中找到标准偏差?

    r求矩阵某一列的标准偏差 Being a statistical language, R offers standard function sd(' ') to find the standard d ...

  3. 不用sqrt实现平方根_如何在R中使用sqrt()查找平方根?

    不用sqrt实现平方根 Getting a square root of the values in R is easy with the function sqrt() in R. Let's fi ...

  4. 如何在 R 中找到 F 临界值

    当您进行 F 检验时,您将获得 F 统计量作为结果.要确定 F 检验的结果是否具有统计显着性,可以将 F 统计量与 F 临界值进行比较.如果 F 统计量大于 F 临界值,则检验结果具有统计显着性. F ...

  5. csv文件示例_如何在R中使用数据框和CSV文件-带有示例的详细介绍

    csv文件示例 Welcome! If you want to start diving into data science and statistics, then data frames, CSV ...

  6. rstudio r语言_如何在R中接受用户输入?

    rstudio r语言 Taking a user input is very simple in R using readline() function. In this tutorial, we ...

  7. csh sum算总和_如何在R中使用sum()–在R中查找元素的总和

    csh sum算总和 Let's learn how to find the sum of the values with the help of the sum() in R. In this tu ...

  8. java整数的因式分解_如何在Java中找到整数的质数-因式分解

    java整数的因式分解 编程课程中的常见家庭作业/任务之一是关于Prime Factorization. 要求您编写一个程序以找到给定整数的素因子 . 一个数字的素数因子是将精确地除以给定数字的所有素 ...

  9. r语言min-max归一化_如何在R中使用min()和max()

    r语言min-max归一化 Finding min and max values is pretty much simple with the functions min() and max() in ...

最新文章

  1. 如何运行ImageMagick的命令行工具
  2. AndoridSQLite数据库开发基础教程(5)
  3. Idea(二) 解决IDEA卡顿问题及相关基本配置(转)
  4. Java txt 下拉刷新_手写上拉加载,下拉刷新(小demo)
  5. 列表迭代器ListIterator的用法
  6. 深入理解ElasticSearch(八):索引管理
  7. qt 中文转十六进制_QT中16进制字符串转汉字
  8. [js] 用js写一个方法检测浏览器是否支持css3的属性
  9. linux查看mongodb的ip地址,[转载]在MongoDB的shell中显示服务器当前IP
  10. 用反汇编理解指向指针的指针
  11. python 异步io_python异步IO编程(一)
  12. java 读取pdf、word、Excel文件
  13. PPTP拨号后无法打开网页处理
  14. Linux系统镜像源替换
  15. java私塾初级_Java私塾Java初级教程
  16. 英国交通分析指南(Transport analysis guidance)解读及启示
  17. java语音转文字_快速实现语音转文字,还自带翻译
  18. python批量转换音频格式,flac转mp3等
  19. 关闭在谷歌浏览器中关闭谷歌广告
  20. latex写论文(TeXstudio工具)

热门文章

  1. php.ini – 配置文件详解
  2. SQL中datetime和timestamp的区别
  3. 【leetcode刷题笔记】Convert Sorted Array to Binary Search Tree
  4. UI布局引擎Layout 之 QGraphicsLinearLayout
  5. 有名无实别占地儿──巧用批处理快删空文件夹
  6. 如何测量C#代码的运行时间
  7. [转载] python创建集合set()_python 之集合{}(Set)
  8. [转载] Python内置函数-min函数和max函数-详解
  9. export ,export default 和 import 区别以及用法
  10. 关系数据库、NoSQL和NewSQL数据库产品分类