R rowSums()

1 개요[ | ]

R rowSums()
  • Form Row Sums
행렬
R
CPU
2.5s
MEM
114M
3.1s
Reload
Copy
m <- matrix(1:6, nrow=3, ncol=2)
m
A matrix: 3 × 2 of type int
14
25
36
Copy
rowSums(m)
  1. 5
  2. 7
  3. 9
데이터프레임
R
Reload
Copy
df <- read.table( header=TRUE, stringsAsFactors=FALSE, text="
English Math
     30   60
     40   70
     50   80
     60   90
")
df
Loading
Copy
rowSums(df)
Loading
Copy
apply(df, 1, sum)
Loading

2 같이 보기[ | ]

3 참고[ | ]