Skip to content

Instantly share code, notes, and snippets.

class Nodo:
def __init__( self, dato ):
self.dato = dato
self.sig = None
#def asignarDato( self, dato ):
# self.dato = dato
def asignarSig( self, sig ):
def reverse2( self, current, previous ):
if current:
self.reverse2( previous = current
, current = current.getNext()
)
else:
return
print str(current.getData())+str('-->'),
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
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'
)
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 )
# 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 )
# Cargar librerias
library( package = 'ggplot2' )
# Leer dataset
d_historico <- read.table( file = 'datafile'
, header = T
, sep = ','
, colClasses = c('character','character','numeric')
)