"R rowMeans()"의 두 판 사이의 차이

2번째 줄: 2번째 줄:
;R rowMeans()
;R rowMeans()
* Form Row Means
* Form Row Means
* "행 평균", "가로 평균"


<source lang='r'>
<syntaxhighlight lang='r' notebook>
mydf <- read.table( header=TRUE, stringsAsFactors=FALSE, text="
df <- read.table( header=TRUE, stringsAsFactors=FALSE, text="
English Math
English Math Science
     30   60
30     60   99
     40   70
40     70   88
     50   80
50     80   77
     60   90
60     90   66
70      90   55
")
")
mydf
df
##  English Math
</syntaxhighlight>
## 1      30  60
<syntaxhighlight lang='r' notebook>
## 2      40  70
## 3      50  80
## 4      60  90
 
rowMeans(mydf)
rowMeans(mydf)
## [1] 45 55 65 75
</syntaxhighlight>
<syntaxhighlight lang='r' notebook>
apply(mydf, 1, mean)
apply(mydf, 1, mean)
## [1] 45 55 65 75
</syntaxhighlight>
</source>


==같이 보기==
==같이 보기==

2021년 4월 13일 (화) 22:54 판

1 개요

R rowMeans()
  • Form Row Means
  • "행 평균", "가로 평균"
df <- read.table( header=TRUE, stringsAsFactors=FALSE, text="
English Math Science
30      60   99
40      70   88
50      80   77
60      90   66
70      90   55
")
df
rowMeans(mydf)
apply(mydf, 1, mean)

2 같이 보기

3 참고

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}