1 / 4

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

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).

shirin
Download Presentation

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

An Image/Link below is provided (as is) to download presentation 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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. R入門 課題(10月23日)の解答 時田 陽一

  2. 解答(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 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

  3. 解答(2) 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 よってどちらも同じ解となる

  4. 解答(3) 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

More Related