# tipo numericos
a<-5
b<-10
res<-a + b
print(res)
[1] 15
int.a<-50
miStr<-"Hola a todos"
miStr
[1] "Hola a todos"
class(miStr)
[1] "character"
miBool.t<-TRUE
miBool.f<-FALSE
miBool.t & miBool.f
[1] FALSE
class(miBool.t)
[1] "logical"
# double - numeric
numero<-5.545
class(numero)
[1] "numeric"
# numero entero
entero<-564L
class(entero)
[1] "integer"
a<-5
b<-'a'
res<-a+b
Error in a + b : argumento no-numérico para operador binario
a<-10
b<-'hola'
paste(a, b, sep='-')
[1] "10-hola"
a<-TRUE
b<-15
a+b
[1] 16
a<-5
b<-7L
class(a+b)
[1] "numeric"
a<-TRUE
b<-"hola"
paste(a, b)
[1] "TRUE hola"
# Lista en Python no es una lista en R
# Lista en Python equivale a un arreglo/collection en R
miArr<-c(10, 20, 30, 40, 59)
miArr
[1] 10 20 30 40 59
# indexacion de arreglos en R inician en (1)
miArr[1]
[1] 10
# sub-arreglos incluyen el limite superior
miArr[2:5]
[1] 20 30 40 59
miArr
[1] 10 20 30 40 59 60 70 80 90
miArr
[1] 20 30 40 59 60 70 80 90
miArr
[1] 20 30 40 59 80
arr.Datos
[1] 56.78470 52.78149 52.45933 69.93855 66.94896 69.12492 58.87498 62.52784 54.07885 63.00870 64.73798 68.22850 59.57553 58.06435 59.50651
[16] 68.68243 53.99621 67.89360 65.31955 61.41686 58.14088 52.46537 68.34756 64.22441 51.35511 50.59544 50.04051 64.97531 66.29946 60.72171
[31] 66.31861 54.60678 51.18216 54.45962 59.40463 65.82971 57.43303 50.89177 64.00306 60.08608 67.24601 62.42444 57.00857 56.35666 69.17089
[46] 53.25729 61.85927 51.72406 53.36165 59.66633 56.43685 63.64324 60.18942 63.52068 69.79495 54.33926 58.63800 63.37801 55.94956 59.31032
[61] 61.16141 66.79259 50.65745 55.37819 55.64079 58.93714 66.63934 53.94944 53.01179 57.61119 63.36251 50.66215 52.36136 51.66483 59.68057
[76] 59.41117 60.57944 53.20854 69.20919 56.87720 64.85385 52.29254 57.32371 66.56581 65.72197 64.63493 61.40639 66.97445 66.73116 67.44780
[91] 58.45109 52.26477 53.71785 65.06092 53.58051 62.41722 50.18792 66.35045 67.35161 53.46471
arr.Datos
[1] 57.61202 49.69389 59.15624 52.09498 37.07901 46.90921 39.26016 50.44610 67.66913 34.09363 47.09240 52.05194 59.24473 53.84705 50.66514
[16] 29.97116 53.36475 67.04808 39.74550 65.09245 45.15022 26.57678 50.27497 51.70540 51.81293 40.56749 46.56357 33.48634 47.94040 45.26408
[31] 66.47766 51.68338 51.86671 40.75031 39.25681 51.93596 53.43161 47.73913 55.14417 66.16194 68.23449 58.64764 54.43052 43.41009 56.47232
[46] 61.92743 33.22447 36.56977 43.39659 52.30749 63.23472 43.82882 63.47737 52.01198 59.42451 77.33846 51.80374 49.03987 48.28409 57.62238
[61] 51.34900 52.63195 42.76872 43.77941 45.99452 56.92084 36.70967 48.89104 25.66578 54.70227 44.48054 34.92530 28.67921 45.33066 29.28399
[76] 37.72723 40.75095 67.56819 37.14352 55.41492 33.65508 60.94912 58.26669 43.56266 46.55687 46.70916 44.44776 58.16651 50.86799 76.71351
[91] 45.96385 43.39173 41.23347 51.97208 44.82655 46.79580 44.15174 36.14145 48.82945 42.73609
arr.Datos[52]
[1] 43.82882
arr.Datos
[1] 52.23925 38.43777 54.22419 36.75245 51.41084 44.63952 46.88394 65.56110 45.51967 53.21124 37.69828 36.75941 62.61242 63.19232 49.19246
[16] 44.94910 49.47846 56.28861 71.80002 49.30983 65.44864 63.21452 53.22152 65.30955 45.78760 38.41179 31.54632 61.57325 28.76450 38.03968
[31] 66.42192 58.83655 55.24876 38.15341 76.55788 39.52086 39.88877 56.68922 51.29177 45.77423 38.59736 37.06285 44.05301 34.99186 50.15856
[46] 55.40170 34.52708 58.49653 58.96013 51.38691 33.80672 55.48398 51.95282 41.93502 48.91376 47.49053 66.99347 46.55701 50.67772 43.49430
[61] 45.12361 53.03151 47.58026 45.18266 40.08197 47.19351 56.33017 37.60182 67.64314 49.76320 51.99920 63.47193 50.36073 58.24581 32.97328
[76] 54.80950 74.83550 54.01365 52.15177 31.84288 40.88261 49.50955 45.94613 61.30382 58.15465 50.76418 64.53747 53.74121 48.29096 44.97787
[91] 55.43522 44.94814 57.86796 53.00949 63.10224 57.98434 58.50860 45.56432 45.53225 50.13305
arr<-c(10, 20, 30, 40, 'hello', 50,60,70)
arr
[1] "10" "20" "30" "40" "hello" "50" "60" "70"
arr<-c(10, 20, 30, 40, TRUE, FALSE, TRUE, TRUE)
arr
[1] 10 20 30 40 1 0 1 1
arr.Datos <= 45
[1] FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE TRUE FALSE TRUE FALSE FALSE FALSE FALSE FALSE
[23] TRUE TRUE TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE TRUE TRUE FALSE
[45] FALSE FALSE TRUE FALSE FALSE TRUE TRUE FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE TRUE FALSE TRUE FALSE FALSE TRUE TRUE
[67] FALSE FALSE FALSE TRUE FALSE TRUE TRUE FALSE FALSE FALSE FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
[89] FALSE FALSE TRUE TRUE FALSE FALSE TRUE FALSE TRUE FALSE TRUE TRUE
sum(arr.Datos <= 45)
[1] 28
arr.Datos[filtro] + 100
[1] 144.6395 153.2112 149.1925 149.4785 153.2215 165.3096 145.7876 156.6892 137.0628 144.0530 134.5271 151.3869 133.8067 148.9138 143.4943
[16] 153.0315 140.0820 147.1935 149.7632 163.4719 150.3607 154.0136 155.4352 144.9481 163.1022 158.5086 145.5323 150.1331
print(paste("Sumatoria:", round(sum(arr.Datos), 4)))
[1] "Sumatoria: 5045.2331"
print(paste("Sumatoria:", round(mean(arr.Datos), 4)))
[1] "Sumatoria: 50.4523"
print(paste("Sumatoria:", round(median(arr.Datos), 4)))
[1] "Sumatoria: 50.2596"
print(paste("Sumatoria:", round(var(arr.Datos), 4)))
[1] "Sumatoria: 102.2608"
print(paste("Sumatoria:", round(sd(arr.Datos), 4)))
[1] "Sumatoria: 10.1124"
print(paste("Sumatoria:", round(max(arr.Datos), 4)))
[1] "Sumatoria: 76.5579"
print(paste("Sumatoria:", round(min(arr.Datos), 4)))
[1] "Sumatoria: 28.7645"
print(paste("Sumatoria:", round(which.max(arr.Datos), 4)))
[1] "Sumatoria: 35"
print(paste("Sumatoria:", round(which.min(arr.Datos), 4)))
[1] "Sumatoria: 29"
\[ p(x)=\frac{\#(A)}{\#(E)}=`rmean(arr.Datos)` \]
#Listas:
miLista=list(52,
'Hola',
c(25,56,89),
c(T,F,F,T,T),
TRUE,
list(FALSE, 456, "Todo Bien")
)
miLista
[[1]]
[1] 52
[[2]]
[1] "Hola"
[[3]]
[1] 25 56 89
[[4]]
[1] TRUE FALSE FALSE TRUE TRUE
[[5]]
[1] TRUE
[[6]]
[[6]][[1]]
[1] FALSE
[[6]][[2]]
[1] 456
[[6]][[3]]
[1] "Todo Bien"
miLista[[3]]
[1] 25 56 89
miLista[[3]][3]
[1] 89
miLista[[6]][[2]]
[1] 456
substr(miLista[[6]][[3]],1,4)
[1] "Todo"
strsplit("data science", split=" ")[[1]][2]
[1] "science"
datos<-list(nombre="Ricardo",
apellido="Lopez",
edad=32,
clases=c("EconometrÃa en R","Machine Learning","Statistical Learning I"))
datos
$nombre
[1] "Ricardo"
$apellido
[1] "Lopez"
$edad
[1] 32
$clases
[1] "EconometrÃa en R" "Machine Learning" "Statistical Learning I"
datos$clases[3]
[1] "Statistical Learning I"
datos[[4]][3]
[1] "Statistical Learning I"
n_alumnos<-10
notas<-round(runif(n_alumnos,71,100))
notas
[1] 73 85 79 78 88 76 96 78 94 73
n_alumnos<-10
notas<-as.integer(runif(n_alumnos,71,100))
notas
[1] 86 91 72 71 92 93 86 82 84 74
ids<-as.integer(runif(n_alumnos, min=1000, max=9999))
carnets<-paste("2400",ids,sep='')
carnets
[1] "24007742" "24004599" "24004753" "24008402" "24005543" "24007265" "24009436" "24003303" "24005776" "24001827"
grupo_secciones<-c("A","b","C","U","V")
secciones<-sample(grupo_secciones, n_alumnos, replace=TRUE)
secciones
[1] "A" "b" "A" "b" "A" "C" "A" "U" "A" "A"
grupo_secciones<-c("A","b","C","U","V")
secciones<-sample(grupo_secciones, 1000, n_alumnos, replace=TRUE, prob = c(0.75, 0.10, 0.12, 0.03))
Error in sample(grupo_secciones, 1000, n_alumnos, replace = TRUE, prob = c(0.75, :
unused argument (n_alumnos)
grupo_secciones<-c("A","B","C","U","V")
secciones<-sample(grupo_secciones, n_alumnos, replace=TRUE)
secciones
[1] "C" "A" "U" "A" "A" "U" "A" "U" "U" "V"
papd<-list(carnet=carnets,
seccion=secciones,
nota=notas)
papd
$carnet
[1] "24007742" "24004599" "24004753" "24008402" "24005543" "24007265" "24009436" "24003303" "24005776" "24001827"
$seccion
[1] "C" "A" "U" "A" "A" "U" "A" "U" "U" "V"
$nota
[1] 86 91 72 71 92 93 86 82 84 74
papd$carnet
[1] "24007742" "24004599" "24004753" "24008402" "24005543" "24007265" "24009436" "24003303" "24005776" "24001827"
papd$carnet[papd$seccion=="A"]
[1] "24007742" "24001827"
n_alumnos<-1000
notas<-as.integer(runif(n_alumnos,71,100))
notas
[1] 96 77 93 95 98 90 95 73 89 82 92 92 81 80 90 80 90 77 78 74 93 93 76 97 88 83 79 79 87 97 94 83 81 85 89 90 94 74 97 78 82 78 80 77 86
[46] 91 86 71 89 88 93 96 83 85 96 81 78 75 73 90 81 72 72 87 90 76 78 98 86 92 77 89 89 86 77 78 84 95 77 93 86 80 93 77 80 83 91 90 91 75
[91] 72 87 74 71 93 78 90 77 99 90 93 91 71 85 92 80 94 96 95 84 84 85 75 96 76 89 72 81 88 98 77 76 96 84 77 97 99 98 86 99 81 81 83 79 72
[136] 73 83 99 74 77 77 89 85 92 80 95 85 90 98 71 86 94 80 90 88 89 98 77 80 95 75 97 73 90 99 89 83 94 78 90 87 89 71 72 99 98 76 91 80 90
[181] 73 99 74 81 95 95 90 91 96 84 91 83 97 74 72 91 96 71 92 93 85 88 81 84 79 73 91 75 93 95 80 81 98 89 80 85 83 90 97 76 78 81 71 72 73
[226] 88 71 83 73 85 86 92 89 89 95 98 89 92 74 82 97 83 72 98 98 90 72 91 80 92 98 77 92 96 84 71 78 93 91 99 71 80 78 84 86 89 97 79 94 91
[271] 76 83 95 94 80 99 82 74 71 80 94 93 81 91 88 86 95 81 79 88 80 88 78 92 71 88 96 85 85 73 82 92 98 85 72 88 74 75 75 78 79 94 84 84 87
[316] 80 92 74 98 75 86 75 88 83 92 96 75 86 91 76 72 85 89 89 84 76 83 74 90 95 87 91 79 88 85 79 85 87 75 96 85 80 98 97 79 77 79 96 88 92
[361] 88 76 73 84 94 87 90 74 73 89 97 90 76 99 85 94 83 93 71 99 75 89 81 92 82 86 92 95 81 96 71 91 75 76 73 71 76 90 79 75 78 93 74 95 80
[406] 79 72 80 87 95 75 96 76 98 92 83 93 76 80 89 80 73 91 82 86 87 79 76 73 84 95 76 89 75 96 76 88 71 81 83 88 97 88 85 94 71 97 91 87 94
[451] 87 79 80 78 77 79 85 85 76 84 80 85 85 84 90 83 85 90 82 73 93 87 97 93 98 87 89 87 82 88 97 74 83 94 98 82 81 71 92 82 71 88 78 77 86
[496] 76 95 84 77 81 74 73 95 71 81 90 78 76 91 99 98 83 96 88 80 94 86 71 92 82 92 71 75 74 79 94 95 84 93 90 86 93 91 94 77 74 77 83 72 79
[541] 92 90 77 91 95 93 94 80 80 85 85 88 99 93 89 80 73 81 85 72 84 83 99 94 81 79 72 81 89 99 99 92 71 81 83 96 90 91 83 84 72 99 93 83 76
[586] 86 74 99 73 98 71 99 95 78 87 71 89 72 82 91 71 80 94 85 83 89 92 96 93 97 80 99 87 75 73 96 94 92 73 77 84 86 76 86 89 78 82 91 76 77
[631] 96 78 92 85 79 82 81 75 85 97 95 94 73 81 86 91 85 74 78 92 85 91 86 96 88 90 83 72 86 86 84 92 99 73 72 88 76 81 78 93 96 87 99 72 78
[676] 85 83 93 73 71 96 79 93 73 99 93 95 93 80 95 91 98 95 82 96 83 93 95 76 80 78 72 94 87 87 80 98 78 77 83 92 73 78 86 88 81 99 95 91 85
[721] 75 80 75 88 91 73 88 94 78 86 72 93 90 84 95 86 88 90 78 76 82 97 72 87 91 84 94 78 73 93 96 84 99 87 84 85 79 88 77 94 96 75 86 83 87
[766] 98 88 97 75 81 79 78 93 91 84 88 89 84 91 74 80 98 92 95 76 95 85 81 98 75 71 97 92 83 76 94 90 94 80 87 76 76 80 74 82 99 86 86 77 88
[811] 75 72 94 74 94 97 84 73 91 99 98 73 87 91 73 74 74 99 87 73 75 83 85 75 82 89 75 88 94 81 84 81 85 73 99 95 98 92 71 81 76 72 96 97 90
[856] 90 78 87 98 85 96 78 98 96 77 99 94 75 91 74 96 97 96 71 95 89 96 82 89 83 83 98 72 71 88 82 80 73 80 97 83 71 76 79 92 88 80 96 75 91
[901] 71 99 93 99 95 84 94 90 95 73 81 85 86 94 99 81 84 90 84 83 84 85 76 79 72 79 75 84 73 90 80 95 94 74 76 98 77 96 98 85 96 82 72 95 91
[946] 82 98 76 79 78 96 72 99 71 92 99 93 88 94 79 75 85 98 83 94 86 84 93 88 89 95 89 96 71 92 84 90 80 83 92 79 75 77 77 78 79 83 80 96 78
[991] 90 97 98 99 86 99 72 81 84 79
ids<-as.integer(runif(n_alumnos, min=1000, max=9999))
anio<-sample(c(2100,2200,2300,2400), n_alumnos, replace=TRUE)
carnets<-paste(anio,ids,sep='')
carnets
[1] "22001285" "23001907" "23005646" "24001760" "21004390" "21009929" "24002749" "21005165" "21003787" "24008573" "21002605" "23005233"
[13] "23002866" "21008635" "21004248" "23005939" "24006820" "22008634" "23005993" "24001791" "21008479" "22004866" "23008229" "24005816"
[25] "22004312" "24002282" "24003488" "21007042" "21006110" "21001472" "22002434" "22009144" "24008184" "23006345" "22001027" "22006660"
[37] "24003859" "21001836" "23006236" "22008441" "21007321" "23007600" "24003141" "23004640" "24007811" "21009535" "22003803" "22004384"
[49] "21005891" "21007975" "21002535" "24008628" "24009285" "22009835" "21008473" "23005826" "22001134" "21005581" "22001920" "23005246"
[61] "24005174" "21002329" "22005135" "23008504" "21003164" "21006134" "23005546" "23005648" "21002541" "21004661" "24001710" "24008368"
[73] "22005852" "24007311" "23005130" "22001026" "24006506" "24007149" "22001772" "24004910" "24003281" "24004245" "24002487" "21002245"
[85] "23009495" "24001860" "23002946" "24008791" "24004719" "22008170" "22009079" "21005629" "23006653" "23004447" "23001900" "21009289"
[97] "22004808" "23007517" "21008912" "24008941" "22002176" "21004385" "21002698" "22004747" "21008676" "22006904" "22008103" "24005718"
[109] "23008791" "22005190" "23008346" "21004044" "23009236" "22007237" "23002895" "21004471" "21008381" "22006827" "21005230" "22006284"
[121] "21001270" "21004623" "21008553" "23004233" "21006615" "23006004" "21008996" "21009729" "21006458" "21009524" "22008153" "23009851"
[133] "22004742" "22002188" "24006207" "23001043" "22001647" "22003585" "22005164" "24001698" "23003331" "21007178" "24001510" "23005438"
[145] "22001991" "23003989" "24005332" "23005155" "22001261" "22007026" "22008347" "22007676" "22002740" "22005478" "22006032" "24003138"
[157] "24006129" "21005111" "24004723" "23004687" "23009398" "23005585" "24006075" "24006175" "22007045" "23002848" "24009979" "23001464"
[169] "22007692" "21004862" "22003065" "23004803" "23004478" "22009829" "22005629" "24001428" "22007945" "21005140" "24004002" "23002751"
[181] "23006597" "22009437" "23004886" "21006897" "23006733" "23002586" "21004073" "24004397" "21005027" "23002183" "22009530" "23003051"
[193] "23007633" "21003136" "22006714" "21002266" "24003247" "21008069" "21005722" "24003502" "23002441" "23008984" "22004285" "23007797"
[205] "24009879" "21004497" "24005477" "21003978" "23008125" "23002261" "24008131" "24001824" "22005361" "22002305" "22005839" "22008717"
[217] "21006256" "21004546" "24008407" "22008850" "22005947" "23004871" "24008317" "24006677" "21006078" "23005829" "22006984" "22004899"
[229] "21005746" "22002632" "21002168" "24002606" "21002374" "21008684" "23009037" "22002255" "22001738" "21006629" "22004981" "24004710"
[241] "22002834" "22005961" "21004667" "24006855" "21007126" "22002770" "23006903" "24002653" "21008717" "23009305" "24001840" "23008698"
[253] "23001097" "21001129" "21003562" "22002534" "21001433" "21003740" "21005297" "21001193" "24005721" "22008318" "22007607" "21008855"
[265] "22007484" "22003422" "23009137" "23004569" "23004558" "23001180" "21005368" "23009546" "24006238" "23008343" "23003485" "23001855"
[277] "24008931" "21009581" "22008916" "22008400" "22002016" "23008795" "23002952" "21001901" "24006769" "24006821" "24003554" "21006810"
[289] "23003087" "23006681" "23003280" "23002995" "22009993" "23003043" "22005005" "21004954" "22008454" "24009082" "22004728" "22005315"
[301] "22004337" "22006586" "21009560" "22009076" "22002777" "24009327" "22008553" "23007538" "22003081" "24007194" "21009304" "23009574"
[313] "21007736" "21003014" "22006511" "21001802" "21008062" "23003508" "24005774" "23007881" "21005766" "24004886" "22002337" "24006991"
[325] "22008276" "22008680" "21009134" "23001973" "21003137" "24003790" "22003083" "21002269" "23009459" "22001360" "21002222" "23002380"
[337] "23005349" "22004061" "22003721" "23005233" "21003585" "22006276" "23003909" "21002010" "21006244" "24004674" "21001789" "21007917"
[349] "23007509" "22004062" "22006277" "24005432" "23007940" "24009106" "22006228" "23004740" "24005070" "21002163" "21001522" "21005853"
[361] "21003822" "23007834" "23003041" "24009874" "21006871" "21008129" "21003388" "24008941" "23006153" "22009253" "21003692" "24007677"
[373] "22008614" "24009406" "23002608" "24004916" "22007840" "23006342" "24007351" "23003248" "22007638" "23006653" "21004313" "22004398"
[385] "24009502" "22007678" "22003121" "22002537" "23007967" "22005424" "22003317" "23007529" "23006290" "23006849" "24008661" "23006740"
[397] "24004306" "24008623" "22009907" "23009232" "22001568" "22004016" "21001906" "21004415" "23008305" "24008697" "24004599" "24006929"
[409] "23008376" "23002227" "22006772" "21004815" "21008064" "22005494" "23002241" "21008916" "24008931" "22007921" "21004744" "23006064"
[421] "23004184" "21007511" "22004548" "21002412" "21002042" "22007262" "21008630" "23009637" "23003818" "22006122" "22005643" "22003865"
[433] "21008575" "22009848" "22005743" "24002822" "24007802" "21008872" "21002529" "21001955" "24001763" "21008458" "22009074" "21002566"
[445] "24003594" "23002410" "21001726" "23002440" "23006965" "21001186" "24004281" "24007881" "22007988" "21008646" "22006754" "24006893"
[457] "22006580" "24008507" "22002238" "21006155" "22002450" "21009564" "23009807" "22007557" "22009846" "23003614" "24006185" "21002039"
[469] "22003500" "23003585" "24009011" "22005114" "22002536" "22004059" "21007968" "24008371" "22004684" "21006331" "22005116" "22002797"
[481] "24002702" "23008204" "24005964" "24008815" "23003903" "22009374" "21003011" "23006501" "22003248" "22007082" "22009295" "22005183"
[493] "21002916" "21009212" "24008502" "23004922" "21004924" "23006246" "22008338" "23006366" "22003205" "23002336" "23007246" "24004842"
[505] "21004936" "24006139" "23001727" "24003266" "22009256" "23002418" "24008435" "23005989" "24007522" "22008178" "24008704" "23002534"
[517] "21006401" "22009015" "22006125" "21007428" "22005772" "23004290" "23008684" "22003996" "22003160" "23004695" "23009921" "23003746"
[529] "23005727" "23003749" "24005414" "22008014" "24001398" "23002053" "24002403" "24002521" "24008642" "23001773" "24006463" "22001024"
[541] "22006893" "23001126" "23007089" "24007049" "24005415" "21002549" "23009919" "24007039" "24005290" "22009694" "23004236" "24008602"
[553] "21007912" "24005648" "21006310" "22001679" "24002962" "23001064" "21003815" "21008203" "23005268" "21007170" "21009250" "24002381"
[565] "21004884" "24004434" "23009474" "22005751" "22001326" "22005752" "24007673" "23005386" "21001981" "21004579" "24002709" "24002213"
[577] "23009119" "22001146" "21003144" "23004087" "24007033" "22001120" "22008154" "24007314" "24006572" "23004885" "21001061" "22009573"
[589] "21002046" "21009620" "23006837" "24004562" "24004261" "22009332" "22005423" "22001046" "24003628" "21009446" "21006388" "24003761"
[601] "23002668" "22005533" "22009998" "21002700" "23003733" "22008920" "23005354" "22009419" "23001484" "24002738" "24008398" "21007808"
[613] "24004687" "22003460" "21005269" "21001859" "24001747" "21008841" "23007867" "24008603" "22004481" "21007775" "24007364" "22005530"
[625] "21007845" "23007176" "22008157" "23009150" "21006158" "24005160" "24008861" "22005735" "22005763" "21005809" "22009489" "22001888"
[637] "23002183" "22008871" "22002754" "21008514" "22004625" "21006657" "24006257" "24009747" "24005616" "24009657" "21009800" "21002366"
[649] "24004323" "23007385" "23009225" "22005348" "21005369" "23003160" "23003983" "22009552" "23008716" "21002920" "23002674" "22003334"
[661] "21002537" "21009526" "22004016" "23008782" "22008449" "24001707" "23009288" "23008120" "24009068" "21005051" "21007396" "22003313"
[673] "24003688" "23008380" "24008212" "22007823" "22004831" "21006826" "22009779" "21007416" "23009494" "22002088" "23003971" "23006307"
[685] "24003835" "23004962" "24007564" "21006541" "22002849" "24009373" "22005604" "24004767" "23002006" "21009716" "24002009" "22002512"
[697] "22002191" "23005604" "21002431" "24004665" "24003280" "24001976" "23007300" "22007629" "22001480" "23008615" "21006377" "21004333"
[709] "22003579" "21006815" "23001966" "22006720" "23006388" "23001122" "24007796" "21008942" "24007712" "21006182" "24002727" "22007751"
[721] "22006507" "22008527" "24008420" "24009193" "24002291" "22003471" "21003538" "21006273" "21007846" "22009079" "23005989" "22001978"
[733] "21001544" "24003627" "23007140" "24005450" "23005077" "23001770" "24005933" "24009588" "24004881" "21002746" "24003631" "24005875"
[745] "21001151" "24008900" "23003428" "24008018" "22007502" "24003037" "21003984" "24003466" "24009410" "22004100" "21008767" "24005907"
[757] "23008233" "22002009" "22003290" "22005748" "22003878" "23001242" "21003274" "22006282" "24001401" "21001995" "24003680" "22007737"
[769] "22004888" "24004594" "22009557" "21004759" "23001262" "23006548" "24006795" "23006827" "23003183" "21005700" "24001098" "22001730"
[781] "21006054" "23001399" "21004575" "24001748" "22006408" "21007384" "24008294" "23006962" "24006435" "24004509" "23003209" "22002195"
[793] "21004731" "24005904" "24003881" "22002240" "23004064" "21008104" "21002369" "23005854" "21002974" "23007137" "23001897" "24004299"
[805] "23003958" "21007236" "21005211" "21008516" "21003407" "21007750" "21009137" "24004179" "24009653" "21001983" "21009127" "23005760"
[817] "23007156" "22005179" "22009954" "22007765" "21004567" "23008726" "21007570" "24004324" "22003524" "21006359" "23001238" "21009648"
[829] "22006243" "23006673" "23009302" "24009572" "23006675" "22001772" "21004993" "24001848" "24009705" "22009138" "21005101" "22001867"
[841] "21003079" "22002782" "23003174" "21001153" "24003609" "22006053" "22002540" "21007391" "24006540" "23009918" "21002506" "24004068"
[853] "22005726" "23008283" "22003709" "21003696" "24003843" "23004576" "23005369" "22005391" "24005370" "24006029" "22005472" "21009876"
[865] "21009836" "21003526" "24004634" "22002281" "22008823" "22006400" "22001679" "24005960" "23005463" "21006724" "22004545" "23001076"
[877] "23005934" "22002387" "24002114" "21006990" "24008352" "21002501" "24002725" "21003728" "23007354" "22007798" "23009934" "21006113"
[889] "21004013" "21002543" "23002400" "22006970" "21004918" "24003543" "24004419" "22004106" "23007765" "24003535" "22002092" "24002951"
[901] "22002608" "22007196" "23005059" "22005318" "23006040" "24009035" "24003599" "24005457" "24007999" "21001594" "23007547" "22002583"
[913] "21007464" "24002259" "21006844" "23002251" "22007886" "22002883" "21004276" "22002890" "22009016" "21004649" "21006102" "21003629"
[925] "22005803" "22007457" "24008959" "23003373" "22006213" "23002073" "24002104" "23006351" "22005818" "21007832" "24002118" "21006527"
[937] "22002324" "22005059" "24002851" "21007896" "24006097" "24004065" "21002881" "21009453" "21001805" "23004110" "21002511" "21004474"
[949] "21009778" "21006526" "23001507" "22004724" "24002978" "24006771" "23008909" "21003967" "21007327" "22001826" "21008860" "24004166"
[961] "21007091" "22005201" "21003309" "21007286" "22009856" "21007556" "24009044" "21007622" "22009352" "22009930" "23009026" "24001339"
[973] "24008393" "23002290" "23004049" "24002298" "24008727" "23005661" "24005628" "21009468" "21007731" "24001521" "21003283" "24001875"
[985] "22002054" "22008522" "23006032" "23006844" "23002310" "24004658" "22007730" "22003285" "23001154" "24007595" "22007746" "24003032"
[997] "23004256" "23006389" "24002947" "21006632"
papd$nota[substr(papd$carnet, 1, 2)=="24"]
[1] 86 91 72 71 92 93 86 82 84 74
n<-100
dataset<-data.frame(cantidad= round(runif(n,min=10,max=100),0),
precio=rnorm(n,mean=50,sd=20),
disponible=sample(c(T,F),n,replace=TRUE)
)
dataset
nrow(dataset)
[1] 100
ncol(dataset)
[1] 3
dim(dataset)
[1] 100 3
colnames(dataset)
[1] "cantidad" "precio" "disponible"
colnames(dataset)<-c("CANTIDAD", "PRECIO","DISPONIBLE")
dataset
dataset[1,1]
[1] 28
#Seleccionar columna
dataset[,1]
[1] 28 40 17 90 46 91 32 13 32 36 85 93 67 80 66 27 24 71 21 14 51 24 66 75 61 26 13 90 15 35 65 57 19 55 65 69 86 16 89 36 47 50 59 22 86
[46] 58 11 87 73 15 86 63 66 68 14 51 11 81 90 40 28 47 92 55 95 80 17 48 34 98 70 33 37 69 76 10 99 59 80 23 88 23 73 92 71 48 29 87 86 39
[91] 64 92 17 48 95 75 27 67 55 95
dataset$CANTIDAD
[1] 28 40 17 90 46 91 32 13 32 36 85 93 67 80 66 27 24 71 21 14 51 24 66 75 61 26 13 90 15 35 65 57 19 55 65 69 86 16 89 36 47 50 59 22 86
[46] 58 11 87 73 15 86 63 66 68 14 51 11 81 90 40 28 47 92 55 95 80 17 48 34 98 70 33 37 69 76 10 99 59 80 23 88 23 73 92 71 48 29 87 86 39
[91] 64 92 17 48 95 75 27 67 55 95
dataset[c(10,20,30,40,50),c(1,3)]
filtro<-dataset$DISPONIBLE==TRUE
dataset[filtro,]
filtro<-((dataset$DISPONIBLE==TRUE) & (dataset$PRECIO>=50))
dataset[filtro,]
sum(dataset$PRECIO)
[1] 5128.014
library(nycflights23)
library(ggplot2)
library(dplyr)
Attaching package: ‘dplyr’
The following objects are masked from ‘package:stats’:
filter, lag
The following objects are masked from ‘package:base’:
intersect, setdiff, setequal, union
dataset<-flights
dataset
glimpse(dataset)
Rows: 435,352
Columns: 19
$ year <int> 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2…
$ month <int> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1…
$ day <int> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1…
$ dep_time <int> 1, 18, 31, 33, 36, 503, 520, 524, 537, 547, 549, 551, 552, 554, 554, 558, 600, 600, 6…
$ sched_dep_time <int> 2038, 2300, 2344, 2140, 2048, 500, 510, 530, 520, 545, 559, 600, 559, 600, 600, 605, …
$ dep_delay <dbl> 203, 78, 47, 173, 228, 3, 10, -6, 17, 2, -10, -9, -7, -6, -6, -7, 0, 0, 0, -2, 5, 0, …
$ arr_time <int> 328, 228, 500, 238, 223, 808, 948, 645, 926, 845, 905, 846, 857, 914, 725, 719, 729, …
$ sched_arr_time <int> 3, 135, 426, 2352, 2252, 815, 949, 710, 818, 852, 901, 859, 911, 920, 735, 750, 752, …
$ arr_delay <dbl> 205, 53, 34, 166, 211, -7, -1, -25, 68, -7, 4, -13, -14, -6, -10, -31, -23, -10, -30,…
$ carrier <chr> "UA", "DL", "B6", "B6", "UA", "AA", "B6", "AA", "UA", "NK", "B6", "B6", "AA", "AA", "…
$ flight <int> 628, 393, 371, 1053, 219, 499, 996, 981, 206, 225, 800, 93, 518, 165, 445, 449, 1084,…
$ tailnum <chr> "N25201", "N830DN", "N807JB", "N265JB", "N17730", "N925AN", "N2043J", "N918AN", "N131…
$ origin <chr> "EWR", "JFK", "JFK", "JFK", "EWR", "EWR", "JFK", "EWR", "EWR", "EWR", "JFK", "LGA", "…
$ dest <chr> "SMF", "ATL", "BQN", "CHS", "DTW", "MIA", "BQN", "ORD", "IAH", "FLL", "PBI", "MCO", "…
$ air_time <dbl> 367, 108, 190, 108, 80, 154, 192, 119, 258, 157, 164, 143, 159, 169, 116, 118, 116, 8…
$ distance <dbl> 2500, 760, 1576, 636, 488, 1085, 1576, 719, 1400, 1065, 1028, 950, 1096, 1089, 748, 7…
$ hour <dbl> 20, 23, 23, 21, 20, 5, 5, 5, 5, 5, 5, 6, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 6, 6, 6, 6,…
$ minute <dbl> 38, 0, 44, 40, 48, 0, 10, 30, 20, 45, 59, 0, 59, 0, 0, 5, 0, 0, 0, 5, 0, 5, 30, 20, 1…
$ time_hour <dttm> 2023-01-01 20:00:00, 2023-01-01 23:00:00, 2023-01-01 23:00:00, 2023-01-01 21:00:00, …
View(dataset)
dataset %>%
filter(air_time<=300) %>%
filter(dep_time>=18)
dataset %>%
filter(air_time<=300 , dep_time>=18)
dataset %>%
filter((air_time<=300) & (dep_time>=18))
dataset %>%
filter((air_time<=300) | (air_time>=350))
dataset %>%
filter((air_time<=300) | (air_time>=350)) %>%
filter(origin=='EWR')
dataset %>%
filter((air_time<=300) | (air_time>=350)) %>%
filter(origin %in% c('EWR','JFK'))
# si se hace de la otra forma es mas largo y dificl de mantener
filter(filter(dataset, (air_time<=300) | (air_time >=350)), origin %in% c('EWR','JFK'))
dataset %>%
filter((air_time <=300)|(air_time >=350))%>%
filter(!origin %in% c("EWR","JFK"))
\[ ∫_b^∞ f(x) dx = ∫_b^∞ 2 dx = 2x|_b^∞ = ∞ \]
dataset %>%
distinct(origin)
unique(dataset$origin)
[1] "EWR" "JFK" "LGA"
dataset %>%
sample_frac(0.3, replace = FALSE)
dataset %>%
sample_n(100, replace = FALSE)
dataset %>%
slice(10:25)
dataset[10:25, ]
dataset %>%
top_n(10, air_time) %>%
arrange(-air_time)
dataset %>%
distinct(dest,origin)
dataset[duplicated(dataset[ ,c('origin','carrier')] ),]
dataset %>%
select(dep_time,sched_dep_time,sched_arr_time,origin, dest)
dataset %>%
select(dep_time,sched_dep_time,sched_arr_time,origin, dest)
dataset %>%
select(ends_with("time"), origin,dest)
dataset %>%
select(-year)
dataset %>%
select(matches(".+_.+_.+"),origin, dest)
dataset %>%
summarise(distacia_promedio = mean(distance))
dataset %>%
summarise(tiempo_de_vuelo_promedio = mean(air_time, na.rm = TRUE))
dataset %>%
summarise(tiempo_de_vuelo_promedio = mean(air_time, na.rm = TRUE),
distancia_promedio = mean(distance, na.rm = TRUE))
NA
NA
dataset %>%
group_by(origin) %>%
summarise(cantidad=n())
str(dataset)
tibble [435,352 × 19] (S3: tbl_df/tbl/data.frame)
$ year : int [1:435352] 2023 2023 2023 2023 2023 2023 2023 2023 2023 2023 ...
$ month : int [1:435352] 1 1 1 1 1 1 1 1 1 1 ...
$ day : int [1:435352] 1 1 1 1 1 1 1 1 1 1 ...
$ dep_time : int [1:435352] 1 18 31 33 36 503 520 524 537 547 ...
$ sched_dep_time: int [1:435352] 2038 2300 2344 2140 2048 500 510 530 520 545 ...
$ dep_delay : num [1:435352] 203 78 47 173 228 3 10 -6 17 2 ...
$ arr_time : int [1:435352] 328 228 500 238 223 808 948 645 926 845 ...
$ sched_arr_time: int [1:435352] 3 135 426 2352 2252 815 949 710 818 852 ...
$ arr_delay : num [1:435352] 205 53 34 166 211 -7 -1 -25 68 -7 ...
$ carrier : chr [1:435352] "UA" "DL" "B6" "B6" ...
$ flight : int [1:435352] 628 393 371 1053 219 499 996 981 206 225 ...
$ tailnum : chr [1:435352] "N25201" "N830DN" "N807JB" "N265JB" ...
$ origin : chr [1:435352] "EWR" "JFK" "JFK" "JFK" ...
$ dest : chr [1:435352] "SMF" "ATL" "BQN" "CHS" ...
$ air_time : num [1:435352] 367 108 190 108 80 154 192 119 258 157 ...
$ distance : num [1:435352] 2500 760 1576 636 488 ...
$ hour : num [1:435352] 20 23 23 21 20 5 5 5 5 5 ...
$ minute : num [1:435352] 38 0 44 40 48 0 10 30 20 45 ...
$ time_hour : POSIXct[1:435352], format: "2023-01-01 20:00:00" "2023-01-01 23:00:00" "2023-01-01 23:00:00" "2023-01-01 21:00:00" ...
temp<-dataset%>%
group_by(origin)
str(temp)
gropd_df [435,352 × 19] (S3: grouped_df/tbl_df/tbl/data.frame)
$ year : int [1:435352] 2023 2023 2023 2023 2023 2023 2023 2023 2023 2023 ...
$ month : int [1:435352] 1 1 1 1 1 1 1 1 1 1 ...
$ day : int [1:435352] 1 1 1 1 1 1 1 1 1 1 ...
$ dep_time : int [1:435352] 1 18 31 33 36 503 520 524 537 547 ...
$ sched_dep_time: int [1:435352] 2038 2300 2344 2140 2048 500 510 530 520 545 ...
$ dep_delay : num [1:435352] 203 78 47 173 228 3 10 -6 17 2 ...
$ arr_time : int [1:435352] 328 228 500 238 223 808 948 645 926 845 ...
$ sched_arr_time: int [1:435352] 3 135 426 2352 2252 815 949 710 818 852 ...
$ arr_delay : num [1:435352] 205 53 34 166 211 -7 -1 -25 68 -7 ...
$ carrier : chr [1:435352] "UA" "DL" "B6" "B6" ...
$ flight : int [1:435352] 628 393 371 1053 219 499 996 981 206 225 ...
$ tailnum : chr [1:435352] "N25201" "N830DN" "N807JB" "N265JB" ...
$ origin : chr [1:435352] "EWR" "JFK" "JFK" "JFK" ...
$ dest : chr [1:435352] "SMF" "ATL" "BQN" "CHS" ...
$ air_time : num [1:435352] 367 108 190 108 80 154 192 119 258 157 ...
$ distance : num [1:435352] 2500 760 1576 636 488 ...
$ hour : num [1:435352] 20 23 23 21 20 5 5 5 5 5 ...
$ minute : num [1:435352] 38 0 44 40 48 0 10 30 20 45 ...
$ time_hour : POSIXct[1:435352], format: "2023-01-01 20:00:00" "2023-01-01 23:00:00" "2023-01-01 23:00:00" "2023-01-01 21:00:00" ...
- attr(*, "groups")= tibble [3 × 2] (S3: tbl_df/tbl/data.frame)
..$ origin: chr [1:3] "EWR" "JFK" "LGA"
..$ .rows : list<int> [1:3]
.. ..$ : int [1:138578] 1 5 6 8 9 10 15 16 18 21 ...
.. ..$ : int [1:133048] 2 3 4 7 11 14 35 38 40 42 ...
.. ..$ : int [1:163726] 12 13 17 19 20 22 25 26 27 28 ...
.. ..@ ptype: int(0)
..- attr(*, ".drop")= logi TRUE
dataset %>%
group_by(origin, carrier) %>%
summarise(cantidad_vuelos = n())
`summarise()` has grouped output by 'origin'. You can override using the `.groups` argument.
dataset %>%
mutate(speed = (distance*1.605)/(air_time/60)) %>%
mutate(distance_km = (distance*1.605)) %>%
group_by(carrier) %>%
summarise(velocidad_promerio = mean(speed, na.rm = TRUE)) %>%
top_n(10, velocidad_promerio) %>%
arrange(-velocidad_promerio)
dataset %>%
filter(!is.na(air_time)) %>%
mutate(speed = (distance*1.605)/(air_time/60)) %>%
mutate(distance_km = (distance*1.605)) %>%
group_by(carrier) %>%
summarise(velocidad_promerio = mean(speed)) %>%
top_n(10, velocidad_promerio) %>%
arrange(-velocidad_promerio)
inner_join(airlines, flights, by='carrier')
datasetx<-inner_join(airlines, flights, by='carrier')
inner_join(datasetx, planes, by='tailnum')
dataset %>%
ggplot(aes(x=dep_time, y=..density..)) +
geom_density(color="blue", lwd=1, fill='steel blue') +
theme_minimal()+
xlab("Dep Time")+
ylab("Densidad")+
ggtitle("Densidad de Dep time")
dataset %>%
ggplot(aes(x=distance, y=air_time)) +
geom_point()
dataset %>%
filter(!is.na(air_time), !is.na(distance)) %>%
sample_n(200, replase=FALSE) %>%
ggplot(aes(x=distance, y=air_time, shape=origin, col=carrier)) +
geom_point()+
theme_minimal()
dataset %>%
group_by(carrier) %>%
summarise(cantidad=n()) %>%
ggplot(aes(x=carrier, y=sort(cantidad), fill=carrier)) +
geom_bar(stat = 'identity') + theme_bw()
#theme_minimal()
dataset %>%
group_by(month) %>%
summarise(cantidad_vuelos=n()) %>%
ggplot(aes(x=month, y=cantidad_vuelos))+
geom_line(col='blue', lwd=1, linetype=2) +
theme_minimal()
temp<-dataset %>%
group_by(month) %>%
summarise(cantidad_vuelos=n())
temp %>%
ggplot(aes(x=month, y=cantidad_vuelos))+
geom_line(col='blue', lwd=1, linetype=1) +
geom_point(data=temp, aes(x=month, y=cantidad_vuelos), col='red', size=3) +
theme_minimal()
temp<-dataset %>%
group_by(month) %>%
summarise(cantidad_vuelos=n())
promedios<-dataset %>%
group_by(month) %>%
summarise(promedio_distancia = sum(distance))
temp %>%
ggplot(aes(x=month, y=cantidad_vuelos))+
geom_line(col='blue', lwd=1, linetype=1) +
geom_point(data=temp, aes(x=month, y=cantidad_vuelos), col='red', size=3) +
geom_line(data=promedios, aes(x=month, y=promedio_distancia), col='green')
theme_minimal()
List of 136
$ line :List of 6
..$ colour : chr "black"
..$ linewidth : num 0.5
..$ linetype : num 1
..$ lineend : chr "butt"
..$ arrow : logi FALSE
..$ inherit.blank: logi TRUE
..- attr(*, "class")= chr [1:2] "element_line" "element"
$ rect :List of 5
..$ fill : chr "white"
..$ colour : chr "black"
..$ linewidth : num 0.5
..$ linetype : num 1
..$ inherit.blank: logi TRUE
..- attr(*, "class")= chr [1:2] "element_rect" "element"
$ text :List of 11
..$ family : chr ""
..$ face : chr "plain"
..$ colour : chr "black"
..$ size : num 11
..$ hjust : num 0.5
..$ vjust : num 0.5
..$ angle : num 0
..$ lineheight : num 0.9
..$ margin : 'margin' num [1:4] 0points 0points 0points 0points
.. ..- attr(*, "unit")= int 8
..$ debug : logi FALSE
..$ inherit.blank: logi TRUE
..- attr(*, "class")= chr [1:2] "element_text" "element"
$ title : NULL
$ aspect.ratio : NULL
$ axis.title : NULL
$ axis.title.x :List of 11
..$ family : NULL
..$ face : NULL
..$ colour : NULL
..$ size : NULL
..$ hjust : NULL
..$ vjust : num 1
..$ angle : NULL
..$ lineheight : NULL
..$ margin : 'margin' num [1:4] 2.75points 0points 0points 0points
.. ..- attr(*, "unit")= int 8
..$ debug : NULL
..$ inherit.blank: logi TRUE
..- attr(*, "class")= chr [1:2] "element_text" "element"
$ axis.title.x.top :List of 11
..$ family : NULL
..$ face : NULL
..$ colour : NULL
..$ size : NULL
..$ hjust : NULL
..$ vjust : num 0
..$ angle : NULL
..$ lineheight : NULL
..$ margin : 'margin' num [1:4] 0points 0points 2.75points 0points
.. ..- attr(*, "unit")= int 8
..$ debug : NULL
..$ inherit.blank: logi TRUE
..- attr(*, "class")= chr [1:2] "element_text" "element"
$ axis.title.x.bottom : NULL
$ axis.title.y :List of 11
..$ family : NULL
..$ face : NULL
..$ colour : NULL
..$ size : NULL
..$ hjust : NULL
..$ vjust : num 1
..$ angle : num 90
..$ lineheight : NULL
..$ margin : 'margin' num [1:4] 0points 2.75points 0points 0points
.. ..- attr(*, "unit")= int 8
..$ debug : NULL
..$ inherit.blank: logi TRUE
..- attr(*, "class")= chr [1:2] "element_text" "element"
$ axis.title.y.left : NULL
$ axis.title.y.right :List of 11
..$ family : NULL
..$ face : NULL
..$ colour : NULL
..$ size : NULL
..$ hjust : NULL
..$ vjust : num 1
..$ angle : num -90
..$ lineheight : NULL
..$ margin : 'margin' num [1:4] 0points 0points 0points 2.75points
.. ..- attr(*, "unit")= int 8
..$ debug : NULL
..$ inherit.blank: logi TRUE
..- attr(*, "class")= chr [1:2] "element_text" "element"
$ axis.text :List of 11
..$ family : NULL
..$ face : NULL
..$ colour : chr "grey30"
..$ size : 'rel' num 0.8
..$ hjust : NULL
..$ vjust : NULL
..$ angle : NULL
..$ lineheight : NULL
..$ margin : NULL
..$ debug : NULL
..$ inherit.blank: logi TRUE
..- attr(*, "class")= chr [1:2] "element_text" "element"
$ axis.text.x :List of 11
..$ family : NULL
..$ face : NULL
..$ colour : NULL
..$ size : NULL
..$ hjust : NULL
..$ vjust : num 1
..$ angle : NULL
..$ lineheight : NULL
..$ margin : 'margin' num [1:4] 2.2points 0points 0points 0points
.. ..- attr(*, "unit")= int 8
..$ debug : NULL
..$ inherit.blank: logi TRUE
..- attr(*, "class")= chr [1:2] "element_text" "element"
$ axis.text.x.top :List of 11
..$ family : NULL
..$ face : NULL
..$ colour : NULL
..$ size : NULL
..$ hjust : NULL
..$ vjust : num 0
..$ angle : NULL
..$ lineheight : NULL
..$ margin : 'margin' num [1:4] 0points 0points 2.2points 0points
.. ..- attr(*, "unit")= int 8
..$ debug : NULL
..$ inherit.blank: logi TRUE
..- attr(*, "class")= chr [1:2] "element_text" "element"
$ axis.text.x.bottom : NULL
$ axis.text.y :List of 11
..$ family : NULL
..$ face : NULL
..$ colour : NULL
..$ size : NULL
..$ hjust : num 1
..$ vjust : NULL
..$ angle : NULL
..$ lineheight : NULL
..$ margin : 'margin' num [1:4] 0points 2.2points 0points 0points
.. ..- attr(*, "unit")= int 8
..$ debug : NULL
..$ inherit.blank: logi TRUE
..- attr(*, "class")= chr [1:2] "element_text" "element"
$ axis.text.y.left : NULL
$ axis.text.y.right :List of 11
..$ family : NULL
..$ face : NULL
..$ colour : NULL
..$ size : NULL
..$ hjust : num 0
..$ vjust : NULL
..$ angle : NULL
..$ lineheight : NULL
..$ margin : 'margin' num [1:4] 0points 0points 0points 2.2points
.. ..- attr(*, "unit")= int 8
..$ debug : NULL
..$ inherit.blank: logi TRUE
..- attr(*, "class")= chr [1:2] "element_text" "element"
$ axis.text.theta : NULL
$ axis.text.r :List of 11
..$ family : NULL
..$ face : NULL
..$ colour : NULL
..$ size : NULL
..$ hjust : num 0.5
..$ vjust : NULL
..$ angle : NULL
..$ lineheight : NULL
..$ margin : 'margin' num [1:4] 0points 2.2points 0points 2.2points
.. ..- attr(*, "unit")= int 8
..$ debug : NULL
..$ inherit.blank: logi TRUE
..- attr(*, "class")= chr [1:2] "element_text" "element"
$ axis.ticks : list()
..- attr(*, "class")= chr [1:2] "element_blank" "element"
$ axis.ticks.x : NULL
$ axis.ticks.x.top : NULL
$ axis.ticks.x.bottom : NULL
$ axis.ticks.y : NULL
$ axis.ticks.y.left : NULL
$ axis.ticks.y.right : NULL
$ axis.ticks.theta : NULL
$ axis.ticks.r : NULL
$ axis.minor.ticks.x.top : NULL
$ axis.minor.ticks.x.bottom : NULL
$ axis.minor.ticks.y.left : NULL
$ axis.minor.ticks.y.right : NULL
$ axis.minor.ticks.theta : NULL
$ axis.minor.ticks.r : NULL
$ axis.ticks.length : 'simpleUnit' num 2.75points
..- attr(*, "unit")= int 8
$ axis.ticks.length.x : NULL
$ axis.ticks.length.x.top : NULL
$ axis.ticks.length.x.bottom : NULL
$ axis.ticks.length.y : NULL
$ axis.ticks.length.y.left : NULL
$ axis.ticks.length.y.right : NULL
$ axis.ticks.length.theta : NULL
$ axis.ticks.length.r : NULL
$ axis.minor.ticks.length : 'rel' num 0.75
$ axis.minor.ticks.length.x : NULL
$ axis.minor.ticks.length.x.top : NULL
$ axis.minor.ticks.length.x.bottom: NULL
$ axis.minor.ticks.length.y : NULL
$ axis.minor.ticks.length.y.left : NULL
$ axis.minor.ticks.length.y.right : NULL
$ axis.minor.ticks.length.theta : NULL
$ axis.minor.ticks.length.r : NULL
$ axis.line : list()
..- attr(*, "class")= chr [1:2] "element_blank" "element"
$ axis.line.x : NULL
$ axis.line.x.top : NULL
$ axis.line.x.bottom : NULL
$ axis.line.y : NULL
$ axis.line.y.left : NULL
$ axis.line.y.right : NULL
$ axis.line.theta : NULL
$ axis.line.r : NULL
$ legend.background : list()
..- attr(*, "class")= chr [1:2] "element_blank" "element"
$ legend.margin : 'margin' num [1:4] 5.5points 5.5points 5.5points 5.5points
..- attr(*, "unit")= int 8
$ legend.spacing : 'simpleUnit' num 11points
..- attr(*, "unit")= int 8
$ legend.spacing.x : NULL
$ legend.spacing.y : NULL
$ legend.key : list()
..- attr(*, "class")= chr [1:2] "element_blank" "element"
$ legend.key.size : 'simpleUnit' num 1.2lines
..- attr(*, "unit")= int 3
$ legend.key.height : NULL
$ legend.key.width : NULL
$ legend.key.spacing : 'simpleUnit' num 5.5points
..- attr(*, "unit")= int 8
$ legend.key.spacing.x : NULL
$ legend.key.spacing.y : NULL
$ legend.frame : NULL
$ legend.ticks : NULL
$ legend.ticks.length : 'rel' num 0.2
$ legend.axis.line : NULL
$ legend.text :List of 11
..$ family : NULL
..$ face : NULL
..$ colour : NULL
..$ size : 'rel' num 0.8
..$ hjust : NULL
..$ vjust : NULL
..$ angle : NULL
..$ lineheight : NULL
..$ margin : NULL
..$ debug : NULL
..$ inherit.blank: logi TRUE
..- attr(*, "class")= chr [1:2] "element_text" "element"
$ legend.text.position : NULL
$ legend.title :List of 11
..$ family : NULL
..$ face : NULL
..$ colour : NULL
..$ size : NULL
..$ hjust : num 0
..$ vjust : NULL
..$ angle : NULL
..$ lineheight : NULL
..$ margin : NULL
..$ debug : NULL
..$ inherit.blank: logi TRUE
..- attr(*, "class")= chr [1:2] "element_text" "element"
$ legend.title.position : NULL
$ legend.position : chr "right"
$ legend.position.inside : NULL
$ legend.direction : NULL
$ legend.byrow : NULL
$ legend.justification : chr "center"
$ legend.justification.top : NULL
$ legend.justification.bottom : NULL
$ legend.justification.left : NULL
$ legend.justification.right : NULL
$ legend.justification.inside : NULL
$ legend.location : NULL
$ legend.box : NULL
$ legend.box.just : NULL
$ legend.box.margin : 'margin' num [1:4] 0cm 0cm 0cm 0cm
..- attr(*, "unit")= int 1
$ legend.box.background : list()
..- attr(*, "class")= chr [1:2] "element_blank" "element"
$ legend.box.spacing : 'simpleUnit' num 11points
..- attr(*, "unit")= int 8
[list output truncated]
- attr(*, "class")= chr [1:2] "theme" "gg"
- attr(*, "complete")= logi TRUE
- attr(*, "validate")= logi TRUE
temp<-dataset %>%
group_by(month) %>%
summarise(cantidad_vuelos=n())
promedios<-dataset %>%
group_by(month) %>%
summarise(promedio_distancia = n()+1000)
temp %>%
ggplot(aes(x=month, y=cantidad_vuelos))+
geom_line(col='blue', lwd=1, linetype=1) +
geom_point(data=temp, aes(x=month, y=cantidad_vuelos), col='red', size=3) +
geom_line(data=promedios, aes(x=month, y=promedio_distancia), col='green')
theme_minimal()
List of 136
$ line :List of 6
..$ colour : chr "black"
..$ linewidth : num 0.5
..$ linetype : num 1
..$ lineend : chr "butt"
..$ arrow : logi FALSE
..$ inherit.blank: logi TRUE
..- attr(*, "class")= chr [1:2] "element_line" "element"
$ rect :List of 5
..$ fill : chr "white"
..$ colour : chr "black"
..$ linewidth : num 0.5
..$ linetype : num 1
..$ inherit.blank: logi TRUE
..- attr(*, "class")= chr [1:2] "element_rect" "element"
$ text :List of 11
..$ family : chr ""
..$ face : chr "plain"
..$ colour : chr "black"
..$ size : num 11
..$ hjust : num 0.5
..$ vjust : num 0.5
..$ angle : num 0
..$ lineheight : num 0.9
..$ margin : 'margin' num [1:4] 0points 0points 0points 0points
.. ..- attr(*, "unit")= int 8
..$ debug : logi FALSE
..$ inherit.blank: logi TRUE
..- attr(*, "class")= chr [1:2] "element_text" "element"
$ title : NULL
$ aspect.ratio : NULL
$ axis.title : NULL
$ axis.title.x :List of 11
..$ family : NULL
..$ face : NULL
..$ colour : NULL
..$ size : NULL
..$ hjust : NULL
..$ vjust : num 1
..$ angle : NULL
..$ lineheight : NULL
..$ margin : 'margin' num [1:4] 2.75points 0points 0points 0points
.. ..- attr(*, "unit")= int 8
..$ debug : NULL
..$ inherit.blank: logi TRUE
..- attr(*, "class")= chr [1:2] "element_text" "element"
$ axis.title.x.top :List of 11
..$ family : NULL
..$ face : NULL
..$ colour : NULL
..$ size : NULL
..$ hjust : NULL
..$ vjust : num 0
..$ angle : NULL
..$ lineheight : NULL
..$ margin : 'margin' num [1:4] 0points 0points 2.75points 0points
.. ..- attr(*, "unit")= int 8
..$ debug : NULL
..$ inherit.blank: logi TRUE
..- attr(*, "class")= chr [1:2] "element_text" "element"
$ axis.title.x.bottom : NULL
$ axis.title.y :List of 11
..$ family : NULL
..$ face : NULL
..$ colour : NULL
..$ size : NULL
..$ hjust : NULL
..$ vjust : num 1
..$ angle : num 90
..$ lineheight : NULL
..$ margin : 'margin' num [1:4] 0points 2.75points 0points 0points
.. ..- attr(*, "unit")= int 8
..$ debug : NULL
..$ inherit.blank: logi TRUE
..- attr(*, "class")= chr [1:2] "element_text" "element"
$ axis.title.y.left : NULL
$ axis.title.y.right :List of 11
..$ family : NULL
..$ face : NULL
..$ colour : NULL
..$ size : NULL
..$ hjust : NULL
..$ vjust : num 1
..$ angle : num -90
..$ lineheight : NULL
..$ margin : 'margin' num [1:4] 0points 0points 0points 2.75points
.. ..- attr(*, "unit")= int 8
..$ debug : NULL
..$ inherit.blank: logi TRUE
..- attr(*, "class")= chr [1:2] "element_text" "element"
$ axis.text :List of 11
..$ family : NULL
..$ face : NULL
..$ colour : chr "grey30"
..$ size : 'rel' num 0.8
..$ hjust : NULL
..$ vjust : NULL
..$ angle : NULL
..$ lineheight : NULL
..$ margin : NULL
..$ debug : NULL
..$ inherit.blank: logi TRUE
..- attr(*, "class")= chr [1:2] "element_text" "element"
$ axis.text.x :List of 11
..$ family : NULL
..$ face : NULL
..$ colour : NULL
..$ size : NULL
..$ hjust : NULL
..$ vjust : num 1
..$ angle : NULL
..$ lineheight : NULL
..$ margin : 'margin' num [1:4] 2.2points 0points 0points 0points
.. ..- attr(*, "unit")= int 8
..$ debug : NULL
..$ inherit.blank: logi TRUE
..- attr(*, "class")= chr [1:2] "element_text" "element"
$ axis.text.x.top :List of 11
..$ family : NULL
..$ face : NULL
..$ colour : NULL
..$ size : NULL
..$ hjust : NULL
..$ vjust : num 0
..$ angle : NULL
..$ lineheight : NULL
..$ margin : 'margin' num [1:4] 0points 0points 2.2points 0points
.. ..- attr(*, "unit")= int 8
..$ debug : NULL
..$ inherit.blank: logi TRUE
..- attr(*, "class")= chr [1:2] "element_text" "element"
$ axis.text.x.bottom : NULL
$ axis.text.y :List of 11
..$ family : NULL
..$ face : NULL
..$ colour : NULL
..$ size : NULL
..$ hjust : num 1
..$ vjust : NULL
..$ angle : NULL
..$ lineheight : NULL
..$ margin : 'margin' num [1:4] 0points 2.2points 0points 0points
.. ..- attr(*, "unit")= int 8
..$ debug : NULL
..$ inherit.blank: logi TRUE
..- attr(*, "class")= chr [1:2] "element_text" "element"
$ axis.text.y.left : NULL
$ axis.text.y.right :List of 11
..$ family : NULL
..$ face : NULL
..$ colour : NULL
..$ size : NULL
..$ hjust : num 0
..$ vjust : NULL
..$ angle : NULL
..$ lineheight : NULL
..$ margin : 'margin' num [1:4] 0points 0points 0points 2.2points
.. ..- attr(*, "unit")= int 8
..$ debug : NULL
..$ inherit.blank: logi TRUE
..- attr(*, "class")= chr [1:2] "element_text" "element"
$ axis.text.theta : NULL
$ axis.text.r :List of 11
..$ family : NULL
..$ face : NULL
..$ colour : NULL
..$ size : NULL
..$ hjust : num 0.5
..$ vjust : NULL
..$ angle : NULL
..$ lineheight : NULL
..$ margin : 'margin' num [1:4] 0points 2.2points 0points 2.2points
.. ..- attr(*, "unit")= int 8
..$ debug : NULL
..$ inherit.blank: logi TRUE
..- attr(*, "class")= chr [1:2] "element_text" "element"
$ axis.ticks : list()
..- attr(*, "class")= chr [1:2] "element_blank" "element"
$ axis.ticks.x : NULL
$ axis.ticks.x.top : NULL
$ axis.ticks.x.bottom : NULL
$ axis.ticks.y : NULL
$ axis.ticks.y.left : NULL
$ axis.ticks.y.right : NULL
$ axis.ticks.theta : NULL
$ axis.ticks.r : NULL
$ axis.minor.ticks.x.top : NULL
$ axis.minor.ticks.x.bottom : NULL
$ axis.minor.ticks.y.left : NULL
$ axis.minor.ticks.y.right : NULL
$ axis.minor.ticks.theta : NULL
$ axis.minor.ticks.r : NULL
$ axis.ticks.length : 'simpleUnit' num 2.75points
..- attr(*, "unit")= int 8
$ axis.ticks.length.x : NULL
$ axis.ticks.length.x.top : NULL
$ axis.ticks.length.x.bottom : NULL
$ axis.ticks.length.y : NULL
$ axis.ticks.length.y.left : NULL
$ axis.ticks.length.y.right : NULL
$ axis.ticks.length.theta : NULL
$ axis.ticks.length.r : NULL
$ axis.minor.ticks.length : 'rel' num 0.75
$ axis.minor.ticks.length.x : NULL
$ axis.minor.ticks.length.x.top : NULL
$ axis.minor.ticks.length.x.bottom: NULL
$ axis.minor.ticks.length.y : NULL
$ axis.minor.ticks.length.y.left : NULL
$ axis.minor.ticks.length.y.right : NULL
$ axis.minor.ticks.length.theta : NULL
$ axis.minor.ticks.length.r : NULL
$ axis.line : list()
..- attr(*, "class")= chr [1:2] "element_blank" "element"
$ axis.line.x : NULL
$ axis.line.x.top : NULL
$ axis.line.x.bottom : NULL
$ axis.line.y : NULL
$ axis.line.y.left : NULL
$ axis.line.y.right : NULL
$ axis.line.theta : NULL
$ axis.line.r : NULL
$ legend.background : list()
..- attr(*, "class")= chr [1:2] "element_blank" "element"
$ legend.margin : 'margin' num [1:4] 5.5points 5.5points 5.5points 5.5points
..- attr(*, "unit")= int 8
$ legend.spacing : 'simpleUnit' num 11points
..- attr(*, "unit")= int 8
$ legend.spacing.x : NULL
$ legend.spacing.y : NULL
$ legend.key : list()
..- attr(*, "class")= chr [1:2] "element_blank" "element"
$ legend.key.size : 'simpleUnit' num 1.2lines
..- attr(*, "unit")= int 3
$ legend.key.height : NULL
$ legend.key.width : NULL
$ legend.key.spacing : 'simpleUnit' num 5.5points
..- attr(*, "unit")= int 8
$ legend.key.spacing.x : NULL
$ legend.key.spacing.y : NULL
$ legend.frame : NULL
$ legend.ticks : NULL
$ legend.ticks.length : 'rel' num 0.2
$ legend.axis.line : NULL
$ legend.text :List of 11
..$ family : NULL
..$ face : NULL
..$ colour : NULL
..$ size : 'rel' num 0.8
..$ hjust : NULL
..$ vjust : NULL
..$ angle : NULL
..$ lineheight : NULL
..$ margin : NULL
..$ debug : NULL
..$ inherit.blank: logi TRUE
..- attr(*, "class")= chr [1:2] "element_text" "element"
$ legend.text.position : NULL
$ legend.title :List of 11
..$ family : NULL
..$ face : NULL
..$ colour : NULL
..$ size : NULL
..$ hjust : num 0
..$ vjust : NULL
..$ angle : NULL
..$ lineheight : NULL
..$ margin : NULL
..$ debug : NULL
..$ inherit.blank: logi TRUE
..- attr(*, "class")= chr [1:2] "element_text" "element"
$ legend.title.position : NULL
$ legend.position : chr "right"
$ legend.position.inside : NULL
$ legend.direction : NULL
$ legend.byrow : NULL
$ legend.justification : chr "center"
$ legend.justification.top : NULL
$ legend.justification.bottom : NULL
$ legend.justification.left : NULL
$ legend.justification.right : NULL
$ legend.justification.inside : NULL
$ legend.location : NULL
$ legend.box : NULL
$ legend.box.just : NULL
$ legend.box.margin : 'margin' num [1:4] 0cm 0cm 0cm 0cm
..- attr(*, "unit")= int 1
$ legend.box.background : list()
..- attr(*, "class")= chr [1:2] "element_blank" "element"
$ legend.box.spacing : 'simpleUnit' num 11points
..- attr(*, "unit")= int 8
[list output truncated]
- attr(*, "class")= chr [1:2] "theme" "gg"
- attr(*, "complete")= logi TRUE
- attr(*, "validate")= logi TRUE