R 入門　課題 (10 月 23 日 ) の解答

1 / 4

# R 入門　課題 (10 月 23 日 ) の解答 - PowerPoint PPT Presentation

R 入門　課題 (10 月 23 日 ) の解答. 時田　陽一. 解答 (1). 出力結果. 1. 手順は以下の通り > a <- c(1,2,3) > b <- c(4,5,6) > c <- c(7,8,9) > A <- cbind(a,b,c) > At <- t(A) > B <- cbind(A,At). > A a b c a 1 4 7 b 2 5 8 c 3 6 9 >B a b c a 1 4 7 1 2 3 b 2 5 8 4 5 6 c 3 6 9 7 8 9. 解答 (2).

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

## PowerPoint Slideshow about 'R 入門　課題 (10 月 23 日 ) の解答' - shirin

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

### R入門　課題(10月23日)の解答

1. 手順は以下の通り> a <- c(1,2,3)> b <- c(4,5,6)> c <- c(7,8,9)> A <- cbind(a,b,c)> At <- t(A)> B <- cbind(A,At)

> A a b ca 1 4 7b 2 5 8c 3 6 9

>B a b ca 1 4 7 1 2 3b 2 5 8 4 5 6c 3 6 9 7 8 9

2. 以下の通り> x <- array(c(1:10),dim=c(2,5))> vec1 <- as.vector(x)[1] 1 2 3 4 5 6 7 8 9 10> vec2 <- c(x)[1] 1 2 3 4 5 6 7 8 9 10

よってどちらも同じ解となる

3. 以下の通り> kenf <- factor(ken)> attendf <- factor(cut(attend, breaks=0+3*(0:10)))> table(attendf, kenf)

kenfattend iwa sas sin (12,15] 0 1 0 (15,18] 1 0 1 (18,21] 1 1 3 (21,24] 1 0 1