Skip to content

Instantly share code, notes, and snippets.

View Historico2.R
# Convirtiendo la variable dia a factor para asi manipular el orden en que se debe visualizada la variable dia
d_historico$dia <- factor( x = d_historico$dia
, levels = c('Lunes','Martes','Miercoles','Jueves','Viernes', 'Sabado','Domingo')
)
# Opcional: Revisando la estructura del factor
str( object = d_historico$dia )
View IP.R
library( package = 'dplyr' )
library( package = 'data.table' )
# Create vectors that will store column classes for the game and event files
l_e_cols <- c( 'character' # GAME_ID
, rep( x = 'NULL', times = 13 )
, 'character' # PIT_ID
, rep( x = 'NULL', times = 25 )
, 'numeric' # EVENT_OUTS_CT
, rep( x = 'NULL', times = 58 )
View GamesFielding.R
library( package = 'dplyr' )
library( package = 'data.table' )
library( package = 'reshape2' )
# Column names
l_e_names <- c( 'GAME_ID','CATCHER','FIRST_BASEMAN','SECOND_BASEMAN'
, 'THIRD_BASEMAN','SHORTSTOP','LEFT_FIELDER','CENTER_FIELDER'
, 'RIGHT_FIELDER', 'EVENT_OUTS_CT' ,'TEAM_ID'
)
View referencePlot.R
library( package = 'dplyr' )
library( package = 'ggplot2' )
library( package = 'data.table' )
# Column types
l_g_cols <- c( 'NULL'
, 'character' # GAME_DT
, rep( x = 'NULL', times = 5 )
, 'character' # AWAY_TEAM_ID
, 'character' # HOME_TEAM_ID
View reverseLinkList1.py
def reverse2( self, current, previous ):
if current:
self.reverse2( previous = current
, current = current.getNext()
)
else:
return
print str(current.getData())+str('-->'),
View QueueListasEnlazadas.py
class Nodo:
def __init__( self, dato ):
self.dato = dato
self.sig = None
#def asignarDato( self, dato ):
# self.dato = dato
def asignarSig( self, sig ):
View QueueListasEnlazadas1.py
class Nodo:
def __init__( self, dato ):
self.dato = dato
self.sig = None
#def asignarDato( self, dato ):
# self.dato = dato
def asignarSig( self, sig ):
View QueueListasEnlazadas2.py
def __init__( self ):
self.cabeza = None
self.cola = None
self.tamanio = 0
View QueueListasEnlazadas3.py
def encolar( self, dato ):
nuevoNodo = Nodo( dato )
if not self.cabeza:
nuevoNodo.asignarSig( None )
self.cabeza = nuevoNodo
else:
self.cola.asignarSig( nuevoNodo )
self.cola = nuevoNodo
View QueueListasEnlazadas4.py
def desencolar( self ):
if self.cabeza:
self.cabeza = self.cabeza.obtenerSig()
self.tamanio -= 1