SlideShare a Scribd company logo
1 of 11
Download to read offline
2020 1 30
1 1
2 2
3 2
3.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
4 4
4.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
4.2 R mode . . . . . . . . . . . . . . . . . . . . . . . . 4
4.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
4.4 NULL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
4.5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
5 6
5.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
6 7
6.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
6.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
6.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
6.4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
6.5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
7 11
7.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
8 11
1
•
1
2
•
• logical, numeric, complex, character
•
•
•
2
R #
#
> #################
> ##
> #################
> cat("ABC") #
ABC
3
> 3 * 4
[1] 12
> 3 * 4 + 2
[1] 14
> 3 * (4 + 2)
[1] 18
> 3/4
[1] 0.75
> -5 / -6
[1] 0.8333333
> (-5)/(-6)
[1] 0.8333333
2
> 2^3 # ^
[1] 8
> 2**3 # * 2
[1] 8
> 2^3*4 #
I 2
3.1 2
[1] 32
> 2^(3*4)
[1] 4096
> 2**3*4 # ** *
[1] 32
> 2**(3*4)
[1] 4096
> sqrt(2)
[1] 1.414214
> 2^(1/2)
[1] 1.414214
log(2) log(2)= loge 2 = ln 2
log(100,10)= log10 100
> log(2)
[1] 0.6931472
> log(100, 10)
[1] 2
> exp(1)
[1] 2.718282
> exp(0.6931472)
[1] 2
absolute values
> abs(-0.2)
[1] 0.2
> abs(0.2)
[1] 0.2
3.1
•
•
•
•
I 3
2
4
4.1
•
• 0 1 0 1
•
=⇒
• R
4.2 R mode
• logical : TRUE FALSE
T F
• numeric : R numeric
• complex : i
• character :
mode() mode mode()
> mode(TRUE)
[1] "logical"
> mode(FALSE)
[1] "logical"
> mode(pi) # pi
[1] "numeric"
> mode(2.0)
[1] "numeric"
> mode(2)
[1] "numeric"
> mode(2+2i)
[1] "complex"
> mode(" ")
[1] "character"
is. ()
I 4
4.3 2
> is.character(" ")
[1] TRUE
> is.numeric(" ")
[1] FALSE
> is.numeric(3.14)
[1] TRUE
> is.numeric(pi)
[1] TRUE
> is.logical(FALSE)
[1] TRUE
> is.logical(1)
[1] FALSE
4.3
’<-’
> x <- 3 # x 3
> x #
[1] 3
> is.numeric(x) # x
[1] TRUE
> y <- " "
> y
[1] " "
> is.character(y)
[1] TRUE
> is.numeric(x)
[1] TRUE
> mode(y)
[1] "character"
4.4 NULL
• 0 1 0
• R NULL
> x <- NULL # NULL
> x # x NULL
NULL
> is.numeric(x)
I 5
4.5 2
[1] FALSE
> is.null(x) # NULL
[1] TRUE
> mode(x) # NULL mode "NULL"
[1] "NULL"
> x <- FALSE # x
> is.null(x) # NULL
[1] FALSE
> is.logical(x)
[1] TRUE
> mode(x)
[1] "logical"
4.5
•
• mode
•
• logical numeric complex character
• mode()
• is. ()
•
• NULL
5
1
R
• vector : mode 1
1
• matrix : mode 2
• array : mode n
I 6
5.1 2
• list :
• data.frame : 2
mode
3
5.1
•
•
• vector, matrix, array, list
•
6
6.1
c() c() combine 1
> c(1, 2, 3, 4) #
[1] 1 2 3 4
> c(1, 2, c(3, 4)) #
[1] 1 2 3 4
> v <- c("a", "b", "c") #
> v # v
[1] "a" "b" "c"
> c(v, v, c(1, 2, 3)) #
[1] "a" "b" "c" "a" "b" "c" "1" "2" "3"
6.2
replicate rep(x, times) x times
I 7
6.3 2
> rep(1, 5)
[1] 1 1 1 1 1
> rep(" ", 3)
[1] " " " " " "
> rep(TRUE, 3)
[1] TRUE TRUE TRUE
> rep(c(1, 2), 3) #
[1] 1 2 1 2 1 2
rep()
sequence seq(from, to, by) from to by
by 1
> seq(1, 10)
[1] 1 2 3 4 5 6 7 8 9 10
> seq(1, 10, 2) # 2
[1] 1 3 5 7 9
> seq(10, 1)
[1] 10 9 8 7 6 5 4 3 2 1
> seq(10, 1, -2)
[1] 10 8 6 4 2
6.3
[1]
> seq(1, 50)
[1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
[28] 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
> 1
[1] 1
1 1
[]
> x <- 1:10
> x
[1] 1 2 3 4 5 6 7 8 9 10
> x[1]
[1] 1
> x[2]
[1] 2
I 8
6.4 2
> x[10]
[1] 10
[]
> days <- c(" ", " ", " ", " ", " ", " ", " ")
> days
[1] " " " " " " " " " " " " " "
> days[3]
[1] " "
> days[c(1, 2, 3)]
[1] " " " " " "
> days[1:3]
[1] " " " " " "
> days[seq(2, 7, 2)] # 2 1 1
[1] " " " " " "
> days[-3] # 3
[1] " " " " " " " " " " " "
> days[-1:-3] # 1 3
[1] " " " " " " " "
> days[-seq(2, 7, 2)] # seq(2,7,2) c(2,4,6)
[1] " " " " " " " "
length()
> length(days)
[1] 7
> length(x)
[1] 10
6.4
1 1 R
1 50 :
1:50 seq(1,50) 1
> x <- 1:50 # seq(1, 50)
> x
[1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
I 9
6.5 2
[28] 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
> y <- 50:1 # seq(50, 1)
> y
[1] 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24
[28] 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
> x * 2 # 2
[1] 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40
[21] 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80
[41] 82 84 86 88 90 92 94 96 98 100
> x / 2 # 2
[1] 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0
[17] 8.5 9.0 9.5 10.0 10.5 11.0 11.5 12.0 12.5 13.0 13.5 14.0 14.5 15.0 15.5 16.0
[33] 16.5 17.0 17.5 18.0 18.5 19.0 19.5 20.0 20.5 21.0 21.5 22.0 22.5 23.0 23.5 24.0
[49] 24.5 25.0
> x + 100 # 100
[1] 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
[21] 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
[41] 141 142 143 144 145 146 147 148 149 150
> x + y # x y
[1] 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51
[28] 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51
> log(1:5) # log(c(1, 2, 3, 4, 5)) log
[1] 0.0000000 0.6931472 1.0986123 1.3862944 1.6094379
> (1:5)^2 # c(1, 2, 3, 4, 5)^2
[1] 1 4 9 16 25
(1:5)^2 1:5
2 1:5^2 1 52
= 25
> 1:5^2 # 1:25
[1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
6.5
• :
• c() rep() seq()
•
• length()
I 10
2
7
rep()
> help(rep)
standard deviation help.search()
> help.serach("standard deviation")
stats::sd stats
sd() help(sd)
R
source
R source
help.search()
7.1
• help()
• help.search()
•
• sd()
8
(1) 2, 4, 6, 8, 10 10
[1] 2 4 6 8 10 2 4 6 8 10 2 4 6 8 10 2 4 6 8 10 2 4 6 8 10
[26] 2 4 6 8 10 2 4 6 8 10 2 4 6 8 10 2 4 6 8 10 2 4 6 8 10
(2) 2, 4, 6, 8, 10 100
(3) sd() 2
I 11

More Related Content

What's hot

第8回 大規模データを用いたデータフレーム操作実習(2)
第8回 大規模データを用いたデータフレーム操作実習(2)第8回 大規模データを用いたデータフレーム操作実習(2)
第8回 大規模データを用いたデータフレーム操作実習(2)Wataru Shito
 
第5回 様々なファイル形式の読み込みとデータの書き出し(解答付き)
第5回 様々なファイル形式の読み込みとデータの書き出し(解答付き)第5回 様々なファイル形式の読み込みとデータの書き出し(解答付き)
第5回 様々なファイル形式の読み込みとデータの書き出し(解答付き)Wataru Shito
 
第5回 様々なファイル形式の読み込みとデータの書き出し
第5回 様々なファイル形式の読み込みとデータの書き出し第5回 様々なファイル形式の読み込みとデータの書き出し
第5回 様々なファイル形式の読み込みとデータの書き出しWataru Shito
 
第7回 大規模データを用いたデータフレーム操作実習(1)
第7回 大規模データを用いたデータフレーム操作実習(1)第7回 大規模データを用いたデータフレーム操作実習(1)
第7回 大規模データを用いたデータフレーム操作実習(1)Wataru Shito
 
第3章 遅延学習---最近傍法を使った分類
第3章 遅延学習---最近傍法を使った分類第3章 遅延学習---最近傍法を使った分類
第3章 遅延学習---最近傍法を使った分類Wataru Shito
 
P3 แบบทดสอบคิดคำนวณคล่อง
P3 แบบทดสอบคิดคำนวณคล่องP3 แบบทดสอบคิดคำนวณคล่อง
P3 แบบทดสอบคิดคำนวณคล่องKhunnawang Khunnawang
 
Apostila contabilidade facensa
Apostila contabilidade facensaApostila contabilidade facensa
Apostila contabilidade facensasimuladocontabil
 
ປື້ມແບບຮຽນ ວິຊາ ເຄມີສາດ ມ 5
ປື້ມແບບຮຽນ ວິຊາ ເຄມີສາດ ມ 5ປື້ມແບບຮຽນ ວິຊາ ເຄມີສາດ ມ 5
ປື້ມແບບຮຽນ ວິຊາ ເຄມີສາດ ມ 5Pem(ເປ່ມ) PHAKVISETH
 
Մաթեմատիկա
ՄաթեմատիկաՄաթեմատիկա
Մաթեմատիկա3-1dasaran
 
Anant Pharmaceuticals, Karnal, Pharmaceutical Medicines
Anant Pharmaceuticals, Karnal, Pharmaceutical MedicinesAnant Pharmaceuticals, Karnal, Pharmaceutical Medicines
Anant Pharmaceuticals, Karnal, Pharmaceutical MedicinesIndiaMART InterMESH Limited
 
Ejercicios de Productos notables
Ejercicios de Productos notablesEjercicios de Productos notables
Ejercicios de Productos notablesjbersosa
 
سلسلة الليالى العشر فى الرياضيات للصف الثانى الابتدائى ترم اول
سلسلة الليالى العشر فى الرياضيات للصف الثانى الابتدائى ترم اولسلسلة الليالى العشر فى الرياضيات للصف الثانى الابتدائى ترم اول
سلسلة الليالى العشر فى الرياضيات للصف الثانى الابتدائى ترم اولأمنية وجدى
 
Sistmas de 7x7
Sistmas de 7x7Sistmas de 7x7
Sistmas de 7x7Edgar Mata
 

What's hot (20)

第8回 大規模データを用いたデータフレーム操作実習(2)
第8回 大規模データを用いたデータフレーム操作実習(2)第8回 大規模データを用いたデータフレーム操作実習(2)
第8回 大規模データを用いたデータフレーム操作実習(2)
 
第5回 様々なファイル形式の読み込みとデータの書き出し(解答付き)
第5回 様々なファイル形式の読み込みとデータの書き出し(解答付き)第5回 様々なファイル形式の読み込みとデータの書き出し(解答付き)
第5回 様々なファイル形式の読み込みとデータの書き出し(解答付き)
 
第5回 様々なファイル形式の読み込みとデータの書き出し
第5回 様々なファイル形式の読み込みとデータの書き出し第5回 様々なファイル形式の読み込みとデータの書き出し
第5回 様々なファイル形式の読み込みとデータの書き出し
 
第7回 大規模データを用いたデータフレーム操作実習(1)
第7回 大規模データを用いたデータフレーム操作実習(1)第7回 大規模データを用いたデータフレーム操作実習(1)
第7回 大規模データを用いたデータフレーム操作実習(1)
 
第3章 遅延学習---最近傍法を使った分類
第3章 遅延学習---最近傍法を使った分類第3章 遅延学習---最近傍法を使った分類
第3章 遅延学習---最近傍法を使った分類
 
Tabel t
Tabel tTabel t
Tabel t
 
P3 แบบทดสอบคิดคำนวณคล่อง
P3 แบบทดสอบคิดคำนวณคล่องP3 แบบทดสอบคิดคำนวณคล่อง
P3 แบบทดสอบคิดคำนวณคล่อง
 
Apostila contabilidade facensa
Apostila contabilidade facensaApostila contabilidade facensa
Apostila contabilidade facensa
 
ຟີຊິກ ມ6
ຟີຊິກ ມ6ຟີຊິກ ມ6
ຟີຊິກ ມ6
 
ປື້ມແບບຮຽນ ວິຊາ ເຄມີສາດ ມ 5
ປື້ມແບບຮຽນ ວິຊາ ເຄມີສາດ ມ 5ປື້ມແບບຮຽນ ວິຊາ ເຄມີສາດ ມ 5
ປື້ມແບບຮຽນ ວິຊາ ເຄມີສາດ ມ 5
 
Capitulo 7 Soluciones Purcell 9na Edicion
Capitulo 7 Soluciones Purcell 9na EdicionCapitulo 7 Soluciones Purcell 9na Edicion
Capitulo 7 Soluciones Purcell 9na Edicion
 
ejercicios fisica
ejercicios fisicaejercicios fisica
ejercicios fisica
 
Մաթեմատիկա
ՄաթեմատիկաՄաթեմատիկա
Մաթեմատիկա
 
Vigas 03-critérios de projeto
Vigas 03-critérios de projetoVigas 03-critérios de projeto
Vigas 03-critérios de projeto
 
Anant Pharmaceuticals, Karnal, Pharmaceutical Medicines
Anant Pharmaceuticals, Karnal, Pharmaceutical MedicinesAnant Pharmaceuticals, Karnal, Pharmaceutical Medicines
Anant Pharmaceuticals, Karnal, Pharmaceutical Medicines
 
Ejercicios de Productos notables
Ejercicios de Productos notablesEjercicios de Productos notables
Ejercicios de Productos notables
 
سلسلة الليالى العشر فى الرياضيات للصف الثانى الابتدائى ترم اول
سلسلة الليالى العشر فى الرياضيات للصف الثانى الابتدائى ترم اولسلسلة الليالى العشر فى الرياضيات للصف الثانى الابتدائى ترم اول
سلسلة الليالى العشر فى الرياضيات للصف الثانى الابتدائى ترم اول
 
ຟີຊິກ ມ5
ຟີຊິກ ມ5ຟີຊິກ ມ5
ຟີຊິກ ມ5
 
1° practica matematica comercial
1° practica matematica comercial1° practica matematica comercial
1° practica matematica comercial
 
Sistmas de 7x7
Sistmas de 7x7Sistmas de 7x7
Sistmas de 7x7
 

Similar to Numeric sequences and vector operations in R

Datamining r 1st
Datamining r 1stDatamining r 1st
Datamining r 1stsesejun
 
PRE: Datamining 2nd R
PRE: Datamining 2nd RPRE: Datamining 2nd R
PRE: Datamining 2nd Rsesejun
 
Datamining R 1st
Datamining R 1stDatamining R 1st
Datamining R 1stsesejun
 
Attention-Based Adaptive Selection of Operations for Image Restoration in the...
Attention-Based Adaptive Selection of Operations for Image Restoration in the...Attention-Based Adaptive Selection of Operations for Image Restoration in the...
Attention-Based Adaptive Selection of Operations for Image Restoration in the...MasanoriSuganuma
 
Ernest f. haeussler, richard s. paul y richard j. wood. matemáticas para admi...
Ernest f. haeussler, richard s. paul y richard j. wood. matemáticas para admi...Ernest f. haeussler, richard s. paul y richard j. wood. matemáticas para admi...
Ernest f. haeussler, richard s. paul y richard j. wood. matemáticas para admi...Jhonatan Minchán
 
Sol mat haeussler_by_priale
Sol mat haeussler_by_prialeSol mat haeussler_by_priale
Sol mat haeussler_by_prialeJeff Chasi
 
31350052 introductory-mathematical-analysis-textbook-solution-manual
31350052 introductory-mathematical-analysis-textbook-solution-manual31350052 introductory-mathematical-analysis-textbook-solution-manual
31350052 introductory-mathematical-analysis-textbook-solution-manualMahrukh Khalid
 
Solucionario de matemáticas para administación y economia
Solucionario de matemáticas para administación y economiaSolucionario de matemáticas para administación y economia
Solucionario de matemáticas para administación y economiaLuis Perez Anampa
 
第4回 データフレームの基本操作 その2
第4回 データフレームの基本操作 その2第4回 データフレームの基本操作 その2
第4回 データフレームの基本操作 その2Wataru Shito
 
Solutions manual for business math 10th edition by cleaves
Solutions manual for business math 10th edition by cleavesSolutions manual for business math 10th edition by cleaves
Solutions manual for business math 10th edition by cleavesCooKi5472
 
Algebra Lineal con geogebra.pdf
Algebra Lineal con geogebra.pdfAlgebra Lineal con geogebra.pdf
Algebra Lineal con geogebra.pdfJesus Fuentes
 
Tugas Kalkulus
Tugas KalkulusTugas Kalkulus
Tugas Kalkulussitikecit
 
Tugas Kalkulus Diferentiation
Tugas Kalkulus DiferentiationTugas Kalkulus Diferentiation
Tugas Kalkulus DiferentiationSirilus Oki
 
Tugas kalkulus
Tugas kalkulusTugas kalkulus
Tugas kalkulusandekiorek
 
Números enteros
Números enterosNúmeros enteros
Números enterosDaysi N
 
الدوال
الدوالالدوال
الدوالbsoma777
 
Factoring common monomial
Factoring common monomialFactoring common monomial
Factoring common monomialAjayQuines
 
Solución guía n°1 operaciones combinadas
Solución guía n°1 operaciones combinadasSolución guía n°1 operaciones combinadas
Solución guía n°1 operaciones combinadasFrancisco Gaete Garrido
 

Similar to Numeric sequences and vector operations in R (20)

Datamining r 1st
Datamining r 1stDatamining r 1st
Datamining r 1st
 
PRE: Datamining 2nd R
PRE: Datamining 2nd RPRE: Datamining 2nd R
PRE: Datamining 2nd R
 
Datamining R 1st
Datamining R 1stDatamining R 1st
Datamining R 1st
 
Attention-Based Adaptive Selection of Operations for Image Restoration in the...
Attention-Based Adaptive Selection of Operations for Image Restoration in the...Attention-Based Adaptive Selection of Operations for Image Restoration in the...
Attention-Based Adaptive Selection of Operations for Image Restoration in the...
 
Ernest f. haeussler, richard s. paul y richard j. wood. matemáticas para admi...
Ernest f. haeussler, richard s. paul y richard j. wood. matemáticas para admi...Ernest f. haeussler, richard s. paul y richard j. wood. matemáticas para admi...
Ernest f. haeussler, richard s. paul y richard j. wood. matemáticas para admi...
 
Sol mat haeussler_by_priale
Sol mat haeussler_by_prialeSol mat haeussler_by_priale
Sol mat haeussler_by_priale
 
31350052 introductory-mathematical-analysis-textbook-solution-manual
31350052 introductory-mathematical-analysis-textbook-solution-manual31350052 introductory-mathematical-analysis-textbook-solution-manual
31350052 introductory-mathematical-analysis-textbook-solution-manual
 
Solucionario de matemáticas para administación y economia
Solucionario de matemáticas para administación y economiaSolucionario de matemáticas para administación y economia
Solucionario de matemáticas para administación y economia
 
第4回 データフレームの基本操作 その2
第4回 データフレームの基本操作 その2第4回 データフレームの基本操作 その2
第4回 データフレームの基本操作 その2
 
Solutions manual for business math 10th edition by cleaves
Solutions manual for business math 10th edition by cleavesSolutions manual for business math 10th edition by cleaves
Solutions manual for business math 10th edition by cleaves
 
Algebra Lineal con geogebra.pdf
Algebra Lineal con geogebra.pdfAlgebra Lineal con geogebra.pdf
Algebra Lineal con geogebra.pdf
 
Tugas Kalkulus
Tugas KalkulusTugas Kalkulus
Tugas Kalkulus
 
Tugas Kalkulus Diferentiation
Tugas Kalkulus DiferentiationTugas Kalkulus Diferentiation
Tugas Kalkulus Diferentiation
 
Tugas kalkulus
Tugas kalkulusTugas kalkulus
Tugas kalkulus
 
MATLAB ARRAYS
MATLAB ARRAYSMATLAB ARRAYS
MATLAB ARRAYS
 
Latihan 3.3
Latihan 3.3Latihan 3.3
Latihan 3.3
 
Números enteros
Números enterosNúmeros enteros
Números enteros
 
الدوال
الدوالالدوال
الدوال
 
Factoring common monomial
Factoring common monomialFactoring common monomial
Factoring common monomial
 
Solución guía n°1 operaciones combinadas
Solución guía n°1 operaciones combinadasSolución guía n°1 operaciones combinadas
Solución guía n°1 operaciones combinadas
 

More from Wataru Shito

統計的推定の基礎 2 -- 分散の推定
統計的推定の基礎 2 -- 分散の推定統計的推定の基礎 2 -- 分散の推定
統計的推定の基礎 2 -- 分散の推定Wataru Shito
 
統計的推定の基礎 1 -- 期待値の推定
統計的推定の基礎 1 -- 期待値の推定統計的推定の基礎 1 -- 期待値の推定
統計的推定の基礎 1 -- 期待値の推定Wataru Shito
 
第4章 確率的学習---単純ベイズを使った分類
第4章 確率的学習---単純ベイズを使った分類第4章 確率的学習---単純ベイズを使った分類
第4章 確率的学習---単純ベイズを使った分類Wataru Shito
 
演習II.第1章 ベイズ推論の考え方 Part 3.講義ノート
演習II.第1章 ベイズ推論の考え方 Part 3.講義ノート演習II.第1章 ベイズ推論の考え方 Part 3.講義ノート
演習II.第1章 ベイズ推論の考え方 Part 3.講義ノートWataru Shito
 
演習II.第1章 ベイズ推論の考え方 Part 3.スライド
演習II.第1章 ベイズ推論の考え方 Part 3.スライド演習II.第1章 ベイズ推論の考え方 Part 3.スライド
演習II.第1章 ベイズ推論の考え方 Part 3.スライドWataru Shito
 
演習II.第1章 ベイズ推論の考え方 Part 2.講義ノート
演習II.第1章 ベイズ推論の考え方 Part 2.講義ノート演習II.第1章 ベイズ推論の考え方 Part 2.講義ノート
演習II.第1章 ベイズ推論の考え方 Part 2.講義ノートWataru Shito
 
演習II.第1章 ベイズ推論の考え方 Part 2.スライド
演習II.第1章 ベイズ推論の考え方 Part 2.スライド演習II.第1章 ベイズ推論の考え方 Part 2.スライド
演習II.第1章 ベイズ推論の考え方 Part 2.スライドWataru Shito
 
演習II.第1章 ベイズ推論の考え方 Part 1.講義ノート
演習II.第1章 ベイズ推論の考え方 Part 1.講義ノート演習II.第1章 ベイズ推論の考え方 Part 1.講義ノート
演習II.第1章 ベイズ推論の考え方 Part 1.講義ノートWataru Shito
 
マクロ経済学I 「第8章 総需要・総供給分析(AD-AS分析)」
マクロ経済学I 「第8章 総需要・総供給分析(AD-AS分析)」マクロ経済学I 「第8章 総需要・総供給分析(AD-AS分析)」
マクロ経済学I 「第8章 総需要・総供給分析(AD-AS分析)」Wataru Shito
 
経済数学II 「第9章 最適化(Optimization)」
経済数学II 「第9章 最適化(Optimization)」経済数学II 「第9章 最適化(Optimization)」
経済数学II 「第9章 最適化(Optimization)」Wataru Shito
 
マクロ経済学I 「第10章 総需要 II.IS-LM分析とAD曲線」
マクロ経済学I 「第10章 総需要 II.IS-LM分析とAD曲線」マクロ経済学I 「第10章 総需要 II.IS-LM分析とAD曲線」
マクロ経済学I 「第10章 総需要 II.IS-LM分析とAD曲線」Wataru Shito
 
経済数学II 「第12章 制約つき最適化」
経済数学II 「第12章 制約つき最適化」経済数学II 「第12章 制約つき最適化」
経済数学II 「第12章 制約つき最適化」Wataru Shito
 
マクロ経済学I 「第9章 総需要 I」
マクロ経済学I 「第9章 総需要 I」マクロ経済学I 「第9章 総需要 I」
マクロ経済学I 「第9章 総需要 I」Wataru Shito
 
経済数学II 「第11章 選択変数が2個以上の場合の最適化」
経済数学II 「第11章 選択変数が2個以上の場合の最適化」経済数学II 「第11章 選択変数が2個以上の場合の最適化」
経済数学II 「第11章 選択変数が2個以上の場合の最適化」Wataru Shito
 
マクロ経済学I 「第6章 開放経済の長期分析」
マクロ経済学I 「第6章 開放経済の長期分析」マクロ経済学I 「第6章 開放経済の長期分析」
マクロ経済学I 「第6章 開放経済の長期分析」Wataru Shito
 
経済数学II 「第8章 一般関数型モデルの比較静学」
経済数学II 「第8章 一般関数型モデルの比較静学」経済数学II 「第8章 一般関数型モデルの比較静学」
経済数学II 「第8章 一般関数型モデルの比較静学」Wataru Shito
 
マクロ経済学I 「第4,5章 貨幣とインフレーション」
マクロ経済学I 「第4,5章 貨幣とインフレーション」マクロ経済学I 「第4,5章 貨幣とインフレーション」
マクロ経済学I 「第4,5章 貨幣とインフレーション」Wataru Shito
 
マクロ経済学I 「第3章 長期閉鎖経済モデル」
マクロ経済学I 「第3章 長期閉鎖経済モデル」マクロ経済学I 「第3章 長期閉鎖経済モデル」
マクロ経済学I 「第3章 長期閉鎖経済モデル」Wataru Shito
 
経済数学II 「第7章 微分法とその比較静学への応用」
経済数学II 「第7章 微分法とその比較静学への応用」経済数学II 「第7章 微分法とその比較静学への応用」
経済数学II 「第7章 微分法とその比較静学への応用」Wataru Shito
 
経済数学II 「第6章 比較静学と導関数の概念」
経済数学II 「第6章 比較静学と導関数の概念」経済数学II 「第6章 比較静学と導関数の概念」
経済数学II 「第6章 比較静学と導関数の概念」Wataru Shito
 

More from Wataru Shito (20)

統計的推定の基礎 2 -- 分散の推定
統計的推定の基礎 2 -- 分散の推定統計的推定の基礎 2 -- 分散の推定
統計的推定の基礎 2 -- 分散の推定
 
統計的推定の基礎 1 -- 期待値の推定
統計的推定の基礎 1 -- 期待値の推定統計的推定の基礎 1 -- 期待値の推定
統計的推定の基礎 1 -- 期待値の推定
 
第4章 確率的学習---単純ベイズを使った分類
第4章 確率的学習---単純ベイズを使った分類第4章 確率的学習---単純ベイズを使った分類
第4章 確率的学習---単純ベイズを使った分類
 
演習II.第1章 ベイズ推論の考え方 Part 3.講義ノート
演習II.第1章 ベイズ推論の考え方 Part 3.講義ノート演習II.第1章 ベイズ推論の考え方 Part 3.講義ノート
演習II.第1章 ベイズ推論の考え方 Part 3.講義ノート
 
演習II.第1章 ベイズ推論の考え方 Part 3.スライド
演習II.第1章 ベイズ推論の考え方 Part 3.スライド演習II.第1章 ベイズ推論の考え方 Part 3.スライド
演習II.第1章 ベイズ推論の考え方 Part 3.スライド
 
演習II.第1章 ベイズ推論の考え方 Part 2.講義ノート
演習II.第1章 ベイズ推論の考え方 Part 2.講義ノート演習II.第1章 ベイズ推論の考え方 Part 2.講義ノート
演習II.第1章 ベイズ推論の考え方 Part 2.講義ノート
 
演習II.第1章 ベイズ推論の考え方 Part 2.スライド
演習II.第1章 ベイズ推論の考え方 Part 2.スライド演習II.第1章 ベイズ推論の考え方 Part 2.スライド
演習II.第1章 ベイズ推論の考え方 Part 2.スライド
 
演習II.第1章 ベイズ推論の考え方 Part 1.講義ノート
演習II.第1章 ベイズ推論の考え方 Part 1.講義ノート演習II.第1章 ベイズ推論の考え方 Part 1.講義ノート
演習II.第1章 ベイズ推論の考え方 Part 1.講義ノート
 
マクロ経済学I 「第8章 総需要・総供給分析(AD-AS分析)」
マクロ経済学I 「第8章 総需要・総供給分析(AD-AS分析)」マクロ経済学I 「第8章 総需要・総供給分析(AD-AS分析)」
マクロ経済学I 「第8章 総需要・総供給分析(AD-AS分析)」
 
経済数学II 「第9章 最適化(Optimization)」
経済数学II 「第9章 最適化(Optimization)」経済数学II 「第9章 最適化(Optimization)」
経済数学II 「第9章 最適化(Optimization)」
 
マクロ経済学I 「第10章 総需要 II.IS-LM分析とAD曲線」
マクロ経済学I 「第10章 総需要 II.IS-LM分析とAD曲線」マクロ経済学I 「第10章 総需要 II.IS-LM分析とAD曲線」
マクロ経済学I 「第10章 総需要 II.IS-LM分析とAD曲線」
 
経済数学II 「第12章 制約つき最適化」
経済数学II 「第12章 制約つき最適化」経済数学II 「第12章 制約つき最適化」
経済数学II 「第12章 制約つき最適化」
 
マクロ経済学I 「第9章 総需要 I」
マクロ経済学I 「第9章 総需要 I」マクロ経済学I 「第9章 総需要 I」
マクロ経済学I 「第9章 総需要 I」
 
経済数学II 「第11章 選択変数が2個以上の場合の最適化」
経済数学II 「第11章 選択変数が2個以上の場合の最適化」経済数学II 「第11章 選択変数が2個以上の場合の最適化」
経済数学II 「第11章 選択変数が2個以上の場合の最適化」
 
マクロ経済学I 「第6章 開放経済の長期分析」
マクロ経済学I 「第6章 開放経済の長期分析」マクロ経済学I 「第6章 開放経済の長期分析」
マクロ経済学I 「第6章 開放経済の長期分析」
 
経済数学II 「第8章 一般関数型モデルの比較静学」
経済数学II 「第8章 一般関数型モデルの比較静学」経済数学II 「第8章 一般関数型モデルの比較静学」
経済数学II 「第8章 一般関数型モデルの比較静学」
 
マクロ経済学I 「第4,5章 貨幣とインフレーション」
マクロ経済学I 「第4,5章 貨幣とインフレーション」マクロ経済学I 「第4,5章 貨幣とインフレーション」
マクロ経済学I 「第4,5章 貨幣とインフレーション」
 
マクロ経済学I 「第3章 長期閉鎖経済モデル」
マクロ経済学I 「第3章 長期閉鎖経済モデル」マクロ経済学I 「第3章 長期閉鎖経済モデル」
マクロ経済学I 「第3章 長期閉鎖経済モデル」
 
経済数学II 「第7章 微分法とその比較静学への応用」
経済数学II 「第7章 微分法とその比較静学への応用」経済数学II 「第7章 微分法とその比較静学への応用」
経済数学II 「第7章 微分法とその比較静学への応用」
 
経済数学II 「第6章 比較静学と導関数の概念」
経済数学II 「第6章 比較静学と導関数の概念」経済数学II 「第6章 比較静学と導関数の概念」
経済数学II 「第6章 比較静学と導関数の概念」
 

Recently uploaded

VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...Suhani Kapoor
 
BabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxBabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxolyaivanovalion
 
04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationshipsccctableauusergroup
 
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service BhilaiLow Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service BhilaiSuhani Kapoor
 
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
Call Girls In Mahipalpur O9654467111 Escorts Service
Call Girls In Mahipalpur O9654467111  Escorts ServiceCall Girls In Mahipalpur O9654467111  Escorts Service
Call Girls In Mahipalpur O9654467111 Escorts ServiceSapana Sha
 
Generative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusGenerative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusTimothy Spann
 
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfLars Albertsson
 
Industrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfIndustrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfLars Albertsson
 
Dubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls DubaiDubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls Dubaihf8803863
 
Brighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingBrighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingNeil Barnes
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz1
 
VidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxVidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxolyaivanovalion
 
Ukraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSUkraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSAishani27
 
CebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptxCebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptxolyaivanovalion
 
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service Amravati
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service AmravatiVIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service Amravati
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service AmravatiSuhani Kapoor
 

Recently uploaded (20)

VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
VIP High Class Call Girls Jamshedpur Anushka 8250192130 Independent Escort Se...
 
BabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxBabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptx
 
04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships04242024_CCC TUG_Joins and Relationships
04242024_CCC TUG_Joins and Relationships
 
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service BhilaiLow Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
 
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls CP 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
VIP Call Girls Service Charbagh { Lucknow Call Girls Service 9548273370 } Boo...
 
Call Girls In Mahipalpur O9654467111 Escorts Service
Call Girls In Mahipalpur O9654467111  Escorts ServiceCall Girls In Mahipalpur O9654467111  Escorts Service
Call Girls In Mahipalpur O9654467111 Escorts Service
 
Generative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and MilvusGenerative AI on Enterprise Cloud with NiFi and Milvus
Generative AI on Enterprise Cloud with NiFi and Milvus
 
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
(PARI) Call Girls Wanowrie ( 7001035870 ) HI-Fi Pune Escorts Service
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdf
 
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
 
Industrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdfIndustrialised data - the key to AI success.pdf
Industrialised data - the key to AI success.pdf
 
Dubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls DubaiDubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls Dubai
 
Brighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingBrighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data Storytelling
 
Invezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signalsInvezz.com - Grow your wealth with trading signals
Invezz.com - Grow your wealth with trading signals
 
VidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxVidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptx
 
E-Commerce Order PredictionShraddha Kamble.pptx
E-Commerce Order PredictionShraddha Kamble.pptxE-Commerce Order PredictionShraddha Kamble.pptx
E-Commerce Order PredictionShraddha Kamble.pptx
 
Ukraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSUkraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICS
 
CebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptxCebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptx
 
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service Amravati
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service AmravatiVIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service Amravati
VIP Call Girls in Amravati Aarohi 8250192130 Independent Escort Service Amravati
 

Numeric sequences and vector operations in R

  • 1. 2020 1 30 1 1 2 2 3 2 3.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 4 4 4.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 4.2 R mode . . . . . . . . . . . . . . . . . . . . . . . . 4 4.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 4.4 NULL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 4.5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 5 6 5.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 6 7 6.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 6.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 6.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 6.4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 6.5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 7 11 7.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 8 11 1 • 1
  • 2. 2 • • logical, numeric, complex, character • • • 2 R # # > ################# > ## > ################# > cat("ABC") # ABC 3 > 3 * 4 [1] 12 > 3 * 4 + 2 [1] 14 > 3 * (4 + 2) [1] 18 > 3/4 [1] 0.75 > -5 / -6 [1] 0.8333333 > (-5)/(-6) [1] 0.8333333 2 > 2^3 # ^ [1] 8 > 2**3 # * 2 [1] 8 > 2^3*4 # I 2
  • 3. 3.1 2 [1] 32 > 2^(3*4) [1] 4096 > 2**3*4 # ** * [1] 32 > 2**(3*4) [1] 4096 > sqrt(2) [1] 1.414214 > 2^(1/2) [1] 1.414214 log(2) log(2)= loge 2 = ln 2 log(100,10)= log10 100 > log(2) [1] 0.6931472 > log(100, 10) [1] 2 > exp(1) [1] 2.718282 > exp(0.6931472) [1] 2 absolute values > abs(-0.2) [1] 0.2 > abs(0.2) [1] 0.2 3.1 • • • • I 3
  • 4. 2 4 4.1 • • 0 1 0 1 • =⇒ • R 4.2 R mode • logical : TRUE FALSE T F • numeric : R numeric • complex : i • character : mode() mode mode() > mode(TRUE) [1] "logical" > mode(FALSE) [1] "logical" > mode(pi) # pi [1] "numeric" > mode(2.0) [1] "numeric" > mode(2) [1] "numeric" > mode(2+2i) [1] "complex" > mode(" ") [1] "character" is. () I 4
  • 5. 4.3 2 > is.character(" ") [1] TRUE > is.numeric(" ") [1] FALSE > is.numeric(3.14) [1] TRUE > is.numeric(pi) [1] TRUE > is.logical(FALSE) [1] TRUE > is.logical(1) [1] FALSE 4.3 ’<-’ > x <- 3 # x 3 > x # [1] 3 > is.numeric(x) # x [1] TRUE > y <- " " > y [1] " " > is.character(y) [1] TRUE > is.numeric(x) [1] TRUE > mode(y) [1] "character" 4.4 NULL • 0 1 0 • R NULL > x <- NULL # NULL > x # x NULL NULL > is.numeric(x) I 5
  • 6. 4.5 2 [1] FALSE > is.null(x) # NULL [1] TRUE > mode(x) # NULL mode "NULL" [1] "NULL" > x <- FALSE # x > is.null(x) # NULL [1] FALSE > is.logical(x) [1] TRUE > mode(x) [1] "logical" 4.5 • • mode • • logical numeric complex character • mode() • is. () • • NULL 5 1 R • vector : mode 1 1 • matrix : mode 2 • array : mode n I 6
  • 7. 5.1 2 • list : • data.frame : 2 mode 3 5.1 • • • vector, matrix, array, list • 6 6.1 c() c() combine 1 > c(1, 2, 3, 4) # [1] 1 2 3 4 > c(1, 2, c(3, 4)) # [1] 1 2 3 4 > v <- c("a", "b", "c") # > v # v [1] "a" "b" "c" > c(v, v, c(1, 2, 3)) # [1] "a" "b" "c" "a" "b" "c" "1" "2" "3" 6.2 replicate rep(x, times) x times I 7
  • 8. 6.3 2 > rep(1, 5) [1] 1 1 1 1 1 > rep(" ", 3) [1] " " " " " " > rep(TRUE, 3) [1] TRUE TRUE TRUE > rep(c(1, 2), 3) # [1] 1 2 1 2 1 2 rep() sequence seq(from, to, by) from to by by 1 > seq(1, 10) [1] 1 2 3 4 5 6 7 8 9 10 > seq(1, 10, 2) # 2 [1] 1 3 5 7 9 > seq(10, 1) [1] 10 9 8 7 6 5 4 3 2 1 > seq(10, 1, -2) [1] 10 8 6 4 2 6.3 [1] > seq(1, 50) [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 [28] 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 > 1 [1] 1 1 1 [] > x <- 1:10 > x [1] 1 2 3 4 5 6 7 8 9 10 > x[1] [1] 1 > x[2] [1] 2 I 8
  • 9. 6.4 2 > x[10] [1] 10 [] > days <- c(" ", " ", " ", " ", " ", " ", " ") > days [1] " " " " " " " " " " " " " " > days[3] [1] " " > days[c(1, 2, 3)] [1] " " " " " " > days[1:3] [1] " " " " " " > days[seq(2, 7, 2)] # 2 1 1 [1] " " " " " " > days[-3] # 3 [1] " " " " " " " " " " " " > days[-1:-3] # 1 3 [1] " " " " " " " " > days[-seq(2, 7, 2)] # seq(2,7,2) c(2,4,6) [1] " " " " " " " " length() > length(days) [1] 7 > length(x) [1] 10 6.4 1 1 R 1 50 : 1:50 seq(1,50) 1 > x <- 1:50 # seq(1, 50) > x [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 I 9
  • 10. 6.5 2 [28] 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 > y <- 50:1 # seq(50, 1) > y [1] 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 [28] 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 > x * 2 # 2 [1] 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 [21] 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70 72 74 76 78 80 [41] 82 84 86 88 90 92 94 96 98 100 > x / 2 # 2 [1] 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 7.0 7.5 8.0 [17] 8.5 9.0 9.5 10.0 10.5 11.0 11.5 12.0 12.5 13.0 13.5 14.0 14.5 15.0 15.5 16.0 [33] 16.5 17.0 17.5 18.0 18.5 19.0 19.5 20.0 20.5 21.0 21.5 22.0 22.5 23.0 23.5 24.0 [49] 24.5 25.0 > x + 100 # 100 [1] 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 [21] 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 [41] 141 142 143 144 145 146 147 148 149 150 > x + y # x y [1] 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 [28] 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 51 > log(1:5) # log(c(1, 2, 3, 4, 5)) log [1] 0.0000000 0.6931472 1.0986123 1.3862944 1.6094379 > (1:5)^2 # c(1, 2, 3, 4, 5)^2 [1] 1 4 9 16 25 (1:5)^2 1:5 2 1:5^2 1 52 = 25 > 1:5^2 # 1:25 [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 6.5 • : • c() rep() seq() • • length() I 10
  • 11. 2 7 rep() > help(rep) standard deviation help.search() > help.serach("standard deviation") stats::sd stats sd() help(sd) R source R source help.search() 7.1 • help() • help.search() • • sd() 8 (1) 2, 4, 6, 8, 10 10 [1] 2 4 6 8 10 2 4 6 8 10 2 4 6 8 10 2 4 6 8 10 2 4 6 8 10 [26] 2 4 6 8 10 2 4 6 8 10 2 4 6 8 10 2 4 6 8 10 2 4 6 8 10 (2) 2, 4, 6, 8, 10 100 (3) sd() 2 I 11