楼主: isaacm
1548 4

[经济] R语言求教 [推广有奖]

  • 2关注
  • 0粉丝

本科生

14%

还不是VIP/贵宾

-

威望
0
论坛币
1052 个
通用积分
0.1507
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
4163 点
帖子
84
精华
0
在线时间
69 小时
注册时间
2009-10-18
最后登录
2025-12-20

20周年荣誉勋章

楼主
isaacm 发表于 2013-8-8 19:09:01 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
大家好,我是R语言的初学者。
我遇到一个命令不太明白。
mean()这个函数里面有个trim变量,谁能帮我解释一下这个的作用?
我看了帮助和examples还是不明白...
谢谢了
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:R语言 Examples example ExamP AMPL examples 初学者

沙发
chenkellyfly 发表于 2013-8-8 19:18:32
建议;1.看书2.实战。软件输出结果会让人看懂。你就做的时候做两种,一种有变量,一种没有不就行了
已有 1 人评分论坛币 收起 理由
guo.bailing + 5 鼓励积极发帖讨论

总评分: 论坛币 + 5   查看全部评分

藤椅
isaacm 发表于 2013-8-8 19:21:57
就是输出结果看不明白才来问一下嘛...有谁知道啊?trim的range是0到0.5,这个到底是什么含义啊?

板凳
Aharach 发表于 2013-8-9 03:06:33
mean {base}        R Documentation
Arithmetic Mean

Description

Generic function for the (trimmed) arithmetic mean.

Usage

mean(x, ...)

## Default S3 method:
mean(x, trim = 0, na.rm = FALSE, ...)
Arguments

x       
An R object. Currently there are methods for numeric/logical vectors and date, date-time and time interval objects. Complex vectors are allowed for trim = 0, only.

trim       
the fraction (0 to 0.5) of observations to be trimmed from each end of x before the mean is computed. Values of trim outside that range are taken as the nearest endpoint.

na.rm       
a logical value indicating whether NA values should be stripped before the computation proceeds.

...       
further arguments passed to or from other methods.

Value

If trim is zero (the default), the arithmetic mean of the values in x is computed, as a numeric or complex vector of length one. If x is not logical (coerced to numeric), numeric (including integer) or complex, NA_real_ is returned, with a warning.

If trim is non-zero, a symmetrically trimmed mean is computed with a fraction of trim observations deleted from each end before the mean is computed.

References

Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.

See Also

weighted.mean, mean.POSIXct, colMeans for row and column means.

Examples

x <- c(0:10, 50)
xm <- mean(x)
c(xm, mean(x, trim = 0.10))
已有 1 人评分论坛币 收起 理由
guo.bailing + 5 鼓励积极发帖讨论

总评分: 论坛币 + 5   查看全部评分

报纸
isaacm 发表于 2013-8-9 20:19:40
谢谢,我已经弄明白了,就是从vector两边减掉对应比例的数据。

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
扫码
拉您进交流群
GMT+8, 2026-1-27 13:45