R璇█涓嚑涓父鐢ㄧ殑鏁板鍔熻兘
Posted 鍠勬€濊€?/a> R璇█
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了R璇█涓嚑涓父鐢ㄧ殑鏁板鍔熻兘相关的知识,希望对你有一定的参考价值。
鍦ㄥ仛缁熻鎻忚堪鎴栬€呮暟鎹浆鎹㈢殑鏃跺€欙紝缁忓父闇€瑕佺敤鍒拌澶氭暟瀛﹁绠楃殑浠g爜锛堬級銆?br class="mq-48">
姣斿璁$畻鎬诲拰锛岃嚜鐒跺鏁帮紝鍧囨暟绛夈€?/span>
棣栧厛鍒涘缓涓€缁勪粠1鍒?0鐨勬暟鎹紝骞朵笖淇濆瓨鍒板彉閲弜涓€?/span>
# x
x <- 1:10
璁$畻x鐨勬€诲拰锛屽潎鏁帮紝涓綅鏁帮紝鍥涘垎鍗紝鏂瑰樊涓庢爣鍑嗗樊銆?/span>
# 缁熻鎻忚堪
# 鎬诲拰
sum(x)
# 鍧囨暟
mean(x)
# 涓綅鏁?/span>
median(x)
# 鍥涘垎浣嶆暟
quantile(x)
# 鏂瑰樊
var(x)
# 鏍囧噯宸?/span>
sd(x)
璁$畻鏈€灏忓€硷紝鏈€澶у€间笌鏁版嵁鑼冨洿銆?/span>
# 鏈€灏忓€?/span>
min(x)
# 鏈€澶у€?/span>
max(x)
# 鏁版嵁鑼冨洿
range(x)
鑷劧瀵规暟銆?/span>
# 鑷劧瀵规暟
log(x)
[1] 0.0000000 0.6931472 1.0986123 1.3862944 1.6094379 1.7917595 1.9459101
[8] 2.0794415 2.1972246 2.3025851
鎸囨暟杞崲銆?/span>
# 鎸囨暟杞崲
exp(x)
[1] 2.718282 7.389056 20.085537 54.598150 148.413159
[6] 403.428793 1096.633158 2980.957987 8103.083928 22026.465795
濡備綍璁$畻涓や釜鍙橀噺鐨勭浉鍏崇郴鏁帮紵
# 鍒涘缓鍙︿竴涓彉閲弝
y <- c(1:5, 3:7)
# 鐩稿叧绯绘暟
cor(x, y)
[1] 0.904534
浠婂ぉ灏卞埌姝や负姝紝鏁鏈熷緟鏇村绮惧僵鍐呭銆?/span>
鍒嗕韩鏄叧鐖憋紒璇峰叧娉ㄧ偣璧炲垎浜摝銆?/span>
鎵弿浜岀淮鐮佹洿绮惧僵
鈥滃杽鎬濊€?/span>鈥斺€?nbsp;璁㏑璇█涓庣粺璁″彉寰楃畝鍗曪紒鈥?/span>
寰€鏈熺簿褰╁洖椤?/p>
鏈枃棣栧彂/鍘熷垱锛氬杽鎬濊€?路 SHANSIER
以上是关于R璇█涓嚑涓父鐢ㄧ殑鏁板鍔熻兘的主要内容,如果未能解决你的问题,请参考以下文章