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

 
45번째 줄: 45번째 줄:


==참고==
==참고==
* https://www.rdocumentation.org/packages/SparkR/versions/2.4.3/topics/sampleBy
* https://www.rdocumentation.org/packages/doBy/versions/4.6-2/topics/by-sample


[[분류: R SparkR]]
[[분류: R doBy]]

2019년 5월 16일 (목) 23:25 기준 최신판

1 개요[ | ]

R sampleBy()
R by-sample
  • "Sampling From A Data Frame"
summary(warpbreaks)
##     breaks      wool   tension
## Min.   :10.00   A:27   L:18   
## 1st Qu.:18.25   B:27   M:18   
## Median :26.00          H:18   
## Mean   :28.15                 
## 3rd Qu.:34.00                 
## Max.   :70.00          
       
table(warpbreaks$wool,warpbreaks$tension)
##  
##   L M H
## A 9 9 9
## B 9 9 9

library(doBy)
sampleBy(~1, frac=.2, data=warpbreaks, systematic=T)
##      breaks wool tension
## 1.1      26    A       L
## 1.6      52    A       L
## 1.11     21    A       M
## 1.16     35    A       M
## 1.21     24    A       H
## 1.26     15    A       H
## 1.31     19    B       L
## 1.36     44    B       L
## 1.41     39    B       M
## 1.46     20    B       H
## 1.51     15    B       H##

2 같이 보기[ | ]

3 참고[ | ]

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