현재 위치 - 주공해몽공식사이트 - 관음보살의 랜덤 번호 뽑기 - R 언어를 사용하여 학번 목록에서 무작위로 두 남자를 추출하는 방법

R 언어를 사용하여 학번 목록에서 무작위로 두 남자를 추출하는 방법

R 언어는 txt 형식의 데이터를 dataframe 으로 읽고 학번 필드에 따라 dataframe 에서 10 학생의 데이터를 무작위로 추출 (로드) 합니다.

상세 코드는 다음과 같습니다.

Reportcard1= read.table (file =' test1.txt', header=TRUE)

Reportcard2 = read.table (file =' test2txt' header = true) names (reportcard1) name Reportcard = merge (reportcard reportcard 2, by = xh) print (head (reportcard)) xh = sample (report Replace = true) samples = reportcard [reportcard $ xh% in% xh] print (samples).