## Ejercicio 3 # en un terminal: $ ssh alumno01@carleos2.epv.uniovi.es alumno01@carleos2.epv.uniovi.es's password: Welcome to Ubuntu 22.04.3 LTS (GNU/Linux 6.5.0-14-generic x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/pro Expanded Security Maintenance for Applications is not enabled. 5 updates can be applied immediately. 3 of these updates are standard security updates. To see these additional updates run: apt list --upgradable 23 additional security updates can be applied with ESM Apps. Learn more about enabling ESM Apps service at https://ubuntu.com/esm The programs included with the Ubuntu system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. alumno01@carleos2:~$ ls /usr/share/doc | grep -c ^a 41 alumno01@carleos2:~$ ls /usr/share/doc | grep ^a | wc -l 41 alumno01@carleos2:~$ ls -d /usr/share/doc/a* | wc -l 41 alumno01@carleos2:~$ R R version 4.3.2 (2023-10-31) -- "Eye Holes" Copyright (C) 2023 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > length(grep("^a",dir("/usr/share/doc"))) [1] 41 > length(list.files("/usr/share/doc","^a")) [1] 41 > q() Save workspace image? [y/n/c]: n alumno01@carleos2:~$ exit logout Connection to carleos2.epv.uniovi.es closed. $ # por tanto, hay 41 carpetas en /usr/share/doc que empiezan por "a" ## Ejercicio 4 # desde un terminal: $ ssh alumno01@carleos2.epv.uniovi.es alumno01@carleos2.epv.uniovi.es's password: Welcome to Ubuntu 22.04.3 LTS (GNU/Linux 6.5.0-14-generic x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/pro Expanded Security Maintenance for Applications is not enabled. 5 updates can be applied immediately. 3 of these updates are standard security updates. To see these additional updates run: apt list --upgradable 23 additional security updates can be applied with ESM Apps. Learn more about enabling ESM Apps service at https://ubuntu.com/esm Last login: Mon Jan 22 16:27:10 2024 from 156.35.96.171 alumno01@carleos2:~$ wc -l /home/carleos/iot/sensores.txt 5645284 /home/carleos/iot/sensores.txt # hay 5.645.284 renglones en el fichero indicado alumno01@carleos2:~$ head /home/carleos/iot/sensores.txt lun 07 Nov 2022 18:21:39 +0100 coretemp-isa-0000 Adapter: ISA adapter Core 0: +33.0°C (high = +76.0°C, crit = +100.0°C) Core 1: +33.0°C (high = +76.0°C, crit = +100.0°C) lun 07 Nov 2022 18:22:39 +0100 coretemp-isa-0000 Adapter: ISA adapter Core 0: +33.0°C (high = +76.0°C, crit = +100.0°C) alumno01@carleos2:~$ R # los registros están separados por un renglón que indica fecha y hora R version 4.3.2 (2023-10-31) -- "Eye Holes" Copyright (C) 2023 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > s = readLines("/home/carleos/iot/sensores.txt") > head(s) [1] "lun 07 Nov 2022 18:21:39 +0100" [2] "coretemp-isa-0000" [3] "Adapter: ISA adapter" [4] "Core 0: +33.0°C (high = +76.0°C, crit = +100.0°C)" [5] "Core 1: +33.0°C (high = +76.0°C, crit = +100.0°C)" [6] "" > as.Date(s[1],"%a %d %b %Y") [1] "2022-11-07" > fechas = na.omit(as.Date(s,"%a %d %b %Y")) > summary(fechas) Min. 1st Qu. Median Mean 3rd Qu. Max. "2022-11-07" "2023-01-24" "2023-07-20" "2023-06-11" "2023-10-31" "2024-01-22" > sum(fechas > as.Date("2023-10-01")) [1] 60867 > q() Save workspace image? [y/n/c]: n alumno01@carleos2:~$ # por tanto, hay 60.867 registros con fecha posterior a 2023-10-01 ## Ejercicio 5 # desde un terminal: $ ssh alumno01@carleos2.epv.uniovi.es alumno01@carleos2.epv.uniovi.es's password: Welcome to Ubuntu 22.04.3 LTS (GNU/Linux 6.5.0-14-generic x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/pro Expanded Security Maintenance for Applications is not enabled. 5 updates can be applied immediately. 3 of these updates are standard security updates. To see these additional updates run: apt list --upgradable 23 additional security updates can be applied with ESM Apps. Learn more about enabling ESM Apps service at https://ubuntu.com/esm Last login: Mon Jan 22 16:35:45 2024 from 156.35.96.171 alumno01@carleos2:~$ mkdir ~/ejercicio5 alumno01@carleos2:~$ cd ~/ejercicio5 alumno01@carleos2:~/ejercicio5$ ls alumno01@carleos2:~/ejercicio5$ head -n1 /home/manadine/dat/jovenes.csv "P0","P1","P2","P3","P4","P5","P6","P7","P8","P9","P10.1","P10.2","P10.3","P10.4","P10.5","P10.6","P11.1","P11.2","P11.3","P11.4","P11.5","P11.6","P11.7","P11.8","P11.9","P11.10","P11.11","P11.12","P11.13","P11.14","P11.15","P11.16","P11.17","P11.18","P11.19","P11.20","P12","P13.1","P13.2","P14.1","P14.2","P14.3","P14.4","P14.5","P14.6","P14.7","P14.8","P14.9","P14.10","P14.11","P14.12","P14.13","P14.14","P14.15","P14.16","P15","P16","P17","P18","P19","P20","P21","P22","P23.1","P23.2","P23.3","P23.4" alumno01@carleos2:~/ejercicio5$ R R version 4.3.2 (2023-10-31) -- "Eye Holes" Copyright (C) 2023 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > j = read.csv("/home/manadine/dat/jovenes.csv",stringsAsFactors=TRUE) > summary(j[c("P2","P3","P4")]) P2 P3 P4 Femenino :324 8 : 1 De acuerdo :237 Masculino:345 Casa padres :427 en desacuerdo : 92 NA's : 1 Casa suegros : 9 En desacuerdo :215 En casa de otras personas: 8 Muy de acuerdo: 95 En mi casa :141 NA's : 31 En piso compartido : 79 En residencia o colegio : 5 > pdf("descripciOn-P2-P3-P4.pdf") > pie(table(j$P2), main="P2") > sort(table(j$P3)) 8 En residencia o colegio En casa de otras personas 1 5 8 Casa suegros En piso compartido En mi casa 9 79 141 Casa padres 427 > j$P3[j$P3=="8"] <- NA > j$P3 = droplevels(j$P3) > barplot(table(j$P3), main="P3", las=2) > levels(j$P4) [1] "De acuerdo" "en desacuerdo" "En desacuerdo" "Muy de acuerdo" > levels(j$P4)[2] = "Muy en desacuerdo" > levels(j$P4) [1] "De acuerdo" "Muy en desacuerdo" "En desacuerdo" [4] "Muy de acuerdo" > table(j$P4) De acuerdo Muy en desacuerdo En desacuerdo Muy de acuerdo 237 92 215 95 > j$P4 = factor(j$P4, levels=levels(j$P4)[c(2,3,1,4)]) > table(j$P4) Muy en desacuerdo En desacuerdo De acuerdo Muy de acuerdo 92 215 237 95 > barplot (table(j$P4), main="P4", las=2) > dev.off() null device 1 > sink("descripciOn-P2-P3-P4.txt")> summary(j[c("P2","P3","P4")]) > sink() > q() Save workspace image? [y/n/c]: n alumno01@carleos2:~/ejercicio5$ ls descripciOn-P2-P3-P4.pdf descripciOn-P2-P3-P4.txt alumno01@carleos2:~/ejercicio5$ file * descripciOn-P2-P3-P4.pdf: PDF document, version 1.4, 5 pages descripciOn-P2-P3-P4.txt: ASCII text alumno01@carleos2:~/ejercicio5$ cat descripciOn-P2-P3-P4.txt P2 P3 P4 Femenino :324 Casa padres :427 Muy en desacuerdo: 92 Masculino:345 Casa suegros : 9 En desacuerdo :215 NA's : 1 En casa de otras personas: 8 De acuerdo :237 En mi casa :141 Muy de acuerdo : 95 En piso compartido : 79 NA's : 31 En residencia o colegio : 5 NA's : 1 alumno01@carleos2:~/ejercicio5$ exit logout Connection to carleos2.epv.uniovi.es closed. $