


Prepara tus exámenes y mejora tus resultados gracias a la gran cantidad de recursos disponibles en Docsity
Gana puntos ayudando a otros estudiantes o consíguelos activando un Plan Premium
Esta página no es visible en la vista previa
¡No te pierdas las partes importantes!



En este caso, se us´o R por la facilidad de manejo de datos que tiene.
library ( r e a d r ) DF<−read csv ( ” P o r t i c o s. c s v ” )
‘ ‘ ‘ { r #Pregunta 1 }
#Obtenemos e l maximo para q u i t a r l o
Car1<−DF[ which (DF$FRECUENCIA ==max(DF$FRECUENCIA) ) , ]
Car Car2<−DF[ which (DF$FRECUENCIA < 23 & DF$FRECUENCIA>=22) ,] #Mostramos l a s p l a c a s que cumplen con l a s c o n d i c i o n e s Car ‘ ‘ ‘
‘ ‘ ‘ { r #Pregunta 2 }
#Se o b t i e n e l o s c a r r o s con l a s c o n d i c i o n e s c a r r o s 1<−data. frame (DF[DF$ALERTA==’ 2111 ’ , ] ) c a r r o s<−data. frame ( c a r r o s 1 [ c a r r o s 1 $CATEGORIA==’N3 ’ , ] )
#Se s e p a r a e l s t r i n g de l a f e c h a f e c h a s<−data. frame ( substr ( c a r r o s $FECHA, s t a r t = 4 , stop =5)) colnames ( f e c h a s )<−c ( ” Fecha ” )
a l e r t a<−data. frame ( f e c h a s , c a r r o s $ALERTA) colnames ( a l e r t a )<−c ( ” Fecha ” , ” A l e r t a ” )
#Colocamos en una t a b l a para c o n t a b i l i z a r r p t a 2<−table ( a l e r t a $Fecha ) r p t a 2
#Obtenemos e l d a t o mayor which .max( r p t a 2 ) ‘ ‘ ‘
‘ ‘ ‘ { r #Pregunta 3 }
#Quitamos l o s c a s o s donde no hay a l e r t a CatN3<−DF[DF$ALERTA!=’ 0 ’ , ] CatN
#Separamos l o s meses d e l s t r i n g de f e c h a s f e c h a<−data. frame ( substr ( CatN3$FECHA, s t a r t = 4 , stop =5)) colnames ( f e c h a )<−c ( ” Fecha ” )
r p t a<−data. frame ( f e c h a , CatN3$ALERTA) r p t a #Hacemos una t a b l a que compare l o s meses y c a n t i d a d de a l e r t a s
r p t a 5<−table ( a l e r t a $Fecha ) r p t a 5 #Obtenemos l a mayor c a n t i d a d which .max( r p t a 5 )
‘ ‘ ‘