Gestión de Sistema de Información

Nombre y Apellido: José Alberto Palomino Herrera

Curso: Estadistica Aplicada a la Computación

Docente: Victor Manuel Guevara Ponce

Ciclo: IV

Año: 2023


#Resumen
Se propone analizar el desarrollo de una guía de viajes sobre los lugares imprescindibles de la India, respaldada por datos estadísticos. La iniciativa se centra en evaluar la popularidad y preferencias de destinos turísticos, analizar la distribución geográfica de lugares destacados, y comprender tendencias en el comportamiento de turistas nacionales e internacionales.

###I.Aspectos generales
1.1 Nombre de la organización y/o empresa (real o propuesta):
-Organización: Ministerio de Turismo de la India.
-Empresa: Agencia de Viajes “Explora India.

1.2 Descripción del caso (o los casos) que se va a analizar:
Caso: Desarrollo de una guía de viajes sobre los lugares imprescindibles de la India. La guía se basará en datos recopilados de diversas fuentes para proporcionar información detallada y recomendaciones a los turistas que visitan el país.

###II.Fundamentos básicos de la Estadística
2.1 Objetivo de estudio:
-Evaluar la popularidad y preferencias de destinos turísticos en la India.
-Identificar tendencias y patrones en el comportamiento de los turistas.

2.2 Población de estudio:
-Población: Turistas que visitan la India.
-Subpoblaciones: Turistas nacionales e internacionales.

2.3 Muestra:
-Muestra representativa de turistas recientes.
-Inclusión de diferentes perfiles de turistas (edad, nacionalidad, preferencias de viaje).

2.4 Unidad de análisis:
-La unidad de análisis será cada turista y sus preferencias de viaje.
-También se analizarán conjuntos de datos relacionados con la popularidad de destinos específicos.

#Archivo Obtenido:
https://www.kaggle.com/datasets/saketk511/travel-dataset-guide-to-indias-must-see-places

###III. Variable y tipo de variable
Numero de serie
Variable: Número de serie
Tipo de variable: Numérica discreta

Zona según mapa de India:
Variable: Zona
Tipo de variable: Categórica nominal

Estados indios:
Variable: Estados
Tipo de variable: Categórica nominal

Nombre de la ciudad:
Variable: Ciudad
Tipo de variable: Categórica nominal

Ponga su nombre:
Variable: Nombre del lugar
Tipo de variable: Categórica nominal

Descripción del lugar:
Variable: Descripción
Tipo de variable: Categórica ordinal

Año:
Variable: Año
Tipo de variable: Numérica discreta

Tiempo promedio empleado:
Variable: Tiempo empleado
Tipo de variable: Numérica continua

Revisión promedio de Google:
Variable: Revisión promedio
Tipo de variable: Numérica continua

Precio de entrada en rupias:
Variable: Precio de entrada
Tipo de variable: Numérica continua

Conectividad:
Variable: Conectividad
Tipo de variable: Categórica nominal

Vacaciones:
Variable: Vacaciones
Tipo de variable: Categórica nominal

Importancia:
Variable: Importancia
Tipo de variable: Categórica ordinal

La cámara está permitida o no:
Variable: Permiso de cámara
Tipo de variable: Categórica nominal

Número de valoraciones en Google:
Variable: Número de valoraciones
Tipo de variable: Numérica discreta

A qué hora visitar:
Variable: Hora de visita
Tipo de variable: Categórica ordinal

###IV.Manejo de Base de Datos

viajes <- read.csv("turismo.csv", sep=",")
head(viajes)
##   X     Zone State  City                 Name         Type Establishment.Year
## 1 0 Northern Delhi Delhi           India Gate War Memorial               1921
## 2 1 Northern Delhi Delhi       Humayun's Tomb         Tomb               1572
## 3 2 Northern Delhi Delhi    Akshardham Temple       Temple               2005
## 4 3 Northern Delhi Delhi Waste to Wonder Park   Theme Park               2019
## 5 4 Northern Delhi Delhi        Jantar Mantar  Observatory               1724
## 6 5 Northern Delhi Delhi        Chandni Chowk       Market               1700
##   time.needed.to.visit.in.hrs Google.review.rating Entrance.Fee.in.INR
## 1                         0.5                  4.6                   0
## 2                         2.0                  4.5                  30
## 3                         5.0                  4.6                  60
## 4                         2.0                  4.1                  50
## 5                         2.0                  4.2                  15
## 6                         3.0                  4.2                   0
##   Airport.with.50km.Radius Weekly.Off  Significance DSLR.Allowed
## 1                      Yes       None    Historical          Yes
## 2                      Yes       None    Historical          Yes
## 3                      Yes       None     Religious           No
## 4                      Yes     Monday Environmental          Yes
## 5                      Yes       None    Scientific          Yes
## 6                      Yes     Sunday        Market          Yes
##   Number.of.google.review.in.lakhs Best.Time.to.visit
## 1                             2.60            Evening
## 2                             0.40          Afternoon
## 3                             0.40          Afternoon
## 4                             0.27            Evening
## 5                             0.31            Morning
## 6                             0.25          Afternoon

##Verificamos la estrucutra de los datos

str(viajes)
## 'data.frame':    325 obs. of  16 variables:
##  $ X                               : int  0 1 2 3 4 5 6 7 8 9 ...
##  $ Zone                            : chr  "Northern" "Northern" "Northern" "Northern" ...
##  $ State                           : chr  "Delhi" "Delhi" "Delhi" "Delhi" ...
##  $ City                            : chr  "Delhi" "Delhi" "Delhi" "Delhi" ...
##  $ Name                            : chr  "India Gate" "Humayun's Tomb" "Akshardham Temple" "Waste to Wonder Park" ...
##  $ Type                            : chr  "War Memorial" "Tomb" "Temple" "Theme Park" ...
##  $ Establishment.Year              : chr  "1921" "1572" "2005" "2019" ...
##  $ time.needed.to.visit.in.hrs     : num  0.5 2 5 2 2 3 1 2 1 2 ...
##  $ Google.review.rating            : num  4.6 4.5 4.6 4.1 4.2 4.2 4.5 4.5 4.2 4.6 ...
##  $ Entrance.Fee.in.INR             : int  0 30 60 50 15 0 0 35 0 0 ...
##  $ Airport.with.50km.Radius        : chr  "Yes" "Yes" "Yes" "Yes" ...
##  $ Weekly.Off                      : chr  "None" "None" "None" "Monday" ...
##  $ Significance                    : chr  "Historical" "Historical" "Religious" "Environmental" ...
##  $ DSLR.Allowed                    : chr  "Yes" "Yes" "No" "Yes" ...
##  $ Number.of.google.review.in.lakhs: num  2.6 0.4 0.4 0.27 0.31 0.25 0.59 1.5 0.41 0.16 ...
##  $ Best.Time.to.visit              : chr  "Evening" "Afternoon" "Afternoon" "Evening" ...

##Verificamos las dimensiones de los datos

dim(viajes)
## [1] 325  16

##Nombres de las Variables

names(viajes)
##  [1] "X"                                "Zone"                            
##  [3] "State"                            "City"                            
##  [5] "Name"                             "Type"                            
##  [7] "Establishment.Year"               "time.needed.to.visit.in.hrs"     
##  [9] "Google.review.rating"             "Entrance.Fee.in.INR"             
## [11] "Airport.with.50km.Radius"         "Weekly.Off"                      
## [13] "Significance"                     "DSLR.Allowed"                    
## [15] "Number.of.google.review.in.lakhs" "Best.Time.to.visit"
names(viajes)[3]
## [1] "State"

##Seleccion de una fila

caso_fil1 <- viajes[ 3, ]
head(caso_fil1)
##   X     Zone State  City              Name   Type Establishment.Year
## 3 2 Northern Delhi Delhi Akshardham Temple Temple               2005
##   time.needed.to.visit.in.hrs Google.review.rating Entrance.Fee.in.INR
## 3                           5                  4.6                  60
##   Airport.with.50km.Radius Weekly.Off Significance DSLR.Allowed
## 3                      Yes       None    Religious           No
##   Number.of.google.review.in.lakhs Best.Time.to.visit
## 3                              0.4          Afternoon

##Seleccion de varias filas continuas

caso_fil2 <- viajes[ 1:10, ]
head(caso_fil2)
##   X     Zone State  City                 Name         Type Establishment.Year
## 1 0 Northern Delhi Delhi           India Gate War Memorial               1921
## 2 1 Northern Delhi Delhi       Humayun's Tomb         Tomb               1572
## 3 2 Northern Delhi Delhi    Akshardham Temple       Temple               2005
## 4 3 Northern Delhi Delhi Waste to Wonder Park   Theme Park               2019
## 5 4 Northern Delhi Delhi        Jantar Mantar  Observatory               1724
## 6 5 Northern Delhi Delhi        Chandni Chowk       Market               1700
##   time.needed.to.visit.in.hrs Google.review.rating Entrance.Fee.in.INR
## 1                         0.5                  4.6                   0
## 2                         2.0                  4.5                  30
## 3                         5.0                  4.6                  60
## 4                         2.0                  4.1                  50
## 5                         2.0                  4.2                  15
## 6                         3.0                  4.2                   0
##   Airport.with.50km.Radius Weekly.Off  Significance DSLR.Allowed
## 1                      Yes       None    Historical          Yes
## 2                      Yes       None    Historical          Yes
## 3                      Yes       None     Religious           No
## 4                      Yes     Monday Environmental          Yes
## 5                      Yes       None    Scientific          Yes
## 6                      Yes     Sunday        Market          Yes
##   Number.of.google.review.in.lakhs Best.Time.to.visit
## 1                             2.60            Evening
## 2                             0.40          Afternoon
## 3                             0.40          Afternoon
## 4                             0.27            Evening
## 5                             0.31            Morning
## 6                             0.25          Afternoon

##Seleccion de varias filas no continuas

caso_fil3 <- viajes[c(1,10,40:70), ]
head(caso_fil3)
##     X     Zone       State      City                  Name         Type
## 1   0 Northern       Delhi     Delhi            India Gate War Memorial
## 10  9 Northern       Delhi     Delhi        Sunder Nursery         Park
## 40 39 Southern   Telangana Hyderabad    Chowmahalla Palace       Palace
## 41 40 Southern   Telangana Hyderabad Nehru Zoological Park          Zoo
## 42 41 Southern   Telangana Hyderabad          Lumbini Park         Park
## 43 42  Eastern West Bengal   Kolkata     Victoria Memorial       Museum
##    Establishment.Year time.needed.to.visit.in.hrs Google.review.rating
## 1                1921                         0.5                  4.6
## 10               1600                         2.0                  4.6
## 40               1800                         1.5                  4.4
## 41               1963                         3.0                  4.2
## 42               1994                         1.0                  4.1
## 43               1921                         1.5                  4.6
##    Entrance.Fee.in.INR Airport.with.50km.Radius Weekly.Off Significance
## 1                    0                      Yes       None   Historical
## 10                   0                      Yes       None    Botanical
## 40                  80                      Yes       None   Historical
## 41                  50                      Yes       None     Wildlife
## 42                  20                      Yes       None Recreational
## 43                  30                      Yes     Monday   Historical
##    DSLR.Allowed Number.of.google.review.in.lakhs Best.Time.to.visit
## 1           Yes                             2.60            Evening
## 10          Yes                             0.16          Afternoon
## 40          Yes                             0.45            Morning
## 41          Yes                             0.86            Morning
## 42          Yes                             0.73            Evening
## 43          Yes                             0.73            Morning

##Seleccionar observaciones con alguna condición:

caso_fil4 <- viajes[viajes$Zone>=35, ]
head(caso_fil4)
##   X     Zone State  City                 Name         Type Establishment.Year
## 1 0 Northern Delhi Delhi           India Gate War Memorial               1921
## 2 1 Northern Delhi Delhi       Humayun's Tomb         Tomb               1572
## 3 2 Northern Delhi Delhi    Akshardham Temple       Temple               2005
## 4 3 Northern Delhi Delhi Waste to Wonder Park   Theme Park               2019
## 5 4 Northern Delhi Delhi        Jantar Mantar  Observatory               1724
## 6 5 Northern Delhi Delhi        Chandni Chowk       Market               1700
##   time.needed.to.visit.in.hrs Google.review.rating Entrance.Fee.in.INR
## 1                         0.5                  4.6                   0
## 2                         2.0                  4.5                  30
## 3                         5.0                  4.6                  60
## 4                         2.0                  4.1                  50
## 5                         2.0                  4.2                  15
## 6                         3.0                  4.2                   0
##   Airport.with.50km.Radius Weekly.Off  Significance DSLR.Allowed
## 1                      Yes       None    Historical          Yes
## 2                      Yes       None    Historical          Yes
## 3                      Yes       None     Religious           No
## 4                      Yes     Monday Environmental          Yes
## 5                      Yes       None    Scientific          Yes
## 6                      Yes     Sunday        Market          Yes
##   Number.of.google.review.in.lakhs Best.Time.to.visit
## 1                             2.60            Evening
## 2                             0.40          Afternoon
## 3                             0.40          Afternoon
## 4                             0.27            Evening
## 5                             0.31            Morning
## 6                             0.25          Afternoon

#Tablas de frecuencias (Para cada variable)

##Tabla de frecuencia de manera manual

table <-(viajes$Google.review.rating)

##Guardando la Tabla en Ta

ta <- table(viajes$Google.review.rating)

##Obtenemos las proporciones

ta<-prop.table(table(viajes$Google.review.rating))
# presentamos los resultados
ta
## 
##         1.4         3.7         3.8         3.9           4         4.1 
## 0.003076923 0.003076923 0.009230769 0.018461538 0.003076923 0.046153846 
##         4.2         4.3         4.4         4.5         4.6         4.7 
## 0.046153846 0.052307692 0.169230769 0.215384615 0.196923077 0.147692308 
##         4.8         4.9 
## 0.080000000 0.009230769

##Generar una tabla de frecuencia de manera manual

table(viajes$Google.review.rating)
## 
## 1.4 3.7 3.8 3.9   4 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 4.9 
##   1   1   3   6   1  15  15  17  55  70  64  48  26   3

##Guardamos la tabla en fi

fi<-table(viajes$Google.review.rating)
#Mostramos
fi
## 
## 1.4 3.7 3.8 3.9   4 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 4.9 
##   1   1   3   6   1  15  15  17  55  70  64  48  26   3

##Obtenemos las proporciones

hi<-prop.table(table(viajes$Google.review.rating))
#Mostramos
hi
## 
##         1.4         3.7         3.8         3.9           4         4.1 
## 0.003076923 0.003076923 0.009230769 0.018461538 0.003076923 0.046153846 
##         4.2         4.3         4.4         4.5         4.6         4.7 
## 0.046153846 0.052307692 0.169230769 0.215384615 0.196923077 0.147692308 
##         4.8         4.9 
## 0.080000000 0.009230769

##Calculamos frecuencias porcentuales

# Redondeamos a dos decimales
hi<-round(hi,2)
# Calculamos los porcentajes
pi<-prop.table(table(viajes$Google.review.rating))*100
#Mostramos
pi
## 
##        1.4        3.7        3.8        3.9          4        4.1        4.2 
##  0.3076923  0.3076923  0.9230769  1.8461538  0.3076923  4.6153846  4.6153846 
##        4.3        4.4        4.5        4.6        4.7        4.8        4.9 
##  5.2307692 16.9230769 21.5384615 19.6923077 14.7692308  8.0000000  0.9230769

##Unimos los resultados en una sola tabla

tabla1 <-t(rbind(fi,hi,pi))
tabla1
##     fi   hi         pi
## 1.4  1 0.00  0.3076923
## 3.7  1 0.00  0.3076923
## 3.8  3 0.01  0.9230769
## 3.9  6 0.02  1.8461538
## 4    1 0.00  0.3076923
## 4.1 15 0.05  4.6153846
## 4.2 15 0.05  4.6153846
## 4.3 17 0.05  5.2307692
## 4.4 55 0.17 16.9230769
## 4.5 70 0.22 21.5384615
## 4.6 64 0.20 19.6923077
## 4.7 48 0.15 14.7692308
## 4.8 26 0.08  8.0000000
## 4.9  3 0.01  0.9230769

##Utilizando librerias para generar las tablas de frecuencia Utilizando librería summarytools

# Cargamos la librería
library(summarytools)
## Warning: package 'summarytools' was built under R version 4.3.2
# función freq permite generar la tabla de frecuencia
freq(viajes$Google.review.rating, report.nas = FALSE)
## Frequencies  
## viajes$Google.review.rating  
## Type: Numeric  
## 
##               Freq        %   % Cum.
## ----------- ------ -------- --------
##         1.4      1     0.31     0.31
##         3.7      1     0.31     0.62
##         3.8      3     0.92     1.54
##         3.9      6     1.85     3.38
##           4      1     0.31     3.69
##         4.1     15     4.62     8.31
##         4.2     15     4.62    12.92
##         4.3     17     5.23    18.15
##         4.4     55    16.92    35.08
##         4.5     70    21.54    56.62
##         4.6     64    19.69    76.31
##         4.7     48    14.77    91.08
##         4.8     26     8.00    99.08
##         4.9      3     0.92   100.00
##       Total    325   100.00   100.00

##Utilizando librería epiDisplay

# Cargamos la librería
library(epiDisplay)
## Warning: package 'epiDisplay' was built under R version 4.3.2
## Loading required package: foreign
## Loading required package: survival
## Loading required package: MASS
## Loading required package: nnet
tab1(viajes$Google.review.rating, graph =FALSE)
## viajes$Google.review.rating : 
##         Frequency Percent Cum. percent
## 1.4             1     0.3          0.3
## 3.7             1     0.3          0.6
## 3.8             3     0.9          1.5
## 3.9             6     1.8          3.4
## 4               1     0.3          3.7
## 4.1            15     4.6          8.3
## 4.2            15     4.6         12.9
## 4.3            17     5.2         18.2
## 4.4            55    16.9         35.1
## 4.5            70    21.5         56.6
## 4.6            64    19.7         76.3
## 4.7            48    14.8         91.1
## 4.8            26     8.0         99.1
## 4.9             3     0.9        100.0
##   Total       325   100.0        100.0

##Tablas de frecuencia para variables cuantitativas discretas ##Utilizando librería summarytools

# Cargamos la librería
library(summarytools)
# función freq permite generar la tabla de frecuencia
freq(viajes$Entrance.Fee.in.INR, report.nas = FALSE)
## Frequencies  
## viajes$Entrance.Fee.in.INR  
## Type: Integer  
## 
##               Freq        %   % Cum.
## ----------- ------ -------- --------
##           0    183    56.31    56.31
##           5      1     0.31    56.62
##          10     12     3.69    60.31
##          15      5     1.54    61.85
##          20     19     5.85    67.69
##          25      6     1.85    69.54
##          30     13     4.00    73.54
##          35      4     1.23    74.77
##          40      7     2.15    76.92
##          50     21     6.46    83.38
##          60      4     1.23    84.62
##          65      1     0.31    84.92
##          70      1     0.31    85.23
##          75      1     0.31    85.54
##          80      2     0.62    86.15
##         100      8     2.46    88.62
##         150      4     1.23    89.85
##         200      4     1.23    91.08
##         250      2     0.62    91.69
##         300      5     1.54    93.23
##         350      1     0.31    93.54
##         500      7     2.15    95.69
##         550      1     0.31    96.00
##         650      1     0.31    96.31
##         750      1     0.31    96.62
##         890      1     0.31    96.92
##        1100      1     0.31    97.23
##        1149      2     0.62    97.85
##        1150      1     0.31    98.15
##        1500      2     0.62    98.77
##        2500      2     0.62    99.38
##        3500      1     0.31    99.69
##        7500      1     0.31   100.00
##       Total    325   100.00   100.00

##Utilizando librería epiDisplay ##Cargamos la librería

library(epiDisplay)
tab1(viajes$Entrance.Fee.in.INR, graph =FALSE)
## viajes$Entrance.Fee.in.INR : 
##         Frequency Percent Cum. percent
## 0             183    56.3         56.3
## 5               1     0.3         56.6
## 10             12     3.7         60.3
## 15              5     1.5         61.8
## 20             19     5.8         67.7
## 25              6     1.8         69.5
## 30             13     4.0         73.5
## 35              4     1.2         74.8
## 40              7     2.2         76.9
## 50             21     6.5         83.4
## 60              4     1.2         84.6
## 65              1     0.3         84.9
## 70              1     0.3         85.2
## 75              1     0.3         85.5
## 80              2     0.6         86.2
## 100             8     2.5         88.6
## 150             4     1.2         89.8
## 200             4     1.2         91.1
## 250             2     0.6         91.7
## 300             5     1.5         93.2
## 350             1     0.3         93.5
## 500             7     2.2         95.7
## 550             1     0.3         96.0
## 650             1     0.3         96.3
## 750             1     0.3         96.6
## 890             1     0.3         96.9
## 1100            1     0.3         97.2
## 1149            2     0.6         97.8
## 1150            1     0.3         98.2
## 1500            2     0.6         98.8
## 2500            2     0.6         99.4
## 3500            1     0.3         99.7
## 7500            1     0.3        100.0
##   Total       325   100.0        100.0

###VI. Representación gráfica de datos.

##Verificamos la estructura de los datos

str(viajes)
## 'data.frame':    325 obs. of  16 variables:
##  $ X                               : int  0 1 2 3 4 5 6 7 8 9 ...
##  $ Zone                            : chr  "Northern" "Northern" "Northern" "Northern" ...
##  $ State                           : chr  "Delhi" "Delhi" "Delhi" "Delhi" ...
##  $ City                            : chr  "Delhi" "Delhi" "Delhi" "Delhi" ...
##  $ Name                            : chr  "India Gate" "Humayun's Tomb" "Akshardham Temple" "Waste to Wonder Park" ...
##  $ Type                            : chr  "War Memorial" "Tomb" "Temple" "Theme Park" ...
##  $ Establishment.Year              : chr  "1921" "1572" "2005" "2019" ...
##  $ time.needed.to.visit.in.hrs     : num  0.5 2 5 2 2 3 1 2 1 2 ...
##  $ Google.review.rating            : num  4.6 4.5 4.6 4.1 4.2 4.2 4.5 4.5 4.2 4.6 ...
##  $ Entrance.Fee.in.INR             : int  0 30 60 50 15 0 0 35 0 0 ...
##  $ Airport.with.50km.Radius        : chr  "Yes" "Yes" "Yes" "Yes" ...
##  $ Weekly.Off                      : chr  "None" "None" "None" "Monday" ...
##  $ Significance                    : chr  "Historical" "Historical" "Religious" "Environmental" ...
##  $ DSLR.Allowed                    : chr  "Yes" "Yes" "No" "Yes" ...
##  $ Number.of.google.review.in.lakhs: num  2.6 0.4 0.4 0.27 0.31 0.25 0.59 1.5 0.41 0.16 ...
##  $ Best.Time.to.visit              : chr  "Evening" "Afternoon" "Afternoon" "Evening" ...

A.Gráficos de variables cualitativas

plot(viajes$Google.review.rating)

##Mejoramos el gráfico adicionando titulo y nombres en los ejes

barplot(table(viajes$Google.review.rating), main="Revisión promedio de Google", 
        xlab="Revision",
        ylab="Viajes")

##Mejoramos el gráfico adicionando título, nombres en los ejes y color con porcentajes

barplot(table(viajes$Google.review.rating), main="Revisión promedio de Google", 
        xlab="Revision",
        ylab="% de viajes",
        , col=c("pink","gray"))

##Mejoramos el gráfico adicionando título, nombres en los ejes y color con porcentajes

barplot(prop.table(table(viajes$Google.review.rating))*100,
        main="Revisión promedio de Google", 
        col=5,xlab="Revisión",ylab="% de viajes")

##Gráfico circular

pie(prop.table(table(viajes$Google.review.rating))*100, main="Revisión promedio de Google")

##Gráfico circular adicionando valores en el gráfico

labels_viajes <- paste(names(viajes$Google.review.rating), "\n",
               round(prop.table(table(viajes$Google.review.rating))*100,2),"%", sep="")
pie(prop.table(table(viajes$Google.review.rating)), labels = labels_viajes,
    main="Revisión promedio de Google")

##Gráfico circular – utilizando la función plotrix

library(plotrix)
## Warning: package 'plotrix' was built under R version 4.3.2
pie3D(table(viajes$Google.review.rating),labels=labels_viajes,explode=0.2,
      main="Revisión promedio de Google")

##Gráfico de puntos en R

dotchart(table(viajes$Google.review.rating), cex=.7,
         main="Revisión promedio de Google", 
         xlab="# de viajes")
## Warning in dotchart(table(viajes$Google.review.rating), cex = 0.7, main =
## "Revisión promedio de Google", : 'x' is neither a vector nor a matrix: using
## as.numeric(x)

##Realizando un gráfico de barras con ggplot2

library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.3.2
## 
## Attaching package: 'ggplot2'
## The following object is masked from 'package:epiDisplay':
## 
##     alpha
ggplot(data=viajes, aes(Google.review.rating))+
  geom_bar()

##Mejorando el gráfico

ggplot(data=viajes, aes(Google.review.rating))+
  geom_bar()+
  theme_classic()

##Poniendo color al grafico ggplot

library(ggpubr)
## Warning: package 'ggpubr' was built under R version 4.3.2
ggplot(viajes, aes(Google.review.rating)) +
  geom_bar(fill = "purple") +
  theme_pubclean()

##Realizando gráfico circular

ggplot(data=viajes, aes(Google.review.rating, fill = Google.review.rating))+
  geom_bar()+
  coord_polar("x", start=0)
## Warning: The following aesthetics were dropped during statistical transformation: fill
## ℹ This can happen when ggplot fails to infer the correct grouping structure in
##   the data.
## ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
##   variable into a factor?

##Mejorando gráfico circular

ggplot(data = viajes, aes(x = "", y = Google.review.rating, fill = Google.review.rating)) + 
  geom_bar(stat = "identity") + 
  coord_polar("y")

#Gráficos y tablas de variables cuantitativos ##Histograma y polígono de frecuencia

hist(viajes$Google.review.rating, breaks = "Sturges")

##Mejorando el gráfico con título y nombre en los ejes

hist(viajes$Google.review.rating,breaks = "Sturges",
         xlab="Google",
         ylab="Número de viajes",col="purple")

##Polígono de Frecuencias

library(agricolae)
## Warning: package 'agricolae' was built under R version 4.3.2
h1<-hist(viajes$Google.review.rating, border=FALSE)
polygon.freq(h1,frequency=1 , col="purple")

##Grafico de densidad

#Gráfico de Densidad
plot(density(viajes$Google.review.rating))

##Histograma y Densidad

hist(viajes$Google.review.rating,prob=TRUE)
lines(density(viajes$Google.review.rating))

##Gráfico de cajas

#Boxplots
boxplot(viajes$Google.review.rating)

###VII. Medidas estadísticas de tendencia ##Medidas estadísticas ##a. Media aritmética

mean(viajes$Google.review.rating)
## [1] 4.486154

##b. Mediana

median(viajes$Google.review.rating)
## [1] 4.5

##c. Moda

library(modeest)
## Warning: package 'modeest' was built under R version 4.3.2
## 
## Attaching package: 'modeest'
## The following object is masked from 'package:agricolae':
## 
##     skewness
mfv(viajes$Google.review.rating)
## [1] 4.5

##1. Medidas de variabilidad o dispersión ##a. Rango

range(viajes$Google.review.rating)
## [1] 1.4 4.9

##b. Varianza

var(viajes$Google.review.rating)
## [1] 0.07539411

##c. Desviación estándar

sd(viajes$Google.review.rating)
## [1] 0.2745799

##d. Coeficiente de variación

coeficiente_var=sd(viajes$Google.review.rating)/mean(viajes$Google.review.rating)*100
coeficiente_var
## [1] 6.120608

###VIII. Medidas estadísticas de posición ##1. Quantiles ##a. Quartiles

quantile(viajes$Google.review.rating)
##   0%  25%  50%  75% 100% 
##  1.4  4.4  4.5  4.6  4.9

Segun los resultados: El valor minimo de un auto es de: 1.4 ### Cuartil 1 \((Q_1)\) interpretación: es $ 4.4; El 25% de las Revisiónes de promedio en Google $ 4.4
### Cuartil 2 \((Q_2)\) interpretación: es $ 4.5; El 50% de de las Revisiónes de promedio en Google $ 4.4
### Cuartil 3 \((Q_3)\) interpretación: es $ 4.6; El 75% de de las Revisiónes de promedio en Google $ 4.6 ### Cuartil 4 \((Q_4)\) interpretación: es $ 4.9; El 100% de de las Revisiónes de promedio en Google $ 4.9

##b. Deciles ## Division de 10 grupos

quantile(viajes$Google.review.rating,probs = seq(0, 1, 0.1))
##   0%  10%  20%  30%  40%  50%  60%  70%  80%  90% 100% 
##  1.4  4.2  4.4  4.4  4.5  4.5  4.6  4.6  4.7  4.7  4.9

##c. Percentiles ## Division de 100 grupos

quantile(viajes$Google.review.rating,probs = seq(0, 1, 0.01))
##    0%    1%    2%    3%    4%    5%    6%    7%    8%    9%   10%   11%   12% 
## 1.400 3.800 3.900 3.900 4.100 4.100 4.100 4.100 4.100 4.200 4.200 4.200 4.200 
##   13%   14%   15%   16%   17%   18%   19%   20%   21%   22%   23%   24%   25% 
## 4.300 4.300 4.300 4.300 4.300 4.332 4.400 4.400 4.400 4.400 4.400 4.400 4.400 
##   26%   27%   28%   29%   30%   31%   32%   33%   34%   35%   36%   37%   38% 
## 4.400 4.400 4.400 4.400 4.400 4.400 4.400 4.400 4.400 4.440 4.500 4.500 4.500 
##   39%   40%   41%   42%   43%   44%   45%   46%   47%   48%   49%   50%   51% 
## 4.500 4.500 4.500 4.500 4.500 4.500 4.500 4.500 4.500 4.500 4.500 4.500 4.500 
##   52%   53%   54%   55%   56%   57%   58%   59%   60%   61%   62%   63%   64% 
## 4.500 4.500 4.500 4.500 4.500 4.600 4.600 4.600 4.600 4.600 4.600 4.600 4.600 
##   65%   66%   67%   68%   69%   70%   71%   72%   73%   74%   75%   76%   77% 
## 4.600 4.600 4.600 4.600 4.600 4.600 4.600 4.600 4.600 4.600 4.600 4.600 4.700 
##   78%   79%   80%   81%   82%   83%   84%   85%   86%   87%   88%   89%   90% 
## 4.700 4.700 4.700 4.700 4.700 4.700 4.700 4.700 4.700 4.700 4.700 4.700 4.700 
##   91%   92%   93%   94%   95%   96%   97%   98%   99%  100% 
## 4.700 4.800 4.800 4.800 4.800 4.800 4.800 4.800 4.800 4.900

##2. Coeficiente de asimetría y curtosis ##a. Asimetría

library(fBasics)
## Warning: package 'fBasics' was built under R version 4.3.2
## 
## Attaching package: 'fBasics'
## The following objects are masked from 'package:modeest':
## 
##     ghMode, ghtMode, gldMode, hypMode, nigMode, skewness
## The following objects are masked from 'package:agricolae':
## 
##     kurtosis, skewness
skewness(viajes$Google.review.rating)
## [1] -4.748988
## attr(,"method")
## [1] "moment"

##b. curtosis

kurtosis(viajes$Google.review.rating)
## [1] 47.57581
## attr(,"method")
## [1] "excess"

##Otras funciones de resumen utilizando fbasics

library(fBasics)
basicStats(viajes$Google.review.rating)
##             X..viajes.Google.review.rating
## nobs                            325.000000
## NAs                               0.000000
## Minimum                           1.400000
## Maximum                           4.900000
## 1. Quartile                       4.400000
## 3. Quartile                       4.600000
## Mean                              4.486154
## Median                            4.500000
## Sum                            1458.000000
## SE Mean                           0.015231
## LCL Mean                          4.456190
## UCL Mean                          4.516118
## Variance                          0.075394
## Stdev                             0.274580
## Skewness                         -4.748988
## Kurtosis                         47.575812

##Otras funciones de permiten calcular las medidas de resumen

library(psych)
## Warning: package 'psych' was built under R version 4.3.2
## Registered S3 method overwritten by 'psych':
##   method         from  
##   plot.residuals rmutil
## 
## Attaching package: 'psych'
## The following object is masked from 'package:fBasics':
## 
##     tr
## The following objects are masked from 'package:ggplot2':
## 
##     %+%, alpha
## The following object is masked from 'package:plotrix':
## 
##     rescale
## The following objects are masked from 'package:epiDisplay':
## 
##     alpha, cs, lookup
describe(viajes)
##                                  vars   n   mean     sd median trimmed    mad
## X                                   1 325 162.00  93.96 162.00  162.00 120.09
## Zone*                               2 325   3.87   1.57   4.00    3.96   1.48
## State*                              3 325  18.49   9.64  18.00   18.72  11.86
## City*                               4 325 103.43  58.96  97.00  102.29  63.75
## Name*                               5 325 161.92  93.24 162.00  162.00 120.09
## Type*                               6 325  40.37  23.39  37.00   40.49  32.62
## Establishment.Year*                 7 325 111.63  52.66 128.00  117.38  50.41
## time.needed.to.visit.in.hrs         8 325   1.81   0.97   1.50    1.66   0.74
## Google.review.rating                9 325   4.49   0.27   4.50    4.51   0.15
## Entrance.Fee.in.INR                10 325 115.81 530.86   0.00   18.39   0.00
## Airport.with.50km.Radius*          11 325   1.70   0.46   2.00    1.75   0.00
## Weekly.Off*                        12 325   2.92   0.42   3.00    3.00   0.00
## Significance*                      13 325  15.75   4.95  16.00   15.91   4.45
## DSLR.Allowed*                      14 325   1.82   0.39   2.00    1.89   0.00
## Number.of.google.review.in.lakhs   15 325   0.41   0.65   0.17    0.28   0.21
## Best.Time.to.visit*                16 325   3.21   1.96   2.00    3.14   0.00
##                                   min    max   range  skew kurtosis    se
## X                                0.00  324.0  324.00  0.00    -1.21  5.21
## Zone*                            1.00    6.0    5.00 -0.55    -0.88  0.09
## State*                           1.00   33.0   32.00 -0.05    -1.19  0.53
## City*                            1.00  214.0  213.00  0.16    -0.99  3.27
## Name*                            1.00  321.0  320.00  0.00    -1.22  5.17
## Type*                            1.00   78.0   77.00 -0.02    -1.26  1.30
## Establishment.Year*              1.00  162.0  161.00 -0.63    -1.04  2.92
## time.needed.to.visit.in.hrs      0.50    7.0    6.50  1.90     4.96  0.05
## Google.review.rating             1.40    4.9    3.50 -4.75    47.58  0.02
## Entrance.Fee.in.INR              0.00 7500.0 7500.00  9.85   120.26 29.45
## Airport.with.50km.Radius*        1.00    2.0    1.00 -0.86    -1.26  0.03
## Weekly.Off*                      1.00    6.0    5.00 -0.53    17.23  0.02
## Significance*                    1.00   25.0   24.00 -0.46     0.88  0.27
## DSLR.Allowed*                    1.00    2.0    1.00 -1.62     0.62  0.02
## Number.of.google.review.in.lakhs 0.01    7.4    7.39  5.04    43.00  0.04
## Best.Time.to.visit*              1.00    7.0    6.00  0.55    -1.48  0.11

###IX. Manejo de datos Missing ##Verificamos si hay patrón de los datos faltantes

library(VIM)
## Warning: package 'VIM' was built under R version 4.3.2
## Loading required package: colorspace
## Warning: package 'colorspace' was built under R version 4.3.2
## Loading required package: grid
## VIM is ready to use.
## Suggestions and bug-reports can be submitted at: https://github.com/statistikat/VIM/issues
## 
## Attaching package: 'VIM'
## The following object is masked from 'package:datasets':
## 
##     sleep
library(mice)
## Warning: package 'mice' was built under R version 4.3.2
## 
## Attaching package: 'mice'
## The following objects are masked from 'package:epiDisplay':
## 
##     cc, cci
## The following object is masked from 'package:stats':
## 
##     filter
## The following objects are masked from 'package:base':
## 
##     cbind, rbind
missingraf=aggr(viajes,numbers=T)

##Mostramos el resumen de la gráfica

summary(missingraf)
## 
##  Missings per variable: 
##                          Variable Count
##                                 X     0
##                              Zone     0
##                             State     0
##                              City     0
##                              Name     0
##                              Type     0
##                Establishment.Year     0
##       time.needed.to.visit.in.hrs     0
##              Google.review.rating     0
##               Entrance.Fee.in.INR     0
##          Airport.with.50km.Radius     0
##                        Weekly.Off     0
##                      Significance     0
##                      DSLR.Allowed     0
##  Number.of.google.review.in.lakhs     0
##                Best.Time.to.visit     0
## 
##  Missings in combinations of variables: 
##                     Combinations Count Percent
##  0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0   325     100

##Representación matricial missing (Esto se realiza con el fin de evaluar patrones de comportamiento)

matrixplot(viajes)

##Otra forma de representación

library(mice)
md.pattern(viajes,rotate.names = T)
##  /\     /\
## {  `---'  }
## {  O   O  }
## ==>  V <==  No need for mice. This data set is completely observed.
##  \  \|/  /
##   `-----'

##     X Zone State City Name Type Establishment.Year time.needed.to.visit.in.hrs
## 325 1    1     1    1    1    1                  1                           1
##     0    0     0    0    0    0                  0                           0
##     Google.review.rating Entrance.Fee.in.INR Airport.with.50km.Radius
## 325                    1                   1                        1
##                        0                   0                        0
##     Weekly.Off Significance DSLR.Allowed Number.of.google.review.in.lakhs
## 325          1            1            1                                1
##              0            0            0                                0
##     Best.Time.to.visit  
## 325                  1 0
##                      0 0

##Visualización diferenciando tipo de datos

library(visdat)
## Warning: package 'visdat' was built under R version 4.3.2
vis_dat(viajes)

vis_miss(viajes)

##2. Corrección de missing ##a. Eliminado todos los valores missing

viajes_correccion1<- na.omit(viajes)
which(colSums(is.na(viajes_correccion1))!=0)
## named integer(0)

##Verificamos las dimensiones (comparemos la perdida de información)

dim(viajes_correccion1)
## [1] 325  16

##b. Aplicando técnicas de imputación ##Imputación por medidas de tendencia central

library(DMwR2)
## Warning: package 'DMwR2' was built under R version 4.3.2
## Registered S3 method overwritten by 'quantmod':
##   method            from
##   as.zoo.data.frame zoo
## 
## Attaching package: 'DMwR2'
## The following object is masked from 'package:VIM':
## 
##     kNN
viajes_correccion2<-centralImputation(viajes) #DMwR, mediana (númerico), moda(no númerico)
which(colSums(is.na(viajes_correccion2))!=0)
## named integer(0)

##Verificamos las dimensiones

dim(viajes_correccion2)
## [1] 325  16

##Imputación por medidas de tendencia central utilizando la mediana

library(VIM)
viajes_correccion3<-initialise(viajes,method="median") #media (continuos) mediana (discretos), moda(no númerico)

##Verificamos las dimensiones

dim(viajes_correccion3)
## [1] 325  16

#X. Manejo de valores outliers ##Para mostrar datos

head(viajes)
##   X     Zone State  City                 Name         Type Establishment.Year
## 1 0 Northern Delhi Delhi           India Gate War Memorial               1921
## 2 1 Northern Delhi Delhi       Humayun's Tomb         Tomb               1572
## 3 2 Northern Delhi Delhi    Akshardham Temple       Temple               2005
## 4 3 Northern Delhi Delhi Waste to Wonder Park   Theme Park               2019
## 5 4 Northern Delhi Delhi        Jantar Mantar  Observatory               1724
## 6 5 Northern Delhi Delhi        Chandni Chowk       Market               1700
##   time.needed.to.visit.in.hrs Google.review.rating Entrance.Fee.in.INR
## 1                         0.5                  4.6                   0
## 2                         2.0                  4.5                  30
## 3                         5.0                  4.6                  60
## 4                         2.0                  4.1                  50
## 5                         2.0                  4.2                  15
## 6                         3.0                  4.2                   0
##   Airport.with.50km.Radius Weekly.Off  Significance DSLR.Allowed
## 1                      Yes       None    Historical          Yes
## 2                      Yes       None    Historical          Yes
## 3                      Yes       None     Religious           No
## 4                      Yes     Monday Environmental          Yes
## 5                      Yes       None    Scientific          Yes
## 6                      Yes     Sunday        Market          Yes
##   Number.of.google.review.in.lakhs Best.Time.to.visit
## 1                             2.60            Evening
## 2                             0.40          Afternoon
## 3                             0.40          Afternoon
## 4                             0.27            Evening
## 5                             0.31            Morning
## 6                             0.25          Afternoon

##Resumen

summary(viajes)
##        X           Zone              State               City          
##  Min.   :  0   Length:325         Length:325         Length:325        
##  1st Qu.: 81   Class :character   Class :character   Class :character  
##  Median :162   Mode  :character   Mode  :character   Mode  :character  
##  Mean   :162                                                           
##  3rd Qu.:243                                                           
##  Max.   :324                                                           
##      Name               Type           Establishment.Year
##  Length:325         Length:325         Length:325        
##  Class :character   Class :character   Class :character  
##  Mode  :character   Mode  :character   Mode  :character  
##                                                          
##                                                          
##                                                          
##  time.needed.to.visit.in.hrs Google.review.rating Entrance.Fee.in.INR
##  Min.   :0.500               Min.   :1.400        Min.   :   0.0     
##  1st Qu.:1.000               1st Qu.:4.400        1st Qu.:   0.0     
##  Median :1.500               Median :4.500        Median :   0.0     
##  Mean   :1.808               Mean   :4.486        Mean   : 115.8     
##  3rd Qu.:2.000               3rd Qu.:4.600        3rd Qu.:  40.0     
##  Max.   :7.000               Max.   :4.900        Max.   :7500.0     
##  Airport.with.50km.Radius  Weekly.Off        Significance      
##  Length:325               Length:325         Length:325        
##  Class :character         Class :character   Class :character  
##  Mode  :character         Mode  :character   Mode  :character  
##                                                                
##                                                                
##                                                                
##  DSLR.Allowed       Number.of.google.review.in.lakhs Best.Time.to.visit
##  Length:325         Min.   :0.0100                   Length:325        
##  Class :character   1st Qu.:0.0590                   Class :character  
##  Mode  :character   Median :0.1700                   Mode  :character  
##                     Mean   :0.4084                                     
##                     3rd Qu.:0.5000                                     
##                     Max.   :7.4000

##Para una columna

boxplot(viajes$Google.review.rating)

##Según los resultados, se identifica valores atípicos. Vamos a identificarlo y plantear estrategia de corrección

# Calcular el RIC (RIC = Q3 - Q1)
q1 <- quantile(viajes$Google.review.rating, 0.25)
q3 <- quantile(viajes$Google.review.rating, 0.75)
RIC <- q3-q1
RIC
## 75% 
## 0.2

Interpretación: Se identifica el valor atipicos de un 0.2 de un 75%

# Limites o bigotes (Superior e inferior)
viajes_inferior <- q1-1.5*RIC
viajes_inferior
## 25% 
## 4.1
viajes_superior <- q3+1.5*RIC
viajes_superior
## 75% 
## 4.9

Interpretación: Se identifica el valor Superior de un 4.1 de un 25% y inferior 4.9 de un 75%

#XI. Transformación de variables

Transformación de raíz cuadrada: Esta transformación se utiliza para reducir la dispersión de los datos cuando estos tienen una distribución con una varianza que aumenta con el nivel medio de la variable. También puede ayudar a reducir la asimetría.

# Original
hist(viajes$Google.review.rating, 12)

Para sacar la raiz cuadrada, simplemente se puede utilizar la función sqrt

sqrt(viajes$Google.review.rating)
##   [1] 2.144761 2.121320 2.144761 2.024846 2.049390 2.049390 2.121320 2.121320
##   [9] 2.049390 2.144761 2.024846 2.121320 2.121320 2.024846 2.121320 2.097618
##  [17] 2.121320 2.144761 2.144761 2.073644 2.190890 2.167948 2.097618 2.073644
##  [25] 2.073644 2.073644 1.183216 2.049390 2.097618 2.097618 2.144761 2.144761
##  [33] 2.121320 2.097618 2.073644 2.097618 2.097618 2.097618 2.167948 2.097618
##  [41] 2.049390 2.024846 2.144761 2.144761 2.144761 2.167948 2.097618 2.024846
##  [49] 2.073644 2.097618 2.167948 2.097618 2.097618 2.121320 2.049390 2.144761
##  [57] 2.097618 2.049390 2.121320 2.121320 2.144761 2.144761 2.073644 2.049390
##  [65] 2.121320 1.974842 2.144761 2.167948 2.121320 2.144761 2.097618 2.190890
##  [73] 2.213594 2.144761 2.121320 2.144761 2.097618 2.121320 2.097618 2.097618
##  [81] 2.097618 2.097618 2.144761 2.097618 2.144761 2.144761 2.144761 2.144761
##  [89] 2.121320 2.144761 2.121320 2.144761 2.213594 2.190890 2.190890 2.121320
##  [97] 2.121320 2.073644 2.097618 2.167948 1.974842 2.121320 2.073644 1.949359
## [105] 2.144761 2.121320 2.097618 2.097618 2.121320 2.097618 2.144761 2.144761
## [113] 2.167948 2.024846 2.121320 2.121320 2.144761 2.144761 2.121320 2.167948
## [121] 2.121320 2.097618 2.167948 2.097618 2.144761 2.024846 2.167948 2.049390
## [129] 2.167948 2.121320 2.190890 2.097618 2.144761 2.097618 2.097618 2.167948
## [137] 2.167948 2.167948 2.097618 2.121320 2.190890 2.121320 2.144761 2.121320
## [145] 2.121320 2.190890 1.974842 2.144761 2.097618 2.097618 2.167948 2.024846
## [153] 2.167948 2.121320 2.190890 2.121320 2.097618 2.121320 2.097618 2.144761
## [161] 2.144761 2.190890 2.190890 2.144761 2.121320 2.167948 2.097618 1.949359
## [169] 2.049390 2.097618 2.121320 2.121320 2.049390 2.121320 2.190890 2.073644
## [177] 2.000000 2.097618 2.190890 2.190890 2.167948 2.144761 2.167948 2.097618
## [185] 2.167948 2.190890 2.190890 2.121320 2.097618 2.144761 2.097618 2.073644
## [193] 2.024846 2.190890 2.049390 2.144761 2.213594 2.144761 2.167948 2.024846
## [201] 2.121320 2.167948 2.121320 2.190890 2.167948 2.073644 2.097618 2.190890
## [209] 1.923538 2.121320 2.167948 2.190890 2.190890 2.024846 2.190890 2.121320
## [217] 2.097618 2.097618 2.121320 2.121320 2.167948 2.144761 2.097618 2.121320
## [225] 2.121320 2.167948 2.167948 2.144761 2.121320 2.121320 2.121320 1.974842
## [233] 2.144761 2.073644 2.049390 2.097618 1.974842 2.167948 2.144761 2.144761
## [241] 2.024846 2.167948 1.974842 2.190890 2.144761 2.049390 2.144761 2.167948
## [249] 2.167948 2.121320 2.167948 2.073644 2.144761 2.097618 2.167948 2.097618
## [257] 2.121320 2.167948 2.167948 2.121320 2.144761 2.121320 2.144761 2.024846
## [265] 1.949359 2.073644 2.073644 2.144761 2.167948 2.144761 2.190890 2.167948
## [273] 2.121320 2.144761 2.121320 2.024846 2.167948 2.167948 2.144761 2.121320
## [281] 2.097618 2.167948 2.121320 2.121320 2.121320 2.144761 2.167948 2.121320
## [289] 2.024846 2.121320 2.167948 2.190890 2.121320 2.097618 2.121320 2.144761
## [297] 2.167948 2.144761 2.167948 2.073644 2.167948 2.097618 2.097618 2.144761
## [305] 2.167948 2.190890 2.190890 2.144761 2.049390 2.121320 2.097618 2.121320
## [313] 2.121320 2.121320 2.167948 2.144761 2.144761 2.144761 2.097618 2.144761
## [321] 2.144761 2.121320 2.167948 2.097618 2.121320

Graficamente

hist(sqrt(viajes$Google.review.rating))

Transformación de variables Se aplica cuando los datos tienen una distribución sesgada hacia la izquierda (asimetría negativa). La transformación exponencial puede ayudar a corregir la asimetría y hacer que los datos se aproximen más a una distribución simétrica.

para poder observarlo graficamente se tiene:

hist(exp(viajes$Google.review.rating))

Forma 2

Horsepower_exp<- exp(viajes$Google.review.rating)
hist(Horsepower_exp)

Transformación logarítmica: Esta transformación se utiliza cuando los datos presentan una distribución sesgada hacia la derecha (asimetría positiva). La transformación logarítmica reduce la asimetría y puede facilitar la interpretación de los datos.

Para la transformación logaritmica, utilizar log (dentro de los argumentos se puede cambiar la base)

log(viajes$Google.review.rating)
##   [1] 1.5260563 1.5040774 1.5260563 1.4109870 1.4350845 1.4350845 1.5040774
##   [8] 1.5040774 1.4350845 1.5260563 1.4109870 1.5040774 1.5040774 1.4109870
##  [15] 1.5040774 1.4816045 1.5040774 1.5260563 1.5260563 1.4586150 1.5686159
##  [22] 1.5475625 1.4816045 1.4586150 1.4586150 1.4586150 0.3364722 1.4350845
##  [29] 1.4816045 1.4816045 1.5260563 1.5260563 1.5040774 1.4816045 1.4586150
##  [36] 1.4816045 1.4816045 1.4816045 1.5475625 1.4816045 1.4350845 1.4109870
##  [43] 1.5260563 1.5260563 1.5260563 1.5475625 1.4816045 1.4109870 1.4586150
##  [50] 1.4816045 1.5475625 1.4816045 1.4816045 1.5040774 1.4350845 1.5260563
##  [57] 1.4816045 1.4350845 1.5040774 1.5040774 1.5260563 1.5260563 1.4586150
##  [64] 1.4350845 1.5040774 1.3609766 1.5260563 1.5475625 1.5040774 1.5260563
##  [71] 1.4816045 1.5686159 1.5892352 1.5260563 1.5040774 1.5260563 1.4816045
##  [78] 1.5040774 1.4816045 1.4816045 1.4816045 1.4816045 1.5260563 1.4816045
##  [85] 1.5260563 1.5260563 1.5260563 1.5260563 1.5040774 1.5260563 1.5040774
##  [92] 1.5260563 1.5892352 1.5686159 1.5686159 1.5040774 1.5040774 1.4586150
##  [99] 1.4816045 1.5475625 1.3609766 1.5040774 1.4586150 1.3350011 1.5260563
## [106] 1.5040774 1.4816045 1.4816045 1.5040774 1.4816045 1.5260563 1.5260563
## [113] 1.5475625 1.4109870 1.5040774 1.5040774 1.5260563 1.5260563 1.5040774
## [120] 1.5475625 1.5040774 1.4816045 1.5475625 1.4816045 1.5260563 1.4109870
## [127] 1.5475625 1.4350845 1.5475625 1.5040774 1.5686159 1.4816045 1.5260563
## [134] 1.4816045 1.4816045 1.5475625 1.5475625 1.5475625 1.4816045 1.5040774
## [141] 1.5686159 1.5040774 1.5260563 1.5040774 1.5040774 1.5686159 1.3609766
## [148] 1.5260563 1.4816045 1.4816045 1.5475625 1.4109870 1.5475625 1.5040774
## [155] 1.5686159 1.5040774 1.4816045 1.5040774 1.4816045 1.5260563 1.5260563
## [162] 1.5686159 1.5686159 1.5260563 1.5040774 1.5475625 1.4816045 1.3350011
## [169] 1.4350845 1.4816045 1.5040774 1.5040774 1.4350845 1.5040774 1.5686159
## [176] 1.4586150 1.3862944 1.4816045 1.5686159 1.5686159 1.5475625 1.5260563
## [183] 1.5475625 1.4816045 1.5475625 1.5686159 1.5686159 1.5040774 1.4816045
## [190] 1.5260563 1.4816045 1.4586150 1.4109870 1.5686159 1.4350845 1.5260563
## [197] 1.5892352 1.5260563 1.5475625 1.4109870 1.5040774 1.5475625 1.5040774
## [204] 1.5686159 1.5475625 1.4586150 1.4816045 1.5686159 1.3083328 1.5040774
## [211] 1.5475625 1.5686159 1.5686159 1.4109870 1.5686159 1.5040774 1.4816045
## [218] 1.4816045 1.5040774 1.5040774 1.5475625 1.5260563 1.4816045 1.5040774
## [225] 1.5040774 1.5475625 1.5475625 1.5260563 1.5040774 1.5040774 1.5040774
## [232] 1.3609766 1.5260563 1.4586150 1.4350845 1.4816045 1.3609766 1.5475625
## [239] 1.5260563 1.5260563 1.4109870 1.5475625 1.3609766 1.5686159 1.5260563
## [246] 1.4350845 1.5260563 1.5475625 1.5475625 1.5040774 1.5475625 1.4586150
## [253] 1.5260563 1.4816045 1.5475625 1.4816045 1.5040774 1.5475625 1.5475625
## [260] 1.5040774 1.5260563 1.5040774 1.5260563 1.4109870 1.3350011 1.4586150
## [267] 1.4586150 1.5260563 1.5475625 1.5260563 1.5686159 1.5475625 1.5040774
## [274] 1.5260563 1.5040774 1.4109870 1.5475625 1.5475625 1.5260563 1.5040774
## [281] 1.4816045 1.5475625 1.5040774 1.5040774 1.5040774 1.5260563 1.5475625
## [288] 1.5040774 1.4109870 1.5040774 1.5475625 1.5686159 1.5040774 1.4816045
## [295] 1.5040774 1.5260563 1.5475625 1.5260563 1.5475625 1.4586150 1.5475625
## [302] 1.4816045 1.4816045 1.5260563 1.5475625 1.5686159 1.5686159 1.5260563
## [309] 1.4350845 1.5040774 1.4816045 1.5040774 1.5040774 1.5040774 1.5475625
## [316] 1.5260563 1.5260563 1.5260563 1.4816045 1.5260563 1.5260563 1.5040774
## [323] 1.5475625 1.4816045 1.5040774

graficamente

hist(log(viajes$Google.review.rating))

Cambiar la base 2

log(viajes$Google.review.rating, base=2)
##   [1] 2.2016339 2.1699250 2.2016339 2.0356239 2.0703893 2.0703893 2.1699250
##   [8] 2.1699250 2.0703893 2.2016339 2.0356239 2.1699250 2.1699250 2.0356239
##  [15] 2.1699250 2.1375035 2.1699250 2.2016339 2.2016339 2.1043367 2.2630344
##  [22] 2.2326608 2.1375035 2.1043367 2.1043367 2.1043367 0.4854268 2.0703893
##  [29] 2.1375035 2.1375035 2.2016339 2.2016339 2.1699250 2.1375035 2.1043367
##  [36] 2.1375035 2.1375035 2.1375035 2.2326608 2.1375035 2.0703893 2.0356239
##  [43] 2.2016339 2.2016339 2.2016339 2.2326608 2.1375035 2.0356239 2.1043367
##  [50] 2.1375035 2.2326608 2.1375035 2.1375035 2.1699250 2.0703893 2.2016339
##  [57] 2.1375035 2.0703893 2.1699250 2.1699250 2.2016339 2.2016339 2.1043367
##  [64] 2.0703893 2.1699250 1.9634741 2.2016339 2.2326608 2.1699250 2.2016339
##  [71] 2.1375035 2.2630344 2.2927817 2.2016339 2.1699250 2.2016339 2.1375035
##  [78] 2.1699250 2.1375035 2.1375035 2.1375035 2.1375035 2.2016339 2.1375035
##  [85] 2.2016339 2.2016339 2.2016339 2.2016339 2.1699250 2.2016339 2.1699250
##  [92] 2.2016339 2.2927817 2.2630344 2.2630344 2.1699250 2.1699250 2.1043367
##  [99] 2.1375035 2.2326608 1.9634741 2.1699250 2.1043367 1.9259994 2.2016339
## [106] 2.1699250 2.1375035 2.1375035 2.1699250 2.1375035 2.2016339 2.2016339
## [113] 2.2326608 2.0356239 2.1699250 2.1699250 2.2016339 2.2016339 2.1699250
## [120] 2.2326608 2.1699250 2.1375035 2.2326608 2.1375035 2.2016339 2.0356239
## [127] 2.2326608 2.0703893 2.2326608 2.1699250 2.2630344 2.1375035 2.2016339
## [134] 2.1375035 2.1375035 2.2326608 2.2326608 2.2326608 2.1375035 2.1699250
## [141] 2.2630344 2.1699250 2.2016339 2.1699250 2.1699250 2.2630344 1.9634741
## [148] 2.2016339 2.1375035 2.1375035 2.2326608 2.0356239 2.2326608 2.1699250
## [155] 2.2630344 2.1699250 2.1375035 2.1699250 2.1375035 2.2016339 2.2016339
## [162] 2.2630344 2.2630344 2.2016339 2.1699250 2.2326608 2.1375035 1.9259994
## [169] 2.0703893 2.1375035 2.1699250 2.1699250 2.0703893 2.1699250 2.2630344
## [176] 2.1043367 2.0000000 2.1375035 2.2630344 2.2630344 2.2326608 2.2016339
## [183] 2.2326608 2.1375035 2.2326608 2.2630344 2.2630344 2.1699250 2.1375035
## [190] 2.2016339 2.1375035 2.1043367 2.0356239 2.2630344 2.0703893 2.2016339
## [197] 2.2927817 2.2016339 2.2326608 2.0356239 2.1699250 2.2326608 2.1699250
## [204] 2.2630344 2.2326608 2.1043367 2.1375035 2.2630344 1.8875253 2.1699250
## [211] 2.2326608 2.2630344 2.2630344 2.0356239 2.2630344 2.1699250 2.1375035
## [218] 2.1375035 2.1699250 2.1699250 2.2326608 2.2016339 2.1375035 2.1699250
## [225] 2.1699250 2.2326608 2.2326608 2.2016339 2.1699250 2.1699250 2.1699250
## [232] 1.9634741 2.2016339 2.1043367 2.0703893 2.1375035 1.9634741 2.2326608
## [239] 2.2016339 2.2016339 2.0356239 2.2326608 1.9634741 2.2630344 2.2016339
## [246] 2.0703893 2.2016339 2.2326608 2.2326608 2.1699250 2.2326608 2.1043367
## [253] 2.2016339 2.1375035 2.2326608 2.1375035 2.1699250 2.2326608 2.2326608
## [260] 2.1699250 2.2016339 2.1699250 2.2016339 2.0356239 1.9259994 2.1043367
## [267] 2.1043367 2.2016339 2.2326608 2.2016339 2.2630344 2.2326608 2.1699250
## [274] 2.2016339 2.1699250 2.0356239 2.2326608 2.2326608 2.2016339 2.1699250
## [281] 2.1375035 2.2326608 2.1699250 2.1699250 2.1699250 2.2016339 2.2326608
## [288] 2.1699250 2.0356239 2.1699250 2.2326608 2.2630344 2.1699250 2.1375035
## [295] 2.1699250 2.2016339 2.2326608 2.2016339 2.2326608 2.1043367 2.2326608
## [302] 2.1375035 2.1375035 2.2016339 2.2326608 2.2630344 2.2630344 2.2016339
## [309] 2.0703893 2.1699250 2.1375035 2.1699250 2.1699250 2.1699250 2.2326608
## [316] 2.2016339 2.2016339 2.2016339 2.1375035 2.2016339 2.2016339 2.1699250
## [323] 2.2326608 2.1375035 2.1699250

graficamente

hist(log(viajes$Google.review.rating, base=2))

Comparación de transformaciones

#Obtener solo tranaformaciones
Horsepower_sqrt <- sqrt(viajes$Google.review.rating)
Horsepower_exp <- exp(viajes$Google.review.rating)
Horsepower_ln <- log(viajes$Google.review.rating)
Horsepower_log2 <- log(viajes$Google.review.rating, base=2)
Horsepower_log5 <- log(viajes$Google.review.rating, base=5)

Ver graficamente cada una:

par(mfrow=c(3,2))
hist(viajes$Google.review.rating)
hist(Horsepower_sqrt)
hist(Horsepower_exp)
hist(Horsepower_ln)
hist(Horsepower_log2)
hist(Horsepower_log5)

par(mfrow=c(1,1))

Este tipo de transformaciones, busca que los datos sean simétricos (distribución forma de campana) o que se cumpla un supuesto estadístico

La visualización de la distribución puede mejorarse con la gráfica de densidad

par(mfrow=c(3,2))
plot(density(viajes$Google.review.rating), main = "Revisión promedio de Google")
plot(density(Horsepower_sqrt), main = "Revisión promedio de Google - sqrt")
plot(density(Horsepower_exp), main = "Revisión promedio de Google - exp")
plot(density(Horsepower_ln), main = "Revisión promedio de Google - ln")
plot(density(Horsepower_log2), main = "Revisión promedio de Google - log2")
plot(density(Horsepower_log5), main = "Revisión promedio de Google - log5")

par(mfrow=c(1,1))    

Se puede realizar un análisis general de las variables originales y verificar su comportmiento, a partir de allí se puede aplicar la transformación más adecuado según objetivo.

XII. Estandarización y normalización de variables

Estandarización de variables:

La estandarización de variables, también conocida como normalización, implica transformar los valores de una variable para que tengan una media de cero y una desviación estándar de uno. Esto se logra restando la media de la variable a cada valor y dividiendo por la desviación estándar.

La estandarización es útil cuando se desea comparar variables que están en diferentes escalas o unidades. Al estandarizar las variables, se eliminan las diferencias en las escalas y se asegura que todas las variables tengan la misma escala relativa.

Por ejemplo, si tienes un conjunto de variables con diferentes unidades de medida, como peso en kilogramos y altura en metros, puedes estandarizar ambas variables para que sean comparables y no se vean afectadas por las diferencias en las unidades.

Metodo 1: por partes

viajes$Google.review.rating
##   [1] 4.6 4.5 4.6 4.1 4.2 4.2 4.5 4.5 4.2 4.6 4.1 4.5 4.5 4.1 4.5 4.4 4.5 4.6
##  [19] 4.6 4.3 4.8 4.7 4.4 4.3 4.3 4.3 1.4 4.2 4.4 4.4 4.6 4.6 4.5 4.4 4.3 4.4
##  [37] 4.4 4.4 4.7 4.4 4.2 4.1 4.6 4.6 4.6 4.7 4.4 4.1 4.3 4.4 4.7 4.4 4.4 4.5
##  [55] 4.2 4.6 4.4 4.2 4.5 4.5 4.6 4.6 4.3 4.2 4.5 3.9 4.6 4.7 4.5 4.6 4.4 4.8
##  [73] 4.9 4.6 4.5 4.6 4.4 4.5 4.4 4.4 4.4 4.4 4.6 4.4 4.6 4.6 4.6 4.6 4.5 4.6
##  [91] 4.5 4.6 4.9 4.8 4.8 4.5 4.5 4.3 4.4 4.7 3.9 4.5 4.3 3.8 4.6 4.5 4.4 4.4
## [109] 4.5 4.4 4.6 4.6 4.7 4.1 4.5 4.5 4.6 4.6 4.5 4.7 4.5 4.4 4.7 4.4 4.6 4.1
## [127] 4.7 4.2 4.7 4.5 4.8 4.4 4.6 4.4 4.4 4.7 4.7 4.7 4.4 4.5 4.8 4.5 4.6 4.5
## [145] 4.5 4.8 3.9 4.6 4.4 4.4 4.7 4.1 4.7 4.5 4.8 4.5 4.4 4.5 4.4 4.6 4.6 4.8
## [163] 4.8 4.6 4.5 4.7 4.4 3.8 4.2 4.4 4.5 4.5 4.2 4.5 4.8 4.3 4.0 4.4 4.8 4.8
## [181] 4.7 4.6 4.7 4.4 4.7 4.8 4.8 4.5 4.4 4.6 4.4 4.3 4.1 4.8 4.2 4.6 4.9 4.6
## [199] 4.7 4.1 4.5 4.7 4.5 4.8 4.7 4.3 4.4 4.8 3.7 4.5 4.7 4.8 4.8 4.1 4.8 4.5
## [217] 4.4 4.4 4.5 4.5 4.7 4.6 4.4 4.5 4.5 4.7 4.7 4.6 4.5 4.5 4.5 3.9 4.6 4.3
## [235] 4.2 4.4 3.9 4.7 4.6 4.6 4.1 4.7 3.9 4.8 4.6 4.2 4.6 4.7 4.7 4.5 4.7 4.3
## [253] 4.6 4.4 4.7 4.4 4.5 4.7 4.7 4.5 4.6 4.5 4.6 4.1 3.8 4.3 4.3 4.6 4.7 4.6
## [271] 4.8 4.7 4.5 4.6 4.5 4.1 4.7 4.7 4.6 4.5 4.4 4.7 4.5 4.5 4.5 4.6 4.7 4.5
## [289] 4.1 4.5 4.7 4.8 4.5 4.4 4.5 4.6 4.7 4.6 4.7 4.3 4.7 4.4 4.4 4.6 4.7 4.8
## [307] 4.8 4.6 4.2 4.5 4.4 4.5 4.5 4.5 4.7 4.6 4.6 4.6 4.4 4.6 4.6 4.5 4.7 4.4
## [325] 4.5
media_Horsepower <- mean(viajes$Google.review.rating)
media_Horsepower                                         
## [1] 4.486154
desv_est <- sd(viajes$Google.review.rating)
desv_est
## [1] 0.2745799
Horsepower_estandar <- (viajes$Google.review.rating-media_Horsepower) / desv_est
Horsepower_estandar
##   [1]   0.41461943   0.05042669   0.41461943  -1.40634427  -1.04215153
##   [6]  -1.04215153   0.05042669   0.05042669  -1.04215153   0.41461943
##  [11]  -1.40634427   0.05042669   0.05042669  -1.40634427   0.05042669
##  [16]  -0.31376605   0.05042669   0.41461943   0.41461943  -0.67795879
##  [21]   1.14300491   0.77881217  -0.31376605  -0.67795879  -0.67795879
##  [26]  -0.67795879 -11.23954827  -1.04215153  -0.31376605  -0.31376605
##  [31]   0.41461943   0.41461943   0.05042669  -0.31376605  -0.67795879
##  [36]  -0.31376605  -0.31376605  -0.31376605   0.77881217  -0.31376605
##  [41]  -1.04215153  -1.40634427   0.41461943   0.41461943   0.41461943
##  [46]   0.77881217  -0.31376605  -1.40634427  -0.67795879  -0.31376605
##  [51]   0.77881217  -0.31376605  -0.31376605   0.05042669  -1.04215153
##  [56]   0.41461943  -0.31376605  -1.04215153   0.05042669   0.05042669
##  [61]   0.41461943   0.41461943  -0.67795879  -1.04215153   0.05042669
##  [66]  -2.13472976   0.41461943   0.77881217   0.05042669   0.41461943
##  [71]  -0.31376605   1.14300491   1.50719765   0.41461943   0.05042669
##  [76]   0.41461943  -0.31376605   0.05042669  -0.31376605  -0.31376605
##  [81]  -0.31376605  -0.31376605   0.41461943  -0.31376605   0.41461943
##  [86]   0.41461943   0.41461943   0.41461943   0.05042669   0.41461943
##  [91]   0.05042669   0.41461943   1.50719765   1.14300491   1.14300491
##  [96]   0.05042669   0.05042669  -0.67795879  -0.31376605   0.77881217
## [101]  -2.13472976   0.05042669  -0.67795879  -2.49892250   0.41461943
## [106]   0.05042669  -0.31376605  -0.31376605   0.05042669  -0.31376605
## [111]   0.41461943   0.41461943   0.77881217  -1.40634427   0.05042669
## [116]   0.05042669   0.41461943   0.41461943   0.05042669   0.77881217
## [121]   0.05042669  -0.31376605   0.77881217  -0.31376605   0.41461943
## [126]  -1.40634427   0.77881217  -1.04215153   0.77881217   0.05042669
## [131]   1.14300491  -0.31376605   0.41461943  -0.31376605  -0.31376605
## [136]   0.77881217   0.77881217   0.77881217  -0.31376605   0.05042669
## [141]   1.14300491   0.05042669   0.41461943   0.05042669   0.05042669
## [146]   1.14300491  -2.13472976   0.41461943  -0.31376605  -0.31376605
## [151]   0.77881217  -1.40634427   0.77881217   0.05042669   1.14300491
## [156]   0.05042669  -0.31376605   0.05042669  -0.31376605   0.41461943
## [161]   0.41461943   1.14300491   1.14300491   0.41461943   0.05042669
## [166]   0.77881217  -0.31376605  -2.49892250  -1.04215153  -0.31376605
## [171]   0.05042669   0.05042669  -1.04215153   0.05042669   1.14300491
## [176]  -0.67795879  -1.77053702  -0.31376605   1.14300491   1.14300491
## [181]   0.77881217   0.41461943   0.77881217  -0.31376605   0.77881217
## [186]   1.14300491   1.14300491   0.05042669  -0.31376605   0.41461943
## [191]  -0.31376605  -0.67795879  -1.40634427   1.14300491  -1.04215153
## [196]   0.41461943   1.50719765   0.41461943   0.77881217  -1.40634427
## [201]   0.05042669   0.77881217   0.05042669   1.14300491   0.77881217
## [206]  -0.67795879  -0.31376605   1.14300491  -2.86311524   0.05042669
## [211]   0.77881217   1.14300491   1.14300491  -1.40634427   1.14300491
## [216]   0.05042669  -0.31376605  -0.31376605   0.05042669   0.05042669
## [221]   0.77881217   0.41461943  -0.31376605   0.05042669   0.05042669
## [226]   0.77881217   0.77881217   0.41461943   0.05042669   0.05042669
## [231]   0.05042669  -2.13472976   0.41461943  -0.67795879  -1.04215153
## [236]  -0.31376605  -2.13472976   0.77881217   0.41461943   0.41461943
## [241]  -1.40634427   0.77881217  -2.13472976   1.14300491   0.41461943
## [246]  -1.04215153   0.41461943   0.77881217   0.77881217   0.05042669
## [251]   0.77881217  -0.67795879   0.41461943  -0.31376605   0.77881217
## [256]  -0.31376605   0.05042669   0.77881217   0.77881217   0.05042669
## [261]   0.41461943   0.05042669   0.41461943  -1.40634427  -2.49892250
## [266]  -0.67795879  -0.67795879   0.41461943   0.77881217   0.41461943
## [271]   1.14300491   0.77881217   0.05042669   0.41461943   0.05042669
## [276]  -1.40634427   0.77881217   0.77881217   0.41461943   0.05042669
## [281]  -0.31376605   0.77881217   0.05042669   0.05042669   0.05042669
## [286]   0.41461943   0.77881217   0.05042669  -1.40634427   0.05042669
## [291]   0.77881217   1.14300491   0.05042669  -0.31376605   0.05042669
## [296]   0.41461943   0.77881217   0.41461943   0.77881217  -0.67795879
## [301]   0.77881217  -0.31376605  -0.31376605   0.41461943   0.77881217
## [306]   1.14300491   1.14300491   0.41461943  -1.04215153   0.05042669
## [311]  -0.31376605   0.05042669   0.05042669   0.05042669   0.77881217
## [316]   0.41461943   0.41461943   0.41461943  -0.31376605   0.41461943
## [321]   0.41461943   0.05042669   0.77881217  -0.31376605   0.05042669

Metodo 2: Directo

media_Horsepower_estandar2 <- (viajes$Google.review.rating-mean(viajes$Google.review.rating))/sd(viajes$Google.review.rating)
media_Horsepower_estandar2
##   [1]   0.41461943   0.05042669   0.41461943  -1.40634427  -1.04215153
##   [6]  -1.04215153   0.05042669   0.05042669  -1.04215153   0.41461943
##  [11]  -1.40634427   0.05042669   0.05042669  -1.40634427   0.05042669
##  [16]  -0.31376605   0.05042669   0.41461943   0.41461943  -0.67795879
##  [21]   1.14300491   0.77881217  -0.31376605  -0.67795879  -0.67795879
##  [26]  -0.67795879 -11.23954827  -1.04215153  -0.31376605  -0.31376605
##  [31]   0.41461943   0.41461943   0.05042669  -0.31376605  -0.67795879
##  [36]  -0.31376605  -0.31376605  -0.31376605   0.77881217  -0.31376605
##  [41]  -1.04215153  -1.40634427   0.41461943   0.41461943   0.41461943
##  [46]   0.77881217  -0.31376605  -1.40634427  -0.67795879  -0.31376605
##  [51]   0.77881217  -0.31376605  -0.31376605   0.05042669  -1.04215153
##  [56]   0.41461943  -0.31376605  -1.04215153   0.05042669   0.05042669
##  [61]   0.41461943   0.41461943  -0.67795879  -1.04215153   0.05042669
##  [66]  -2.13472976   0.41461943   0.77881217   0.05042669   0.41461943
##  [71]  -0.31376605   1.14300491   1.50719765   0.41461943   0.05042669
##  [76]   0.41461943  -0.31376605   0.05042669  -0.31376605  -0.31376605
##  [81]  -0.31376605  -0.31376605   0.41461943  -0.31376605   0.41461943
##  [86]   0.41461943   0.41461943   0.41461943   0.05042669   0.41461943
##  [91]   0.05042669   0.41461943   1.50719765   1.14300491   1.14300491
##  [96]   0.05042669   0.05042669  -0.67795879  -0.31376605   0.77881217
## [101]  -2.13472976   0.05042669  -0.67795879  -2.49892250   0.41461943
## [106]   0.05042669  -0.31376605  -0.31376605   0.05042669  -0.31376605
## [111]   0.41461943   0.41461943   0.77881217  -1.40634427   0.05042669
## [116]   0.05042669   0.41461943   0.41461943   0.05042669   0.77881217
## [121]   0.05042669  -0.31376605   0.77881217  -0.31376605   0.41461943
## [126]  -1.40634427   0.77881217  -1.04215153   0.77881217   0.05042669
## [131]   1.14300491  -0.31376605   0.41461943  -0.31376605  -0.31376605
## [136]   0.77881217   0.77881217   0.77881217  -0.31376605   0.05042669
## [141]   1.14300491   0.05042669   0.41461943   0.05042669   0.05042669
## [146]   1.14300491  -2.13472976   0.41461943  -0.31376605  -0.31376605
## [151]   0.77881217  -1.40634427   0.77881217   0.05042669   1.14300491
## [156]   0.05042669  -0.31376605   0.05042669  -0.31376605   0.41461943
## [161]   0.41461943   1.14300491   1.14300491   0.41461943   0.05042669
## [166]   0.77881217  -0.31376605  -2.49892250  -1.04215153  -0.31376605
## [171]   0.05042669   0.05042669  -1.04215153   0.05042669   1.14300491
## [176]  -0.67795879  -1.77053702  -0.31376605   1.14300491   1.14300491
## [181]   0.77881217   0.41461943   0.77881217  -0.31376605   0.77881217
## [186]   1.14300491   1.14300491   0.05042669  -0.31376605   0.41461943
## [191]  -0.31376605  -0.67795879  -1.40634427   1.14300491  -1.04215153
## [196]   0.41461943   1.50719765   0.41461943   0.77881217  -1.40634427
## [201]   0.05042669   0.77881217   0.05042669   1.14300491   0.77881217
## [206]  -0.67795879  -0.31376605   1.14300491  -2.86311524   0.05042669
## [211]   0.77881217   1.14300491   1.14300491  -1.40634427   1.14300491
## [216]   0.05042669  -0.31376605  -0.31376605   0.05042669   0.05042669
## [221]   0.77881217   0.41461943  -0.31376605   0.05042669   0.05042669
## [226]   0.77881217   0.77881217   0.41461943   0.05042669   0.05042669
## [231]   0.05042669  -2.13472976   0.41461943  -0.67795879  -1.04215153
## [236]  -0.31376605  -2.13472976   0.77881217   0.41461943   0.41461943
## [241]  -1.40634427   0.77881217  -2.13472976   1.14300491   0.41461943
## [246]  -1.04215153   0.41461943   0.77881217   0.77881217   0.05042669
## [251]   0.77881217  -0.67795879   0.41461943  -0.31376605   0.77881217
## [256]  -0.31376605   0.05042669   0.77881217   0.77881217   0.05042669
## [261]   0.41461943   0.05042669   0.41461943  -1.40634427  -2.49892250
## [266]  -0.67795879  -0.67795879   0.41461943   0.77881217   0.41461943
## [271]   1.14300491   0.77881217   0.05042669   0.41461943   0.05042669
## [276]  -1.40634427   0.77881217   0.77881217   0.41461943   0.05042669
## [281]  -0.31376605   0.77881217   0.05042669   0.05042669   0.05042669
## [286]   0.41461943   0.77881217   0.05042669  -1.40634427   0.05042669
## [291]   0.77881217   1.14300491   0.05042669  -0.31376605   0.05042669
## [296]   0.41461943   0.77881217   0.41461943   0.77881217  -0.67795879
## [301]   0.77881217  -0.31376605  -0.31376605   0.41461943   0.77881217
## [306]   1.14300491   1.14300491   0.41461943  -1.04215153   0.05042669
## [311]  -0.31376605   0.05042669   0.05042669   0.05042669   0.77881217
## [316]   0.41461943   0.41461943   0.41461943  -0.31376605   0.41461943
## [321]   0.41461943   0.05042669   0.77881217  -0.31376605   0.05042669

Metodo 3: apoyarse en la funciones de R

R tiene multiple funciones para estandarizacion, la clasica es la funcion scale

Horsepower_estandar3 <- scale(viajes$Google.review.rating)
Horsepower_estandar3
##                [,1]
##   [1,]   0.41461943
##   [2,]   0.05042669
##   [3,]   0.41461943
##   [4,]  -1.40634427
##   [5,]  -1.04215153
##   [6,]  -1.04215153
##   [7,]   0.05042669
##   [8,]   0.05042669
##   [9,]  -1.04215153
##  [10,]   0.41461943
##  [11,]  -1.40634427
##  [12,]   0.05042669
##  [13,]   0.05042669
##  [14,]  -1.40634427
##  [15,]   0.05042669
##  [16,]  -0.31376605
##  [17,]   0.05042669
##  [18,]   0.41461943
##  [19,]   0.41461943
##  [20,]  -0.67795879
##  [21,]   1.14300491
##  [22,]   0.77881217
##  [23,]  -0.31376605
##  [24,]  -0.67795879
##  [25,]  -0.67795879
##  [26,]  -0.67795879
##  [27,] -11.23954827
##  [28,]  -1.04215153
##  [29,]  -0.31376605
##  [30,]  -0.31376605
##  [31,]   0.41461943
##  [32,]   0.41461943
##  [33,]   0.05042669
##  [34,]  -0.31376605
##  [35,]  -0.67795879
##  [36,]  -0.31376605
##  [37,]  -0.31376605
##  [38,]  -0.31376605
##  [39,]   0.77881217
##  [40,]  -0.31376605
##  [41,]  -1.04215153
##  [42,]  -1.40634427
##  [43,]   0.41461943
##  [44,]   0.41461943
##  [45,]   0.41461943
##  [46,]   0.77881217
##  [47,]  -0.31376605
##  [48,]  -1.40634427
##  [49,]  -0.67795879
##  [50,]  -0.31376605
##  [51,]   0.77881217
##  [52,]  -0.31376605
##  [53,]  -0.31376605
##  [54,]   0.05042669
##  [55,]  -1.04215153
##  [56,]   0.41461943
##  [57,]  -0.31376605
##  [58,]  -1.04215153
##  [59,]   0.05042669
##  [60,]   0.05042669
##  [61,]   0.41461943
##  [62,]   0.41461943
##  [63,]  -0.67795879
##  [64,]  -1.04215153
##  [65,]   0.05042669
##  [66,]  -2.13472976
##  [67,]   0.41461943
##  [68,]   0.77881217
##  [69,]   0.05042669
##  [70,]   0.41461943
##  [71,]  -0.31376605
##  [72,]   1.14300491
##  [73,]   1.50719765
##  [74,]   0.41461943
##  [75,]   0.05042669
##  [76,]   0.41461943
##  [77,]  -0.31376605
##  [78,]   0.05042669
##  [79,]  -0.31376605
##  [80,]  -0.31376605
##  [81,]  -0.31376605
##  [82,]  -0.31376605
##  [83,]   0.41461943
##  [84,]  -0.31376605
##  [85,]   0.41461943
##  [86,]   0.41461943
##  [87,]   0.41461943
##  [88,]   0.41461943
##  [89,]   0.05042669
##  [90,]   0.41461943
##  [91,]   0.05042669
##  [92,]   0.41461943
##  [93,]   1.50719765
##  [94,]   1.14300491
##  [95,]   1.14300491
##  [96,]   0.05042669
##  [97,]   0.05042669
##  [98,]  -0.67795879
##  [99,]  -0.31376605
## [100,]   0.77881217
## [101,]  -2.13472976
## [102,]   0.05042669
## [103,]  -0.67795879
## [104,]  -2.49892250
## [105,]   0.41461943
## [106,]   0.05042669
## [107,]  -0.31376605
## [108,]  -0.31376605
## [109,]   0.05042669
## [110,]  -0.31376605
## [111,]   0.41461943
## [112,]   0.41461943
## [113,]   0.77881217
## [114,]  -1.40634427
## [115,]   0.05042669
## [116,]   0.05042669
## [117,]   0.41461943
## [118,]   0.41461943
## [119,]   0.05042669
## [120,]   0.77881217
## [121,]   0.05042669
## [122,]  -0.31376605
## [123,]   0.77881217
## [124,]  -0.31376605
## [125,]   0.41461943
## [126,]  -1.40634427
## [127,]   0.77881217
## [128,]  -1.04215153
## [129,]   0.77881217
## [130,]   0.05042669
## [131,]   1.14300491
## [132,]  -0.31376605
## [133,]   0.41461943
## [134,]  -0.31376605
## [135,]  -0.31376605
## [136,]   0.77881217
## [137,]   0.77881217
## [138,]   0.77881217
## [139,]  -0.31376605
## [140,]   0.05042669
## [141,]   1.14300491
## [142,]   0.05042669
## [143,]   0.41461943
## [144,]   0.05042669
## [145,]   0.05042669
## [146,]   1.14300491
## [147,]  -2.13472976
## [148,]   0.41461943
## [149,]  -0.31376605
## [150,]  -0.31376605
## [151,]   0.77881217
## [152,]  -1.40634427
## [153,]   0.77881217
## [154,]   0.05042669
## [155,]   1.14300491
## [156,]   0.05042669
## [157,]  -0.31376605
## [158,]   0.05042669
## [159,]  -0.31376605
## [160,]   0.41461943
## [161,]   0.41461943
## [162,]   1.14300491
## [163,]   1.14300491
## [164,]   0.41461943
## [165,]   0.05042669
## [166,]   0.77881217
## [167,]  -0.31376605
## [168,]  -2.49892250
## [169,]  -1.04215153
## [170,]  -0.31376605
## [171,]   0.05042669
## [172,]   0.05042669
## [173,]  -1.04215153
## [174,]   0.05042669
## [175,]   1.14300491
## [176,]  -0.67795879
## [177,]  -1.77053702
## [178,]  -0.31376605
## [179,]   1.14300491
## [180,]   1.14300491
## [181,]   0.77881217
## [182,]   0.41461943
## [183,]   0.77881217
## [184,]  -0.31376605
## [185,]   0.77881217
## [186,]   1.14300491
## [187,]   1.14300491
## [188,]   0.05042669
## [189,]  -0.31376605
## [190,]   0.41461943
## [191,]  -0.31376605
## [192,]  -0.67795879
## [193,]  -1.40634427
## [194,]   1.14300491
## [195,]  -1.04215153
## [196,]   0.41461943
## [197,]   1.50719765
## [198,]   0.41461943
## [199,]   0.77881217
## [200,]  -1.40634427
## [201,]   0.05042669
## [202,]   0.77881217
## [203,]   0.05042669
## [204,]   1.14300491
## [205,]   0.77881217
## [206,]  -0.67795879
## [207,]  -0.31376605
## [208,]   1.14300491
## [209,]  -2.86311524
## [210,]   0.05042669
## [211,]   0.77881217
## [212,]   1.14300491
## [213,]   1.14300491
## [214,]  -1.40634427
## [215,]   1.14300491
## [216,]   0.05042669
## [217,]  -0.31376605
## [218,]  -0.31376605
## [219,]   0.05042669
## [220,]   0.05042669
## [221,]   0.77881217
## [222,]   0.41461943
## [223,]  -0.31376605
## [224,]   0.05042669
## [225,]   0.05042669
## [226,]   0.77881217
## [227,]   0.77881217
## [228,]   0.41461943
## [229,]   0.05042669
## [230,]   0.05042669
## [231,]   0.05042669
## [232,]  -2.13472976
## [233,]   0.41461943
## [234,]  -0.67795879
## [235,]  -1.04215153
## [236,]  -0.31376605
## [237,]  -2.13472976
## [238,]   0.77881217
## [239,]   0.41461943
## [240,]   0.41461943
## [241,]  -1.40634427
## [242,]   0.77881217
## [243,]  -2.13472976
## [244,]   1.14300491
## [245,]   0.41461943
## [246,]  -1.04215153
## [247,]   0.41461943
## [248,]   0.77881217
## [249,]   0.77881217
## [250,]   0.05042669
## [251,]   0.77881217
## [252,]  -0.67795879
## [253,]   0.41461943
## [254,]  -0.31376605
## [255,]   0.77881217
## [256,]  -0.31376605
## [257,]   0.05042669
## [258,]   0.77881217
## [259,]   0.77881217
## [260,]   0.05042669
## [261,]   0.41461943
## [262,]   0.05042669
## [263,]   0.41461943
## [264,]  -1.40634427
## [265,]  -2.49892250
## [266,]  -0.67795879
## [267,]  -0.67795879
## [268,]   0.41461943
## [269,]   0.77881217
## [270,]   0.41461943
## [271,]   1.14300491
## [272,]   0.77881217
## [273,]   0.05042669
## [274,]   0.41461943
## [275,]   0.05042669
## [276,]  -1.40634427
## [277,]   0.77881217
## [278,]   0.77881217
## [279,]   0.41461943
## [280,]   0.05042669
## [281,]  -0.31376605
## [282,]   0.77881217
## [283,]   0.05042669
## [284,]   0.05042669
## [285,]   0.05042669
## [286,]   0.41461943
## [287,]   0.77881217
## [288,]   0.05042669
## [289,]  -1.40634427
## [290,]   0.05042669
## [291,]   0.77881217
## [292,]   1.14300491
## [293,]   0.05042669
## [294,]  -0.31376605
## [295,]   0.05042669
## [296,]   0.41461943
## [297,]   0.77881217
## [298,]   0.41461943
## [299,]   0.77881217
## [300,]  -0.67795879
## [301,]   0.77881217
## [302,]  -0.31376605
## [303,]  -0.31376605
## [304,]   0.41461943
## [305,]   0.77881217
## [306,]   1.14300491
## [307,]   1.14300491
## [308,]   0.41461943
## [309,]  -1.04215153
## [310,]   0.05042669
## [311,]  -0.31376605
## [312,]   0.05042669
## [313,]   0.05042669
## [314,]   0.05042669
## [315,]   0.77881217
## [316,]   0.41461943
## [317,]   0.41461943
## [318,]   0.41461943
## [319,]  -0.31376605
## [320,]   0.41461943
## [321,]   0.41461943
## [322,]   0.05042669
## [323,]   0.77881217
## [324,]  -0.31376605
## [325,]   0.05042669
## attr(,"scaled:center")
## [1] 4.486154
## attr(,"scaled:scale")
## [1] 0.2745799

La ventaja de la funcion de R, es que se puede enviar todo el caso

viajes_cuanti_scale <- scale(viajes[,1:0])
viajes_cuanti_scale
##               [,1]
##   [1,] -1.72407104
##   [2,] -1.71342863
##   [3,] -1.70278621
##   [4,] -1.69214380
##   [5,] -1.68150139
##   [6,] -1.67085897
##   [7,] -1.66021656
##   [8,] -1.64957414
##   [9,] -1.63893173
##  [10,] -1.62828932
##  [11,] -1.61764690
##  [12,] -1.60700449
##  [13,] -1.59636207
##  [14,] -1.58571966
##  [15,] -1.57507725
##  [16,] -1.56443483
##  [17,] -1.55379242
##  [18,] -1.54315001
##  [19,] -1.53250759
##  [20,] -1.52186518
##  [21,] -1.51122276
##  [22,] -1.50058035
##  [23,] -1.48993794
##  [24,] -1.47929552
##  [25,] -1.46865311
##  [26,] -1.45801069
##  [27,] -1.44736828
##  [28,] -1.43672587
##  [29,] -1.42608345
##  [30,] -1.41544104
##  [31,] -1.40479863
##  [32,] -1.39415621
##  [33,] -1.38351380
##  [34,] -1.37287138
##  [35,] -1.36222897
##  [36,] -1.35158656
##  [37,] -1.34094414
##  [38,] -1.33030173
##  [39,] -1.31965932
##  [40,] -1.30901690
##  [41,] -1.29837449
##  [42,] -1.28773207
##  [43,] -1.27708966
##  [44,] -1.26644725
##  [45,] -1.25580483
##  [46,] -1.24516242
##  [47,] -1.23452000
##  [48,] -1.22387759
##  [49,] -1.21323518
##  [50,] -1.20259276
##  [51,] -1.19195035
##  [52,] -1.18130794
##  [53,] -1.17066552
##  [54,] -1.16002311
##  [55,] -1.14938069
##  [56,] -1.13873828
##  [57,] -1.12809587
##  [58,] -1.11745345
##  [59,] -1.10681104
##  [60,] -1.09616862
##  [61,] -1.08552621
##  [62,] -1.07488380
##  [63,] -1.06424138
##  [64,] -1.05359897
##  [65,] -1.04295656
##  [66,] -1.03231414
##  [67,] -1.02167173
##  [68,] -1.01102931
##  [69,] -1.00038690
##  [70,] -0.98974449
##  [71,] -0.97910207
##  [72,] -0.96845966
##  [73,] -0.95781724
##  [74,] -0.94717483
##  [75,] -0.93653242
##  [76,] -0.92589000
##  [77,] -0.91524759
##  [78,] -0.90460518
##  [79,] -0.89396276
##  [80,] -0.88332035
##  [81,] -0.87267793
##  [82,] -0.86203552
##  [83,] -0.85139311
##  [84,] -0.84075069
##  [85,] -0.83010828
##  [86,] -0.81946587
##  [87,] -0.80882345
##  [88,] -0.79818104
##  [89,] -0.78753862
##  [90,] -0.77689621
##  [91,] -0.76625380
##  [92,] -0.75561138
##  [93,] -0.74496897
##  [94,] -0.73432655
##  [95,] -0.72368414
##  [96,] -0.71304173
##  [97,] -0.70239931
##  [98,] -0.69175690
##  [99,] -0.68111449
## [100,] -0.67047207
## [101,] -0.65982966
## [102,] -0.64918724
## [103,] -0.63854483
## [104,] -0.62790242
## [105,] -0.61726000
## [106,] -0.60661759
## [107,] -0.59597517
## [108,] -0.58533276
## [109,] -0.57469035
## [110,] -0.56404793
## [111,] -0.55340552
## [112,] -0.54276311
## [113,] -0.53212069
## [114,] -0.52147828
## [115,] -0.51083586
## [116,] -0.50019345
## [117,] -0.48955104
## [118,] -0.47890862
## [119,] -0.46826621
## [120,] -0.45762379
## [121,] -0.44698138
## [122,] -0.43633897
## [123,] -0.42569655
## [124,] -0.41505414
## [125,] -0.40441173
## [126,] -0.39376931
## [127,] -0.38312690
## [128,] -0.37248448
## [129,] -0.36184207
## [130,] -0.35119966
## [131,] -0.34055724
## [132,] -0.32991483
## [133,] -0.31927241
## [134,] -0.30863000
## [135,] -0.29798759
## [136,] -0.28734517
## [137,] -0.27670276
## [138,] -0.26606035
## [139,] -0.25541793
## [140,] -0.24477552
## [141,] -0.23413310
## [142,] -0.22349069
## [143,] -0.21284828
## [144,] -0.20220586
## [145,] -0.19156345
## [146,] -0.18092104
## [147,] -0.17027862
## [148,] -0.15963621
## [149,] -0.14899379
## [150,] -0.13835138
## [151,] -0.12770897
## [152,] -0.11706655
## [153,] -0.10642414
## [154,] -0.09578172
## [155,] -0.08513931
## [156,] -0.07449690
## [157,] -0.06385448
## [158,] -0.05321207
## [159,] -0.04256966
## [160,] -0.03192724
## [161,] -0.02128483
## [162,] -0.01064241
## [163,]  0.00000000
## [164,]  0.01064241
## [165,]  0.02128483
## [166,]  0.03192724
## [167,]  0.04256966
## [168,]  0.05321207
## [169,]  0.06385448
## [170,]  0.07449690
## [171,]  0.08513931
## [172,]  0.09578172
## [173,]  0.10642414
## [174,]  0.11706655
## [175,]  0.12770897
## [176,]  0.13835138
## [177,]  0.14899379
## [178,]  0.15963621
## [179,]  0.17027862
## [180,]  0.18092104
## [181,]  0.19156345
## [182,]  0.20220586
## [183,]  0.21284828
## [184,]  0.22349069
## [185,]  0.23413310
## [186,]  0.24477552
## [187,]  0.25541793
## [188,]  0.26606035
## [189,]  0.27670276
## [190,]  0.28734517
## [191,]  0.29798759
## [192,]  0.30863000
## [193,]  0.31927241
## [194,]  0.32991483
## [195,]  0.34055724
## [196,]  0.35119966
## [197,]  0.36184207
## [198,]  0.37248448
## [199,]  0.38312690
## [200,]  0.39376931
## [201,]  0.40441173
## [202,]  0.41505414
## [203,]  0.42569655
## [204,]  0.43633897
## [205,]  0.44698138
## [206,]  0.45762379
## [207,]  0.46826621
## [208,]  0.47890862
## [209,]  0.48955104
## [210,]  0.50019345
## [211,]  0.51083586
## [212,]  0.52147828
## [213,]  0.53212069
## [214,]  0.54276311
## [215,]  0.55340552
## [216,]  0.56404793
## [217,]  0.57469035
## [218,]  0.58533276
## [219,]  0.59597517
## [220,]  0.60661759
## [221,]  0.61726000
## [222,]  0.62790242
## [223,]  0.63854483
## [224,]  0.64918724
## [225,]  0.65982966
## [226,]  0.67047207
## [227,]  0.68111449
## [228,]  0.69175690
## [229,]  0.70239931
## [230,]  0.71304173
## [231,]  0.72368414
## [232,]  0.73432655
## [233,]  0.74496897
## [234,]  0.75561138
## [235,]  0.76625380
## [236,]  0.77689621
## [237,]  0.78753862
## [238,]  0.79818104
## [239,]  0.80882345
## [240,]  0.81946587
## [241,]  0.83010828
## [242,]  0.84075069
## [243,]  0.85139311
## [244,]  0.86203552
## [245,]  0.87267793
## [246,]  0.88332035
## [247,]  0.89396276
## [248,]  0.90460518
## [249,]  0.91524759
## [250,]  0.92589000
## [251,]  0.93653242
## [252,]  0.94717483
## [253,]  0.95781724
## [254,]  0.96845966
## [255,]  0.97910207
## [256,]  0.98974449
## [257,]  1.00038690
## [258,]  1.01102931
## [259,]  1.02167173
## [260,]  1.03231414
## [261,]  1.04295656
## [262,]  1.05359897
## [263,]  1.06424138
## [264,]  1.07488380
## [265,]  1.08552621
## [266,]  1.09616862
## [267,]  1.10681104
## [268,]  1.11745345
## [269,]  1.12809587
## [270,]  1.13873828
## [271,]  1.14938069
## [272,]  1.16002311
## [273,]  1.17066552
## [274,]  1.18130794
## [275,]  1.19195035
## [276,]  1.20259276
## [277,]  1.21323518
## [278,]  1.22387759
## [279,]  1.23452000
## [280,]  1.24516242
## [281,]  1.25580483
## [282,]  1.26644725
## [283,]  1.27708966
## [284,]  1.28773207
## [285,]  1.29837449
## [286,]  1.30901690
## [287,]  1.31965932
## [288,]  1.33030173
## [289,]  1.34094414
## [290,]  1.35158656
## [291,]  1.36222897
## [292,]  1.37287138
## [293,]  1.38351380
## [294,]  1.39415621
## [295,]  1.40479863
## [296,]  1.41544104
## [297,]  1.42608345
## [298,]  1.43672587
## [299,]  1.44736828
## [300,]  1.45801069
## [301,]  1.46865311
## [302,]  1.47929552
## [303,]  1.48993794
## [304,]  1.50058035
## [305,]  1.51122276
## [306,]  1.52186518
## [307,]  1.53250759
## [308,]  1.54315001
## [309,]  1.55379242
## [310,]  1.56443483
## [311,]  1.57507725
## [312,]  1.58571966
## [313,]  1.59636207
## [314,]  1.60700449
## [315,]  1.61764690
## [316,]  1.62828932
## [317,]  1.63893173
## [318,]  1.64957414
## [319,]  1.66021656
## [320,]  1.67085897
## [321,]  1.68150139
## [322,]  1.69214380
## [323,]  1.70278621
## [324,]  1.71342863
## [325,]  1.72407104
## attr(,"scaled:center")
## [1] 162
## attr(,"scaled:scale")
## [1] 93.96365
boxplot(viajes_cuanti_scale)

\[ X_{norm}=\frac{\left(X_i-X_{\min }\right)}{X_{\max }-X_{\min }} \]

Metodo 1:

Horsepower_normal <- (viajes$Google.review.rating-min(viajes$Google.review.rating))/(max(viajes$Google.review.rating)-min(viajes$Google.review.rating))
Horsepower_normal
##   [1] 0.9142857 0.8857143 0.9142857 0.7714286 0.8000000 0.8000000 0.8857143
##   [8] 0.8857143 0.8000000 0.9142857 0.7714286 0.8857143 0.8857143 0.7714286
##  [15] 0.8857143 0.8571429 0.8857143 0.9142857 0.9142857 0.8285714 0.9714286
##  [22] 0.9428571 0.8571429 0.8285714 0.8285714 0.8285714 0.0000000 0.8000000
##  [29] 0.8571429 0.8571429 0.9142857 0.9142857 0.8857143 0.8571429 0.8285714
##  [36] 0.8571429 0.8571429 0.8571429 0.9428571 0.8571429 0.8000000 0.7714286
##  [43] 0.9142857 0.9142857 0.9142857 0.9428571 0.8571429 0.7714286 0.8285714
##  [50] 0.8571429 0.9428571 0.8571429 0.8571429 0.8857143 0.8000000 0.9142857
##  [57] 0.8571429 0.8000000 0.8857143 0.8857143 0.9142857 0.9142857 0.8285714
##  [64] 0.8000000 0.8857143 0.7142857 0.9142857 0.9428571 0.8857143 0.9142857
##  [71] 0.8571429 0.9714286 1.0000000 0.9142857 0.8857143 0.9142857 0.8571429
##  [78] 0.8857143 0.8571429 0.8571429 0.8571429 0.8571429 0.9142857 0.8571429
##  [85] 0.9142857 0.9142857 0.9142857 0.9142857 0.8857143 0.9142857 0.8857143
##  [92] 0.9142857 1.0000000 0.9714286 0.9714286 0.8857143 0.8857143 0.8285714
##  [99] 0.8571429 0.9428571 0.7142857 0.8857143 0.8285714 0.6857143 0.9142857
## [106] 0.8857143 0.8571429 0.8571429 0.8857143 0.8571429 0.9142857 0.9142857
## [113] 0.9428571 0.7714286 0.8857143 0.8857143 0.9142857 0.9142857 0.8857143
## [120] 0.9428571 0.8857143 0.8571429 0.9428571 0.8571429 0.9142857 0.7714286
## [127] 0.9428571 0.8000000 0.9428571 0.8857143 0.9714286 0.8571429 0.9142857
## [134] 0.8571429 0.8571429 0.9428571 0.9428571 0.9428571 0.8571429 0.8857143
## [141] 0.9714286 0.8857143 0.9142857 0.8857143 0.8857143 0.9714286 0.7142857
## [148] 0.9142857 0.8571429 0.8571429 0.9428571 0.7714286 0.9428571 0.8857143
## [155] 0.9714286 0.8857143 0.8571429 0.8857143 0.8571429 0.9142857 0.9142857
## [162] 0.9714286 0.9714286 0.9142857 0.8857143 0.9428571 0.8571429 0.6857143
## [169] 0.8000000 0.8571429 0.8857143 0.8857143 0.8000000 0.8857143 0.9714286
## [176] 0.8285714 0.7428571 0.8571429 0.9714286 0.9714286 0.9428571 0.9142857
## [183] 0.9428571 0.8571429 0.9428571 0.9714286 0.9714286 0.8857143 0.8571429
## [190] 0.9142857 0.8571429 0.8285714 0.7714286 0.9714286 0.8000000 0.9142857
## [197] 1.0000000 0.9142857 0.9428571 0.7714286 0.8857143 0.9428571 0.8857143
## [204] 0.9714286 0.9428571 0.8285714 0.8571429 0.9714286 0.6571429 0.8857143
## [211] 0.9428571 0.9714286 0.9714286 0.7714286 0.9714286 0.8857143 0.8571429
## [218] 0.8571429 0.8857143 0.8857143 0.9428571 0.9142857 0.8571429 0.8857143
## [225] 0.8857143 0.9428571 0.9428571 0.9142857 0.8857143 0.8857143 0.8857143
## [232] 0.7142857 0.9142857 0.8285714 0.8000000 0.8571429 0.7142857 0.9428571
## [239] 0.9142857 0.9142857 0.7714286 0.9428571 0.7142857 0.9714286 0.9142857
## [246] 0.8000000 0.9142857 0.9428571 0.9428571 0.8857143 0.9428571 0.8285714
## [253] 0.9142857 0.8571429 0.9428571 0.8571429 0.8857143 0.9428571 0.9428571
## [260] 0.8857143 0.9142857 0.8857143 0.9142857 0.7714286 0.6857143 0.8285714
## [267] 0.8285714 0.9142857 0.9428571 0.9142857 0.9714286 0.9428571 0.8857143
## [274] 0.9142857 0.8857143 0.7714286 0.9428571 0.9428571 0.9142857 0.8857143
## [281] 0.8571429 0.9428571 0.8857143 0.8857143 0.8857143 0.9142857 0.9428571
## [288] 0.8857143 0.7714286 0.8857143 0.9428571 0.9714286 0.8857143 0.8571429
## [295] 0.8857143 0.9142857 0.9428571 0.9142857 0.9428571 0.8285714 0.9428571
## [302] 0.8571429 0.8571429 0.9142857 0.9428571 0.9714286 0.9714286 0.9142857
## [309] 0.8000000 0.8857143 0.8571429 0.8857143 0.8857143 0.8857143 0.9428571
## [316] 0.9142857 0.9142857 0.9142857 0.8571429 0.9142857 0.9142857 0.8857143
## [323] 0.9428571 0.8571429 0.8857143

Metodo 2:

library(scales)
## Warning: package 'scales' was built under R version 4.3.2
## 
## Attaching package: 'scales'
## The following objects are masked from 'package:psych':
## 
##     alpha, rescale
## The following object is masked from 'package:plotrix':
## 
##     rescale
## The following object is masked from 'package:epiDisplay':
## 
##     alpha
rescale(viajes$Google.review.rating)
##   [1] 0.9142857 0.8857143 0.9142857 0.7714286 0.8000000 0.8000000 0.8857143
##   [8] 0.8857143 0.8000000 0.9142857 0.7714286 0.8857143 0.8857143 0.7714286
##  [15] 0.8857143 0.8571429 0.8857143 0.9142857 0.9142857 0.8285714 0.9714286
##  [22] 0.9428571 0.8571429 0.8285714 0.8285714 0.8285714 0.0000000 0.8000000
##  [29] 0.8571429 0.8571429 0.9142857 0.9142857 0.8857143 0.8571429 0.8285714
##  [36] 0.8571429 0.8571429 0.8571429 0.9428571 0.8571429 0.8000000 0.7714286
##  [43] 0.9142857 0.9142857 0.9142857 0.9428571 0.8571429 0.7714286 0.8285714
##  [50] 0.8571429 0.9428571 0.8571429 0.8571429 0.8857143 0.8000000 0.9142857
##  [57] 0.8571429 0.8000000 0.8857143 0.8857143 0.9142857 0.9142857 0.8285714
##  [64] 0.8000000 0.8857143 0.7142857 0.9142857 0.9428571 0.8857143 0.9142857
##  [71] 0.8571429 0.9714286 1.0000000 0.9142857 0.8857143 0.9142857 0.8571429
##  [78] 0.8857143 0.8571429 0.8571429 0.8571429 0.8571429 0.9142857 0.8571429
##  [85] 0.9142857 0.9142857 0.9142857 0.9142857 0.8857143 0.9142857 0.8857143
##  [92] 0.9142857 1.0000000 0.9714286 0.9714286 0.8857143 0.8857143 0.8285714
##  [99] 0.8571429 0.9428571 0.7142857 0.8857143 0.8285714 0.6857143 0.9142857
## [106] 0.8857143 0.8571429 0.8571429 0.8857143 0.8571429 0.9142857 0.9142857
## [113] 0.9428571 0.7714286 0.8857143 0.8857143 0.9142857 0.9142857 0.8857143
## [120] 0.9428571 0.8857143 0.8571429 0.9428571 0.8571429 0.9142857 0.7714286
## [127] 0.9428571 0.8000000 0.9428571 0.8857143 0.9714286 0.8571429 0.9142857
## [134] 0.8571429 0.8571429 0.9428571 0.9428571 0.9428571 0.8571429 0.8857143
## [141] 0.9714286 0.8857143 0.9142857 0.8857143 0.8857143 0.9714286 0.7142857
## [148] 0.9142857 0.8571429 0.8571429 0.9428571 0.7714286 0.9428571 0.8857143
## [155] 0.9714286 0.8857143 0.8571429 0.8857143 0.8571429 0.9142857 0.9142857
## [162] 0.9714286 0.9714286 0.9142857 0.8857143 0.9428571 0.8571429 0.6857143
## [169] 0.8000000 0.8571429 0.8857143 0.8857143 0.8000000 0.8857143 0.9714286
## [176] 0.8285714 0.7428571 0.8571429 0.9714286 0.9714286 0.9428571 0.9142857
## [183] 0.9428571 0.8571429 0.9428571 0.9714286 0.9714286 0.8857143 0.8571429
## [190] 0.9142857 0.8571429 0.8285714 0.7714286 0.9714286 0.8000000 0.9142857
## [197] 1.0000000 0.9142857 0.9428571 0.7714286 0.8857143 0.9428571 0.8857143
## [204] 0.9714286 0.9428571 0.8285714 0.8571429 0.9714286 0.6571429 0.8857143
## [211] 0.9428571 0.9714286 0.9714286 0.7714286 0.9714286 0.8857143 0.8571429
## [218] 0.8571429 0.8857143 0.8857143 0.9428571 0.9142857 0.8571429 0.8857143
## [225] 0.8857143 0.9428571 0.9428571 0.9142857 0.8857143 0.8857143 0.8857143
## [232] 0.7142857 0.9142857 0.8285714 0.8000000 0.8571429 0.7142857 0.9428571
## [239] 0.9142857 0.9142857 0.7714286 0.9428571 0.7142857 0.9714286 0.9142857
## [246] 0.8000000 0.9142857 0.9428571 0.9428571 0.8857143 0.9428571 0.8285714
## [253] 0.9142857 0.8571429 0.9428571 0.8571429 0.8857143 0.9428571 0.9428571
## [260] 0.8857143 0.9142857 0.8857143 0.9142857 0.7714286 0.6857143 0.8285714
## [267] 0.8285714 0.9142857 0.9428571 0.9142857 0.9714286 0.9428571 0.8857143
## [274] 0.9142857 0.8857143 0.7714286 0.9428571 0.9428571 0.9142857 0.8857143
## [281] 0.8571429 0.9428571 0.8857143 0.8857143 0.8857143 0.9142857 0.9428571
## [288] 0.8857143 0.7714286 0.8857143 0.9428571 0.9714286 0.8857143 0.8571429
## [295] 0.8857143 0.9142857 0.9428571 0.9142857 0.9428571 0.8285714 0.9428571
## [302] 0.8571429 0.8571429 0.9142857 0.9428571 0.9714286 0.9714286 0.9142857
## [309] 0.8000000 0.8857143 0.8571429 0.8857143 0.8857143 0.8857143 0.9428571
## [316] 0.9142857 0.9142857 0.9142857 0.8571429 0.9142857 0.9142857 0.8857143
## [323] 0.9428571 0.8571429 0.8857143

Aplicando a todo el caso (var cuantitativas) la funcion rescale solo se permite aplicarse a vectores, no es posible directamente apicar al data frame.

library(caret)
## Warning: package 'caret' was built under R version 4.3.2
## Loading required package: lattice
## 
## Attaching package: 'lattice'
## The following object is masked from 'package:epiDisplay':
## 
##     dotplot
## 
## Attaching package: 'caret'
## The following object is masked from 'package:survival':
## 
##     cluster
pre_procesamiento <- preProcess(viajes[,4:9]) # Asi por defecto muestra la estandarizacion z
predict(pre_procesamiento, viajes[,4:9])
##                   City                                           Name
## 1                Delhi                                     India Gate
## 2                Delhi                                 Humayun's Tomb
## 3                Delhi                              Akshardham Temple
## 4                Delhi                           Waste to Wonder Park
## 5                Delhi                                  Jantar Mantar
## 6                Delhi                                  Chandni Chowk
## 7                Delhi                                   Lotus Temple
## 8                Delhi                                       Red Fort
## 9                Delhi                               Agrasen ki Baoli
## 10               Delhi                                 Sunder Nursery
## 11               Delhi                          Garden of Five Senses
## 12               Delhi                                   Lodhi Garden
## 13               Delhi                 National Gallery of Modern Art
## 14               Delhi                      National Zoological Park 
## 15               Delhi                                    Qutub Minar
## 16               Delhi                        National Science Centre
## 17              Mumbai                                   Marine Drive
## 18              Mumbai                               Gateway of India
## 19              Mumbai Chhatrapati Shivaji Maharaj Vastu Sangrahalaya
## 20              Mumbai                    Sanjay Gandhi National Park
## 21              Mumbai                           Siddhivinayak Temple
## 22              Mumbai                               Mahalaxmi Temple
## 23              Mumbai                                Haji Ali Dargah
## 24              Mumbai                                Chowpatty Beach
## 25              Mumbai                                    Essel World
## 26              Mumbai                                Elephanta Caves
## 27            Lonavala                                       Imagicaa
## 28           Bangalore                               Bangalore Palace
## 29           Bangalore                       Lalbagh Botanical Garden
## 30           Bangalore                                    Cubbon Park
## 31           Bangalore                                 Vidhana Soudha
## 32           Bangalore                        ISKCON Temple Bangalore
## 33           Hyderabad                                      Charminar
## 34           Hyderabad                                  Golconda Fort
## 35           Hyderabad                             Hussain Sagar Lake
## 36           Hyderabad                               Ramoji Film City
## 37           Hyderabad                              Salar Jung Museum
## 38           Hyderabad                               Qutb Shahi Tombs
## 39           Hyderabad                                   Birla Mandir
## 40           Hyderabad                             Chowmahalla Palace
## 41           Hyderabad                          Nehru Zoological Park
## 42           Hyderabad                                   Lumbini Park
## 43             Kolkata                              Victoria Memorial
## 44             Kolkata                                  Howrah Bridge
## 45             Kolkata                                  Indian Museum
## 46             Kolkata                       Dakshineswar Kali Temple
## 47             Kolkata                           Kalighat Kali Temple
## 48             Kolkata                                   Eden Gardens
## 49             Kolkata                     Alipore Zoological Gardens
## 50             Kolkata                           Science City Kolkata
## 51             Kolkata                                     Belur Math
## 52             Kolkata                                  Marble Palace
## 53                 Goa                                Calangute Beach
## 54                 Goa                          Basilica of Bom Jesus
## 55                 Goa                                    Fort Aguada
## 56                 Goa                                Dudhsagar Falls
## 57                 Goa                                   Anjuna Beach
## 58                 Goa                                   Chapora Fort
## 59                 Goa                                   Se Cathedral
## 60                 Goa                                     Baga Beach
## 61                 Goa                                  Arambol Beach
## 62                 Goa                                  Palolem Beach
## 63                 Goa                                    Colva Beach
## 64                 Goa                                  Miramar Beach
## 65                 Goa                                   Aguada Beach
## 66                 Goa                    Dr. Salim Ali Bird Santuary
## 67           Ahmedabad                               Sabarmati Ashram
## 68              Dwarka                             Dwarkadhish Temple
## 69            Junagadh                              Gir National Park
## 70                Bhuj                                   White Desert
## 71            Vadodara                             Laxmi Vilas Palace
## 72             Somnath                                 Somnath Temple
## 73       Rann of Kutch                                     Rann Utsav
## 74             Kevadia                                Statue of Unity
## 75         Gandhinagar                                    Dandi Kutir
## 76           Ahmedabad                           Sabarmati Riverfront
## 77           Ahmedabad                                    Manek Chowk
## 78           Ahmedabad                                  Kankaria Lake
## 79           Ahmedabad                                   Science City
## 80              Jaipur                                     Hawa Mahal
## 81             Udaipur                                    City Palace
## 82           Jaisalmer                                 Jaisalmer Fort
## 83      Sawai Madhopur                      Ranthambore National Park
## 84             Pushkar                                   Pushkar Lake
## 85               Ajmer                            Ajmer Sharif Dargah
## 86             Jodhpur                                Mehrangarh Fort
## 87         Chittorgarh                               Chittorgarh Fort
## 88           Mount Abu                                Dilwara Temples
## 89             Bikaner                                  Junagarh Fort
## 90              Jaipur                                     Amber Fort
## 91              Jaipur                                   Jaigarh Fort
## 92             Udaipur                                   Lake Pichola
## 93            Amritsar                Golden Temple (Harmandir Sahib)
## 94            Amritsar                               Jallianwala Bagh
## 95            Amritsar                                   Wagah Border
## 96          Chandigarh                                    Rock Garden
## 97           Alappuzha                                Alappuzha Beach
## 98              Munnar                             Munnar Tea Gardens
## 99               Kochi                                     Fort Kochi
## 100 Thiruvananthapuram                         Padmanabhaswamy Temple
## 101          Kozhikode                                Kozhikode Beach
## 102            Wayanad                     Wayanad Wildlife Sanctuary
## 103           Thekkady                          Periyar National Park
## 104          Kumarakom                       Kumarakom Bird Sanctuary
## 105            Varkala                                  Varkala Beach
## 106              Bekal                                     Bekal Fort
## 107            Kovalam                                  Kovalam Beach
## 108             Kannur                                St. Angelo Fort
## 109      Nelliyampathy                         Seethargundu Viewpoint
## 110              Kochi                         Kerala Folklore Museum
## 111              Kochi                        Wonderla Amusement Park
## 112             Mysore                                  Mysore Palace
## 113              Hampi                     Hampi Archaeological Ruins
## 114              Coorg                                    Abbey Falls
## 115            Gokarna                                       Om Beach
## 116        Chikmagalur                                  Mullayanagiri
## 117             Badami                            Badami Cave Temples
## 118         Shivamogga                                      Jog Falls
## 119          Mangalore                                 Panambur Beach
## 120        Murudeshwar                             Murudeshwar Temple
## 121            Bijapur                                     Gol Gumbaz
## 122           Bandipur                         Bandipur National Park
## 123           Halebidu                   Halebidu Hoysaleswara Temple
## 124               Pune                                  Shaniwar Wada
## 125         Aurangabad                                   Ajanta Caves
## 126             Nashik                                 Sula Vineyards
## 127             Shirdi                                Sai Baba Temple
## 128            Alibaug                                  Alibaug Beach
## 129          Ratnagiri                            Ganapatipule Temple
## 130             Nagpur                                  Deekshabhoomi
## 131           Kolhapur                             Mahalakshmi Temple
## 132           Lonavala                                    Karla Caves
## 133           Tarkarli                                 Tarkarli Beach
## 134             Satara                                   Kaas Plateau
## 135           Matheran                                     Echo Point
## 136             Ajanta                                   Ellora Caves
## 137          Khajuraho                   Khajuraho Group of Monuments
## 138             Bhopal                                   Sanchi Stupa
## 139             Indore                                 Rajwada Palace
## 140            Gwalior                                   Gwalior Fort
## 141             Ujjain                      Mahakaleshwar Jyotirlinga
## 142           Jabalpur                                Dhuandhar Falls
## 143          Pachmarhi                                      Bee Falls
## 144              Kanha                            Kanha National Park
## 145        Bandhavgarh                      Bandhavgarh National Park
## 146             Orchha                                    Orchha Fort
## 147              Mandu                                    Jahaz Mahal
## 148          Bhimbetka                        Bhimbetka Rock Shelters
## 149         Amarkantak                           Narmada Udgam Temple
## 150         Chitrakoot                               Chitrakoot Falls
## 151             Shimla                                      The Ridge
## 152             Manali                                  Solang Valley
## 153          dalhousie                              Dalai Lama Temple
## 154          Dalhousie                                  Khajjiar Lake
## 155       Spiti Valley                                  Key Monastery
## 156              Kullu                  Great Himalayan National Park
## 157             Chamba                                   Chamera Lake
## 158            Kinnaur                                  Sangla Valley
## 159             Kangra                                    Kangra Fort
## 160           Palampur                                    Tea Gardens
## 161              Mandi                                   Prashar Lake
## 162        Bir Billing                               Paragliding Site
## 163        McLeod Ganj                                    Triund Trek
## 164          Manikaran                                Manikaran Sahib
## 165           Narkanda                                      Hatu Peak
## 166              Barot                                   Barot Valley
## 167              Shoja                                  Serolsar Lake
## 168              Kufri                                Kufri Fun World
## 169           Nainital                                     Naini Lake
## 170          Rishikesh                                   Laxman Jhula
## 171           Haridwar                                   Har Ki Pauri
## 172           Dehradun                                  Robber's Cave
## 173          Mussoorie                                   Kempty Falls
## 174               Auli                                Auli Ski Resort
## 175          Badrinath                               Badrinath Temple
## 176             Almora                      Binsar Wildlife Sanctuary
## 177           Ranikhet                              Chaubatia Gardens
## 178        Jim Corbett                      Jim Corbett National Park
## 179         Uttarkashi                                Gangotri Temple
## 180             Chopta                                Tungnath Temple
## 181          Joshimath                              Valley of Flowers
## 182               Agra                                      Taj Mahal
## 183           Varanasi                        Kashi Vishwanath Temple
## 184            Lucknow                                  Bara Imambara
## 185            Mathura                            Krishna Janmabhoomi
## 186            Ayodhya                                Ram Janmabhoomi
## 187          Vrindavan                            Banke Bihari Temple
## 188          Allahabad                                 Triveni Sangam
## 189             Jhansi                                    Jhansi Fort
## 190            Sarnath                                   Dhamek Stupa
## 191     Fatehpur Sikri                                 Buland Darwaza
## 192              Noida                           Okhla Bird Sanctuary
## 193            Aligarh                                   Aligarh Fort
## 194             Meerut                               Augarnath Temple
## 195             Kanpur                               Allen Forest Zoo
## 196           Srinagar                                       Dal Lake
## 197                Leh                                    Pangong Tso
## 198           Pahalgam                                  Betaab Valley
## 199              Jammu                                   Vaishno Devi
## 200           Udhampur                                Patnitop Height
## 201           Anantnag                                  Amarnath Cave
## 202                Leh                              Thiksey Monastery
## 203       Nubra Valley                                   Nubra Valley
## 204             Kargil                            Kargil War Memorial
## 205             Diskit                               Diskit Monastery
## 206           Kishtwar                         Kishtwar National Park
## 207              Hemis                            Hemis National Park
## 208               Dras                              Dras War Memorial
## 209                Leh                                  Magnetic Hill
## 210                Leh                               Khardung La Pass
## 211                Leh                              Thiksey Monastery
## 212          Vrindavan                                    Prem Mandir
## 213          Porbandar                                   Kirti Mandir
## 214            Mathura                                      Nand Gaon
## 215            Mathura                                 Barsana Mandir
## 216         Darjeeling                                     Tiger Hill
## 217           Siliguri                        Jaldapara National Park
## 218         Sundarbans                       Sundarbans National Park
## 219              Digha                                    Digha Beach
## 220        Murshidabad                              Hazarduari Palace
## 221             Bolpur                             Kankalitala Temple
## 222            Hooghly                             Hangseswari Temple
## 223         Jalpaiguri                         Gorumara National Park
## 224        Cooch Behar                             Cooch Behar Palace
## 225            Purulia                                  Ayodhya Hills
## 226               Puri                               Jagannath Temple
## 227             Konark                                     Sun Temple
## 228        Bhubaneswar                                Lingaraj Temple
## 229           Rourkela                           Khandadhar Waterfall
## 230            Cuttack                                  Barabati Fort
## 231          Sambalpur                                    Hirakud Dam
## 232            Chilika                                   Chilika Lake
## 233          Berhampur                             Tara Tarini Temple
## 234           Keonjhar                          Badaghagara Waterfall
## 235           Balasore                                Chandipur Beach
## 236          Kendujhar                          Sanaghagara Waterfall
## 237            Chennai                                   Marina Beach
## 238            Madurai                         Meenakshi Amman Temple
## 239         Rameswaram                          Ramanathaswamy Temple
## 240        Kanyakumari                      Vivekananda Rock Memorial
## 241               Ooty                                      Ooty Lake
## 242         Coimbatore                             Marudamalai Temple
## 243         Kodaikanal                                Kodaikanal Lake
## 244          Thanjavur                          Brihadeeswarar Temple
## 245      Mahabalipuram                                   Shore Temple
## 246            Yercaud                                   Yercaud Lake
## 247        Tirunelveli                             Nellaiappar Temple
## 248        Chidambaram                                Nataraja Temple
## 249         Vijayawada                            Kanaka Durga Temple
## 250      Visakhapatnam                               Rishikonda Beach
## 251          Srisailam                      Mallikarjuna Swamy Temple
## 252        Rajahmundry                                    Papikondalu
## 253          Anantapur                                       Lepakshi
## 254            Kurnool                                    Belum Caves
## 255           Amravati                              Amaravathi Temple
## 256             Guntur                      Uppalapadu Bird Sanctuary
## 257             Kadapa                                 Gandikota Fort
## 258        Puttaparthi                              Prasanthi Nilayam
## 259       Vizianagaram                             Simhachalam Temple
## 260      Visakhapatnam                                    Kailasagiri
## 261      Visakhapatnam                               Submarine Museum
## 262      Visakhapatnam                                    Borra Caves
## 263      Visakhapatnam                                   War Memorial
## 264      Visakhapatnam                  Indira Gandhi Zoological Park
## 265      Visakhapatnam                        Matsyadarshini Aquarium
## 266      Visakhapatnam                                 Visakha Museum
## 267            Gangtok                                   Nathula Pass
## 268            Pelling                          Pemayangtse Monastery
## 269             Namchi                                      Char Dham
## 270            Gangtok                               Rumtek Monastery
## 271           Ravangla                                    Buddha Park
## 272            Gangtok                    Baba Harbhajan Singh Temple
## 273            Gangtok                                    Tsomgo Lake
## 274           Guwahati                                Kamakhya Temple
## 275          Kaziranga                        Kaziranga National Park
## 276           Guwahati                                Umananda Island
## 277          Sivasagar                              Sivasagar Sivadol
## 278             Majuli                                  Majuli Island
## 279              Manas                            Manas National Park
## 280               Hajo                       Hayagriva Madhava Temple
## 281           Guwahati                    Pobitora Wildlife Sanctuary
## 282             Tawang                               Tawang Monastery
## 283           Agartala                               Ujjayanta Palace
## 284            Dumboor                                   Dumboor Lake
## 285            Unakoti                          Unakoti Rock Carvings
## 286             Bastar                               Chitrakote Falls
## 287      Dzükou Valley                                  Dzükou Valley
## 288         Puducherry                                Promenade Beach
## 289          Auroville                                      Auroville
## 290         Puducherry                                 Paradise Beach
## 291         Port Blair                                  Cellular Jail
## 292    Havelock Island                               Radhanagar Beach
## 293        Neil Island                                Bharatpur Beach
## 294    Baratang Island                                Limestone Caves
## 295                Diu                                    Naida Caves
## 296                Diu                                       Diu Fort
## 297            Deoghar                         Baba Baidyanath Temple
## 298             Ranchi                                  Pahari Mandir
## 299          Bodh Gaya                               Mahabodhi Temple
## 300              Patna                  Sanjay Gandhi Biological Park
## 301              Patna          Takhat Shri Harimandir Ji Patna Sahib
## 302              Patna                             Budhha Smriti Park
## 303           Gurugram                              Kingdom of Dreams
## 304           Gurugram                                  Ambience Mall
## 305           Gurugram                                   DLF CyberHub
## 306          New Delhi                         Gurudwara Bangla Sahib
## 307          Kedarnath                                      Kedarnath
## 308              Noida                              DLF Mall of India
## 309      Greater Noida                          The Grand Venice Mall
## 310          Bengaluru                        Wonderla Amusement Park
## 311        Bhubaneswar                    Nandankanan Zoological Park
## 312          Bengaluru                                     Orion Mall
## 313          Hyderabad                         Inorbit Mall Cyberabad
## 314          New Delhi                                    Jama Masjid
## 315         Rameswaram                          Ramanathaswamy Temple
## 316      Greater Noida                    Buddh International Circuit
## 317            Lucknow                               Phoenix Palassio
## 318              Kochi               LuLu International Shopping Mall
## 319          New Delhi                                    Rail Museum
## 320        Cherrapunji                             Living Root Bridge
## 321        Gandhinagar                                     Akshardham
## 322               Agra                                      Agra Fort
## 323             Bhopal                   Madhya Pradesh Tribal Museum
## 324             Jaipur                                    City Palace
## 325             Jaipur                             Albert Hall Museum
##                          Type Establishment.Year time.needed.to.visit.in.hrs
## 1                War Memorial               1921                  -1.3461966
## 2                        Tomb               1572                   0.1979701
## 3                      Temple               2005                   3.2863035
## 4                  Theme Park               2019                   0.1979701
## 5                 Observatory               1724                   0.1979701
## 6                      Market               1700                   1.2274146
## 7                      Temple               1986                  -0.8314744
## 8                        Fort               1648                   0.1979701
## 9                    Stepwell               1400                  -0.8314744
## 10                       Park               1600                   0.1979701
## 11                       Park               2003                   0.1979701
## 12                       Park               1500                  -0.8314744
## 13                     Museum               1954                   1.2274146
## 14                        Zoo               1959                   1.2274146
## 15                   Monument               1192                  -0.8314744
## 16                    Science               1992                   3.2863035
## 17                  Promenade            Unknown                   0.1979701
## 18                   Monument               1924                  -0.8314744
## 19                     Museum               1922                  -0.8314744
## 20              National Park               1996                   1.2274146
## 21                     Temple               1881                   0.1979701
## 22                     Temple               1831                  -0.8314744
## 23           Religious Shrine               1431                   0.1979701
## 24                      Beach            Unknown                   0.1979701
## 25             Amusement Park               1986                   3.2863035
## 26                   Monument               1987                   2.2568591
## 27             Amusement Park               2013                   3.2863035
## 28                     Palace               1878                   0.1979701
## 29           Botanical Garden               1760                  -0.3167521
## 30                       Park               1870                  -0.8314744
## 31        Government Building               1956                  -1.3461966
## 32                     Temple               1997                  -0.8314744
## 33                   Landmark               1591                  -0.8314744
## 34                       Fort               1600                   0.1979701
## 35                       Lake               1563                  -0.8314744
## 36                Film Studio               1996                   2.2568591
## 37                     Museum               1951                   0.1979701
## 38                      Tombs               1600                  -0.8314744
## 39                     Temple               1976                  -0.8314744
## 40                     Palace               1800                  -0.3167521
## 41                        Zoo               1963                   1.2274146
## 42                       Park               1994                  -0.8314744
## 43                     Museum               1921                  -0.3167521
## 44                     Bridge               1943                  -1.3461966
## 45                     Museum               1814                   0.1979701
## 46                     Temple               1855                  -0.8314744
## 47                     Temple               1809                  -0.8314744
## 48             Cricket Ground               1864                   1.2274146
## 49                        Zoo               1876                   0.1979701
## 50                    Science               1997                   1.2274146
## 51                       Site               1898                  -0.3167521
## 52                     Palace               1835                  -0.8314744
## 53                      Beach            Unknown                   0.1979701
## 54                     Church               1605                  -0.8314744
## 55                       Fort               1612                  -0.3167521
## 56                  Waterfall            Unknown                   1.2274146
## 57                      Beach            Unknown                   0.1979701
## 58                       Fort               1617                  -0.8314744
## 59                     Church               1640                  -0.8314744
## 60                      Beach            Unknown                   0.1979701
## 61                      Beach            Unknown                   0.1979701
## 62                      Beach            Unknown                   0.1979701
## 63                      Beach            Unknown                   0.1979701
## 64                      Beach            Unknown                  -0.3167521
## 65                      Beach            Unknown                   0.1979701
## 66             Bird Sanctuary               1988                   0.1979701
## 67                 Historical               1915                  -0.3167521
## 68                     Temple               -400                   0.1979701
## 69              National Park               1965                   1.2274146
## 70                       Site               1950                   0.7126923
## 71                     Palace               1890                   0.1979701
## 72                     Temple               1951                   0.1979701
## 73                   Cultural            Unknown                   1.2274146
## 74                   Monument               2018                   1.2274146
## 75                     Museum               2013                  -0.3167521
## 76  Urban Development Project               2012                  -0.8314744
## 77                     Market            Unknown                   0.1979701
## 78                       Lake               1451                   1.2274146
## 79                    Science               2002                   5.3451925
## 80                     Palace               1799                  -0.8314744
## 81                     Palace               1559                   0.1979701
## 82                       Fort               1156                   0.7126923
## 83         Wildlife Sanctuary               1980                   1.2274146
## 84                     Temple               1400                  -0.3167521
## 85                     Shrine               1236                  -0.8314744
## 86                       Fort               1459                   0.1979701
## 87                       Fort                700                   0.1979701
## 88                     Temple               1100                  -0.8314744
## 89                       Fort               1589                   0.1979701
## 90                       Fort               1592                   0.1979701
## 91                       Fort               1726                  -0.3167521
## 92                       Lake               1362                  -0.8314744
## 93             Religious Site               1604                  -0.3167521
## 94                   Memorial               1951                  -0.8314744
## 95            Border Crossing               1950                   0.1979701
## 96           Sculpture Garden               1976                   0.1979701
## 97                      Beach            Unknown                  -0.3167521
## 98                Scenic Area            Unknown                   0.1979701
## 99                       Site               1503                  -0.8314744
## 100                    Temple            Unknown                  -0.8314744
## 101                     Beach            Unknown                  -0.3167521
## 102        Wildlife Sanctuary            Unknown                   1.2274146
## 103             National Park               1982                   1.2274146
## 104            Bird Sanctuary               1972                   0.1979701
## 105                     Beach            Unknown                   0.1979701
## 106                      Fort               1650                  -0.3167521
## 107                     Beach            Unknown                   0.1979701
## 108                      Fort               1505                  -0.8314744
## 109                 Viewpoint            Unknown                  -0.8314744
## 110                  Cultural               2009                  -0.3167521
## 111            Amusement Park               2016                   3.8010258
## 112                    Palace               1912                   0.1979701
## 113                      Site            Unknown                   1.2274146
## 114                 Waterfall            Unknown                  -0.8314744
## 115                     Beach            Unknown                   0.1979701
## 116             Mountain Peak            Unknown                   1.2274146
## 117                      Cave                600                  -0.3167521
## 118                 Waterfall               1900                  -0.3167521
## 119                     Beach            Unknown                  -0.3167521
## 120                    Temple            Unknown                  -0.8314744
## 121                 Mausoleum               1656                  -0.3167521
## 122             National Park               1974                   1.2274146
## 123                    Temple               1121                  -0.8314744
## 124                      Fort               1732                   0.1979701
## 125                      Cave                200                   1.2274146
## 126                  Vineyard               1999                   0.1979701
## 127                    Temple               1922                  -0.3167521
## 128                     Beach            Unknown                  -0.3167521
## 129                    Temple               1600                  -0.8314744
## 130                  Monument               2001                  -0.8314744
## 131                    Temple                700                  -0.8314744
## 132                      Cave                200                  -0.3167521
## 133                     Beach            Unknown                   0.1979701
## 134                    Valley            Unknown                   0.1979701
## 135                 Viewpoint               1828                  -0.3167521
## 136                      Cave                600                   1.2274146
## 137                   Temples               -850                   0.1979701
## 138                  Monument               -300                  -0.3167521
## 139                    Palace               1747                  -0.8314744
## 140                      Fort                900                   0.7126923
## 141                    Temple              -3500                  -0.3167521
## 142                 Waterfall            Unknown                  -0.8314744
## 143                 Waterfall            Unknown                  -0.3167521
## 144        Wildlife Sanctuary               1955                   1.2274146
## 145             National Park               1968                   1.2274146
## 146                      Fort               1500                  -0.3167521
## 147                      Site               1500                  -0.8314744
## 148          Prehistoric Site               1958                   0.1979701
## 149                    Temple               1200                  -0.8314744
## 150                 Waterfall            Unknown                  -0.3167521
## 151              Scenic Point            Unknown                  -0.8314744
## 152                    Valley            Unknown                   0.1979701
## 153                    Temple               1959                  -0.3167521
## 154                      Lake            Unknown                  -0.3167521
## 155                 Monastery               1100                  -0.8314744
## 156             National Park               1984                   1.2274146
## 157                      Lake            Unknown                   0.1979701
## 158                    Valley            Unknown                   0.1979701
## 159                      Fort                400                   0.1979701
## 160            Tea Plantation               1950                  -0.3167521
## 161                      Lake               1400                  -0.3167521
## 162           Adventure Sport               2005                   0.1979701
## 163                  Trekking            Unknown                   3.2863035
## 164                 Gurudwara               1980                  -0.8314744
## 165                 Viewpoint            Unknown                   0.1979701
## 166                    Valley            Unknown                   0.1979701
## 167                      Lake            Unknown                   0.7126923
## 168                Ski Resort               1975                   3.2863035
## 169                      Lake            Unknown                  -0.3167521
## 170         Suspension Bridge               1939                  -0.8314744
## 171                      Ghat            Unknown                  -0.8314744
## 172                      Cave            Unknown                  -0.3167521
## 173                 Waterfall            Unknown                  -0.3167521
## 174                Ski Resort               1990                   1.2274146
## 175                    Temple               -820                  -0.8314744
## 176        Wildlife Sanctuary               1988                   0.1979701
## 177                   Orchard               1868                  -0.8314744
## 178             National Park               1936                   1.2274146
## 179                    Temple               1751                  -0.8314744
## 180                    Temple                751                   0.1979701
## 181             National Park               1982                   3.2863035
## 182                 Mausoleum               1632                   0.1979701
## 183                    Temple            Unknown                  -0.8314744
## 184                  Monument               1784                  -0.3167521
## 185                    Temple            Unknown                  -0.8314744
## 186            Religious Site            Unknown                  -0.8314744
## 187                    Temple               1864                  -0.8314744
## 188                Confluence            Unknown                  -0.8314744
## 189                      Fort               1613                  -0.3167521
## 190                  Monument               -500                  -0.8314744
## 191                  Monument               1571                   0.1979701
## 192            Bird Sanctuary               1990                  -0.3167521
## 193                      Fort               1524                  -0.8314744
## 194                    Temple            Unknown                  -0.8314744
## 195                       Zoo               1971                   0.1979701
## 196                      Lake            Unknown                   0.1979701
## 197                      Lake            Unknown                   0.1979701
## 198                    Valley            Unknown                   0.1979701
## 199                    Temple            Unknown                   3.2863035
## 200                      Hill            Unknown                   0.1979701
## 201                    Temple            Unknown                   4.3157480
## 202                 Monastery               1430                  -0.3167521
## 203                    Valley            Unknown                   0.1979701
## 204              War Memorial                 24                  -0.8314744
## 205                 Monastery               1351                  -0.8314744
## 206             National Park               1981                   1.2274146
## 207             National Park               1981                   2.2568591
## 208              War Memorial            Unknown                  -0.8314744
## 209              Gravity Hill            Unknown                  -1.3461966
## 210                      Hill            Unknown                  -0.8314744
## 211                 Monastery               1430                  -0.3167521
## 212                    Temple               2012                  -0.3167521
## 213                  Memorial               1950                  -0.8314744
## 214                   Village            Unknown                  -0.8314744
## 215                    Temple            Unknown                  -0.8314744
## 216             Sunrise Point            Unknown                  -0.8314744
## 217        Wildlife Sanctuary               1941                   1.2274146
## 218             National Park               1984                   2.2568591
## 219                     Beach            Unknown                  -0.3167521
## 220                    Palace               1837                  -0.3167521
## 221                    Temple            Unknown                  -1.3461966
## 222                    Temple               1814                  -1.3461966
## 223             National Park               1949                   1.2274146
## 224                    Palace               1887                  -0.8314744
## 225                      Hill            Unknown                   0.7126923
## 226                    Temple       12th century                   0.1979701
## 227                    Temple               1250                  -0.3167521
## 228                    Temple       11th century                  -0.8314744
## 229                 Waterfall            Unknown                  -0.3167521
## 230                      Fort               -987                  -0.8314744
## 231                       Dam               1957                  -0.8314744
## 232                      Lake            Unknown                   0.1979701
## 233                    Temple            Ancient                  -0.8314744
## 234                 Waterfall            Unknown                  -0.8314744
## 235                     Beach            Unknown                  -0.3167521
## 236                 Waterfall            Unknown                  -0.8314744
## 237                     Beach            Unknown                  -0.3167521
## 238                    Temple     6th century AD                   0.1979701
## 239                    Temple       12th century                  -0.3167521
## 240                  Memorial               1970                  -0.8314744
## 241                      Lake               1824                  -0.8314744
## 242                    Temple       12th century                  -0.8314744
## 243                      Lake               1863                   0.1979701
## 244                    Temple                110                  -0.3167521
## 245                    Temple        7th century                  -0.8314744
## 246                      Lake            Unknown                  -0.8314744
## 247                    Temple        7th century                  -0.8314744
## 248                    Temple       10th century                  -0.8314744
## 249                    Temple            Unknown                  -0.8314744
## 250                     Beach            Unknown                  -0.3167521
## 251                    Temple       14th century                  -0.8314744
## 252                      Hill            Unknown                   0.1979701
## 253                      Site       16th century                  -0.3167521
## 254                      Cave            Unknown                  -0.3167521
## 255                    Temple            Unknown                  -0.8314744
## 256            Bird Sanctuary            Unknown                  -0.8314744
## 257                      Fort       12th century                  -0.3167521
## 258          Spiritual Center               1950                  -0.8314744
## 259                    Temple                198                  -0.8314744
## 260                      Hill            Unknown                   0.1979701
## 261                    Museum                 22                  -0.8314744
## 262                      Cave            Unknown                   0.1979701
## 263              War Memorial            Unknown                  -0.8314744
## 264                       Zoo               1977                   0.1979701
## 265                  Aquarium            Unknown                  -0.8314744
## 266                    Museum               1991                  -0.8314744
## 267                      Hill            Unknown                   0.1979701
## 268                 Monastery               1705                  -0.8314744
## 269         Religious Complex                211                   0.1979701
## 270                 Monastery              1960s                  -0.8314744
## 271                      Park                213                  -0.8314744
## 272                    Temple               1967                  -0.8314744
## 273                      Lake            Unknown                   0.1979701
## 274                    Temple            Unknown                   0.1979701
## 275             National Park               1905                   1.2274146
## 276                    Island            Unknown                  -0.8314744
## 277                    Temple               1734                  -0.8314744
## 278              River Island            Unknown                   0.1979701
## 279             National Park               1990                   1.2274146
## 280                    Temple            Unknown                  -0.8314744
## 281        Wildlife Sanctuary               1987                   0.1979701
## 282                 Monastery               1680                   0.1979701
## 283                    Palace               1901                  -0.3167521
## 284                      Lake            Unknown                  -0.8314744
## 285             Rock Carvings                700                  -0.3167521
## 286                 Waterfall            Unknown                  -0.3167521
## 287                    Valley            Unknown                   1.2274146
## 288                     Beach            Unknown                  -0.8314744
## 289                  Township               1968                   0.1979701
## 290                     Beach            Unknown                  -0.8314744
## 291                  Landmark               1906                  -0.3167521
## 292                     Beach            Unknown                  -0.8314744
## 293                     Beach            Unknown                  -0.8314744
## 294           Natural Feature            Unknown                  -0.3167521
## 295                      Cave            Unknown                  -0.8314744
## 296                      Fort               1535                  -0.3167521
## 297                    Temple            Unknown                  -0.8314744
## 298                    Temple            Unknown                  -0.8314744
## 299                    Temple               -260                  -0.3167521
## 300                       Zoo            Unknown                   0.7126923
## 301                 Gurudwara            Unknown                  -0.8314744
## 302                      Park            Unknown                  -0.8314744
## 303             Entertainment               2010                   1.2274146
## 304                      Mall            Unknown                   0.1979701
## 305        Commercial Complex            Unknown                   0.1979701
## 306                 Gurudwara            Unknown                  -0.8314744
## 307                    Temple            Unknown                  -0.3167521
## 308                      Mall               2016                   0.1979701
## 309                      Mall            Unknown                   0.1979701
## 310            Amusement Park               2005                   2.2568591
## 311                       Zoo               1960                   1.2274146
## 312                      Mall               2012                   0.1979701
## 313                      Mall               2004                   0.1979701
## 314                    Mosque               1656                  -0.8314744
## 315                    Temple            Unknown                  -0.3167521
## 316                Race Track               2011                   0.1979701
## 317                      Mall               2020                   0.1979701
## 318                      Mall               2013                   1.2274146
## 319                    Museum               1977                   0.1979701
## 320           Natural Feature            Unknown                   0.1979701
## 321                    Temple               1992                   1.2274146
## 322                      Fort               1565                   0.1979701
## 323                    Museum               2013                   0.1979701
## 324                    Palace               1727                   0.1979701
## 325                    Museum               1887                   0.1979701
##     Google.review.rating
## 1             0.41461943
## 2             0.05042669
## 3             0.41461943
## 4            -1.40634427
## 5            -1.04215153
## 6            -1.04215153
## 7             0.05042669
## 8             0.05042669
## 9            -1.04215153
## 10            0.41461943
## 11           -1.40634427
## 12            0.05042669
## 13            0.05042669
## 14           -1.40634427
## 15            0.05042669
## 16           -0.31376605
## 17            0.05042669
## 18            0.41461943
## 19            0.41461943
## 20           -0.67795879
## 21            1.14300491
## 22            0.77881217
## 23           -0.31376605
## 24           -0.67795879
## 25           -0.67795879
## 26           -0.67795879
## 27          -11.23954827
## 28           -1.04215153
## 29           -0.31376605
## 30           -0.31376605
## 31            0.41461943
## 32            0.41461943
## 33            0.05042669
## 34           -0.31376605
## 35           -0.67795879
## 36           -0.31376605
## 37           -0.31376605
## 38           -0.31376605
## 39            0.77881217
## 40           -0.31376605
## 41           -1.04215153
## 42           -1.40634427
## 43            0.41461943
## 44            0.41461943
## 45            0.41461943
## 46            0.77881217
## 47           -0.31376605
## 48           -1.40634427
## 49           -0.67795879
## 50           -0.31376605
## 51            0.77881217
## 52           -0.31376605
## 53           -0.31376605
## 54            0.05042669
## 55           -1.04215153
## 56            0.41461943
## 57           -0.31376605
## 58           -1.04215153
## 59            0.05042669
## 60            0.05042669
## 61            0.41461943
## 62            0.41461943
## 63           -0.67795879
## 64           -1.04215153
## 65            0.05042669
## 66           -2.13472976
## 67            0.41461943
## 68            0.77881217
## 69            0.05042669
## 70            0.41461943
## 71           -0.31376605
## 72            1.14300491
## 73            1.50719765
## 74            0.41461943
## 75            0.05042669
## 76            0.41461943
## 77           -0.31376605
## 78            0.05042669
## 79           -0.31376605
## 80           -0.31376605
## 81           -0.31376605
## 82           -0.31376605
## 83            0.41461943
## 84           -0.31376605
## 85            0.41461943
## 86            0.41461943
## 87            0.41461943
## 88            0.41461943
## 89            0.05042669
## 90            0.41461943
## 91            0.05042669
## 92            0.41461943
## 93            1.50719765
## 94            1.14300491
## 95            1.14300491
## 96            0.05042669
## 97            0.05042669
## 98           -0.67795879
## 99           -0.31376605
## 100           0.77881217
## 101          -2.13472976
## 102           0.05042669
## 103          -0.67795879
## 104          -2.49892250
## 105           0.41461943
## 106           0.05042669
## 107          -0.31376605
## 108          -0.31376605
## 109           0.05042669
## 110          -0.31376605
## 111           0.41461943
## 112           0.41461943
## 113           0.77881217
## 114          -1.40634427
## 115           0.05042669
## 116           0.05042669
## 117           0.41461943
## 118           0.41461943
## 119           0.05042669
## 120           0.77881217
## 121           0.05042669
## 122          -0.31376605
## 123           0.77881217
## 124          -0.31376605
## 125           0.41461943
## 126          -1.40634427
## 127           0.77881217
## 128          -1.04215153
## 129           0.77881217
## 130           0.05042669
## 131           1.14300491
## 132          -0.31376605
## 133           0.41461943
## 134          -0.31376605
## 135          -0.31376605
## 136           0.77881217
## 137           0.77881217
## 138           0.77881217
## 139          -0.31376605
## 140           0.05042669
## 141           1.14300491
## 142           0.05042669
## 143           0.41461943
## 144           0.05042669
## 145           0.05042669
## 146           1.14300491
## 147          -2.13472976
## 148           0.41461943
## 149          -0.31376605
## 150          -0.31376605
## 151           0.77881217
## 152          -1.40634427
## 153           0.77881217
## 154           0.05042669
## 155           1.14300491
## 156           0.05042669
## 157          -0.31376605
## 158           0.05042669
## 159          -0.31376605
## 160           0.41461943
## 161           0.41461943
## 162           1.14300491
## 163           1.14300491
## 164           0.41461943
## 165           0.05042669
## 166           0.77881217
## 167          -0.31376605
## 168          -2.49892250
## 169          -1.04215153
## 170          -0.31376605
## 171           0.05042669
## 172           0.05042669
## 173          -1.04215153
## 174           0.05042669
## 175           1.14300491
## 176          -0.67795879
## 177          -1.77053702
## 178          -0.31376605
## 179           1.14300491
## 180           1.14300491
## 181           0.77881217
## 182           0.41461943
## 183           0.77881217
## 184          -0.31376605
## 185           0.77881217
## 186           1.14300491
## 187           1.14300491
## 188           0.05042669
## 189          -0.31376605
## 190           0.41461943
## 191          -0.31376605
## 192          -0.67795879
## 193          -1.40634427
## 194           1.14300491
## 195          -1.04215153
## 196           0.41461943
## 197           1.50719765
## 198           0.41461943
## 199           0.77881217
## 200          -1.40634427
## 201           0.05042669
## 202           0.77881217
## 203           0.05042669
## 204           1.14300491
## 205           0.77881217
## 206          -0.67795879
## 207          -0.31376605
## 208           1.14300491
## 209          -2.86311524
## 210           0.05042669
## 211           0.77881217
## 212           1.14300491
## 213           1.14300491
## 214          -1.40634427
## 215           1.14300491
## 216           0.05042669
## 217          -0.31376605
## 218          -0.31376605
## 219           0.05042669
## 220           0.05042669
## 221           0.77881217
## 222           0.41461943
## 223          -0.31376605
## 224           0.05042669
## 225           0.05042669
## 226           0.77881217
## 227           0.77881217
## 228           0.41461943
## 229           0.05042669
## 230           0.05042669
## 231           0.05042669
## 232          -2.13472976
## 233           0.41461943
## 234          -0.67795879
## 235          -1.04215153
## 236          -0.31376605
## 237          -2.13472976
## 238           0.77881217
## 239           0.41461943
## 240           0.41461943
## 241          -1.40634427
## 242           0.77881217
## 243          -2.13472976
## 244           1.14300491
## 245           0.41461943
## 246          -1.04215153
## 247           0.41461943
## 248           0.77881217
## 249           0.77881217
## 250           0.05042669
## 251           0.77881217
## 252          -0.67795879
## 253           0.41461943
## 254          -0.31376605
## 255           0.77881217
## 256          -0.31376605
## 257           0.05042669
## 258           0.77881217
## 259           0.77881217
## 260           0.05042669
## 261           0.41461943
## 262           0.05042669
## 263           0.41461943
## 264          -1.40634427
## 265          -2.49892250
## 266          -0.67795879
## 267          -0.67795879
## 268           0.41461943
## 269           0.77881217
## 270           0.41461943
## 271           1.14300491
## 272           0.77881217
## 273           0.05042669
## 274           0.41461943
## 275           0.05042669
## 276          -1.40634427
## 277           0.77881217
## 278           0.77881217
## 279           0.41461943
## 280           0.05042669
## 281          -0.31376605
## 282           0.77881217
## 283           0.05042669
## 284           0.05042669
## 285           0.05042669
## 286           0.41461943
## 287           0.77881217
## 288           0.05042669
## 289          -1.40634427
## 290           0.05042669
## 291           0.77881217
## 292           1.14300491
## 293           0.05042669
## 294          -0.31376605
## 295           0.05042669
## 296           0.41461943
## 297           0.77881217
## 298           0.41461943
## 299           0.77881217
## 300          -0.67795879
## 301           0.77881217
## 302          -0.31376605
## 303          -0.31376605
## 304           0.41461943
## 305           0.77881217
## 306           1.14300491
## 307           1.14300491
## 308           0.41461943
## 309          -1.04215153
## 310           0.05042669
## 311          -0.31376605
## 312           0.05042669
## 313           0.05042669
## 314           0.05042669
## 315           0.77881217
## 316           0.41461943
## 317           0.41461943
## 318           0.41461943
## 319          -0.31376605
## 320           0.41461943
## 321           0.41461943
## 322           0.05042669
## 323           0.77881217
## 324          -0.31376605
## 325           0.05042669
library(caret)
pre_procesamiento <- preProcess(viajes[,4:9], method = "range") # Asi por defecto muestra la estandarizacion z
predict(pre_procesamiento, viajes[,4:9])
##                   City                                           Name
## 1                Delhi                                     India Gate
## 2                Delhi                                 Humayun's Tomb
## 3                Delhi                              Akshardham Temple
## 4                Delhi                           Waste to Wonder Park
## 5                Delhi                                  Jantar Mantar
## 6                Delhi                                  Chandni Chowk
## 7                Delhi                                   Lotus Temple
## 8                Delhi                                       Red Fort
## 9                Delhi                               Agrasen ki Baoli
## 10               Delhi                                 Sunder Nursery
## 11               Delhi                          Garden of Five Senses
## 12               Delhi                                   Lodhi Garden
## 13               Delhi                 National Gallery of Modern Art
## 14               Delhi                      National Zoological Park 
## 15               Delhi                                    Qutub Minar
## 16               Delhi                        National Science Centre
## 17              Mumbai                                   Marine Drive
## 18              Mumbai                               Gateway of India
## 19              Mumbai Chhatrapati Shivaji Maharaj Vastu Sangrahalaya
## 20              Mumbai                    Sanjay Gandhi National Park
## 21              Mumbai                           Siddhivinayak Temple
## 22              Mumbai                               Mahalaxmi Temple
## 23              Mumbai                                Haji Ali Dargah
## 24              Mumbai                                Chowpatty Beach
## 25              Mumbai                                    Essel World
## 26              Mumbai                                Elephanta Caves
## 27            Lonavala                                       Imagicaa
## 28           Bangalore                               Bangalore Palace
## 29           Bangalore                       Lalbagh Botanical Garden
## 30           Bangalore                                    Cubbon Park
## 31           Bangalore                                 Vidhana Soudha
## 32           Bangalore                        ISKCON Temple Bangalore
## 33           Hyderabad                                      Charminar
## 34           Hyderabad                                  Golconda Fort
## 35           Hyderabad                             Hussain Sagar Lake
## 36           Hyderabad                               Ramoji Film City
## 37           Hyderabad                              Salar Jung Museum
## 38           Hyderabad                               Qutb Shahi Tombs
## 39           Hyderabad                                   Birla Mandir
## 40           Hyderabad                             Chowmahalla Palace
## 41           Hyderabad                          Nehru Zoological Park
## 42           Hyderabad                                   Lumbini Park
## 43             Kolkata                              Victoria Memorial
## 44             Kolkata                                  Howrah Bridge
## 45             Kolkata                                  Indian Museum
## 46             Kolkata                       Dakshineswar Kali Temple
## 47             Kolkata                           Kalighat Kali Temple
## 48             Kolkata                                   Eden Gardens
## 49             Kolkata                     Alipore Zoological Gardens
## 50             Kolkata                           Science City Kolkata
## 51             Kolkata                                     Belur Math
## 52             Kolkata                                  Marble Palace
## 53                 Goa                                Calangute Beach
## 54                 Goa                          Basilica of Bom Jesus
## 55                 Goa                                    Fort Aguada
## 56                 Goa                                Dudhsagar Falls
## 57                 Goa                                   Anjuna Beach
## 58                 Goa                                   Chapora Fort
## 59                 Goa                                   Se Cathedral
## 60                 Goa                                     Baga Beach
## 61                 Goa                                  Arambol Beach
## 62                 Goa                                  Palolem Beach
## 63                 Goa                                    Colva Beach
## 64                 Goa                                  Miramar Beach
## 65                 Goa                                   Aguada Beach
## 66                 Goa                    Dr. Salim Ali Bird Santuary
## 67           Ahmedabad                               Sabarmati Ashram
## 68              Dwarka                             Dwarkadhish Temple
## 69            Junagadh                              Gir National Park
## 70                Bhuj                                   White Desert
## 71            Vadodara                             Laxmi Vilas Palace
## 72             Somnath                                 Somnath Temple
## 73       Rann of Kutch                                     Rann Utsav
## 74             Kevadia                                Statue of Unity
## 75         Gandhinagar                                    Dandi Kutir
## 76           Ahmedabad                           Sabarmati Riverfront
## 77           Ahmedabad                                    Manek Chowk
## 78           Ahmedabad                                  Kankaria Lake
## 79           Ahmedabad                                   Science City
## 80              Jaipur                                     Hawa Mahal
## 81             Udaipur                                    City Palace
## 82           Jaisalmer                                 Jaisalmer Fort
## 83      Sawai Madhopur                      Ranthambore National Park
## 84             Pushkar                                   Pushkar Lake
## 85               Ajmer                            Ajmer Sharif Dargah
## 86             Jodhpur                                Mehrangarh Fort
## 87         Chittorgarh                               Chittorgarh Fort
## 88           Mount Abu                                Dilwara Temples
## 89             Bikaner                                  Junagarh Fort
## 90              Jaipur                                     Amber Fort
## 91              Jaipur                                   Jaigarh Fort
## 92             Udaipur                                   Lake Pichola
## 93            Amritsar                Golden Temple (Harmandir Sahib)
## 94            Amritsar                               Jallianwala Bagh
## 95            Amritsar                                   Wagah Border
## 96          Chandigarh                                    Rock Garden
## 97           Alappuzha                                Alappuzha Beach
## 98              Munnar                             Munnar Tea Gardens
## 99               Kochi                                     Fort Kochi
## 100 Thiruvananthapuram                         Padmanabhaswamy Temple
## 101          Kozhikode                                Kozhikode Beach
## 102            Wayanad                     Wayanad Wildlife Sanctuary
## 103           Thekkady                          Periyar National Park
## 104          Kumarakom                       Kumarakom Bird Sanctuary
## 105            Varkala                                  Varkala Beach
## 106              Bekal                                     Bekal Fort
## 107            Kovalam                                  Kovalam Beach
## 108             Kannur                                St. Angelo Fort
## 109      Nelliyampathy                         Seethargundu Viewpoint
## 110              Kochi                         Kerala Folklore Museum
## 111              Kochi                        Wonderla Amusement Park
## 112             Mysore                                  Mysore Palace
## 113              Hampi                     Hampi Archaeological Ruins
## 114              Coorg                                    Abbey Falls
## 115            Gokarna                                       Om Beach
## 116        Chikmagalur                                  Mullayanagiri
## 117             Badami                            Badami Cave Temples
## 118         Shivamogga                                      Jog Falls
## 119          Mangalore                                 Panambur Beach
## 120        Murudeshwar                             Murudeshwar Temple
## 121            Bijapur                                     Gol Gumbaz
## 122           Bandipur                         Bandipur National Park
## 123           Halebidu                   Halebidu Hoysaleswara Temple
## 124               Pune                                  Shaniwar Wada
## 125         Aurangabad                                   Ajanta Caves
## 126             Nashik                                 Sula Vineyards
## 127             Shirdi                                Sai Baba Temple
## 128            Alibaug                                  Alibaug Beach
## 129          Ratnagiri                            Ganapatipule Temple
## 130             Nagpur                                  Deekshabhoomi
## 131           Kolhapur                             Mahalakshmi Temple
## 132           Lonavala                                    Karla Caves
## 133           Tarkarli                                 Tarkarli Beach
## 134             Satara                                   Kaas Plateau
## 135           Matheran                                     Echo Point
## 136             Ajanta                                   Ellora Caves
## 137          Khajuraho                   Khajuraho Group of Monuments
## 138             Bhopal                                   Sanchi Stupa
## 139             Indore                                 Rajwada Palace
## 140            Gwalior                                   Gwalior Fort
## 141             Ujjain                      Mahakaleshwar Jyotirlinga
## 142           Jabalpur                                Dhuandhar Falls
## 143          Pachmarhi                                      Bee Falls
## 144              Kanha                            Kanha National Park
## 145        Bandhavgarh                      Bandhavgarh National Park
## 146             Orchha                                    Orchha Fort
## 147              Mandu                                    Jahaz Mahal
## 148          Bhimbetka                        Bhimbetka Rock Shelters
## 149         Amarkantak                           Narmada Udgam Temple
## 150         Chitrakoot                               Chitrakoot Falls
## 151             Shimla                                      The Ridge
## 152             Manali                                  Solang Valley
## 153          dalhousie                              Dalai Lama Temple
## 154          Dalhousie                                  Khajjiar Lake
## 155       Spiti Valley                                  Key Monastery
## 156              Kullu                  Great Himalayan National Park
## 157             Chamba                                   Chamera Lake
## 158            Kinnaur                                  Sangla Valley
## 159             Kangra                                    Kangra Fort
## 160           Palampur                                    Tea Gardens
## 161              Mandi                                   Prashar Lake
## 162        Bir Billing                               Paragliding Site
## 163        McLeod Ganj                                    Triund Trek
## 164          Manikaran                                Manikaran Sahib
## 165           Narkanda                                      Hatu Peak
## 166              Barot                                   Barot Valley
## 167              Shoja                                  Serolsar Lake
## 168              Kufri                                Kufri Fun World
## 169           Nainital                                     Naini Lake
## 170          Rishikesh                                   Laxman Jhula
## 171           Haridwar                                   Har Ki Pauri
## 172           Dehradun                                  Robber's Cave
## 173          Mussoorie                                   Kempty Falls
## 174               Auli                                Auli Ski Resort
## 175          Badrinath                               Badrinath Temple
## 176             Almora                      Binsar Wildlife Sanctuary
## 177           Ranikhet                              Chaubatia Gardens
## 178        Jim Corbett                      Jim Corbett National Park
## 179         Uttarkashi                                Gangotri Temple
## 180             Chopta                                Tungnath Temple
## 181          Joshimath                              Valley of Flowers
## 182               Agra                                      Taj Mahal
## 183           Varanasi                        Kashi Vishwanath Temple
## 184            Lucknow                                  Bara Imambara
## 185            Mathura                            Krishna Janmabhoomi
## 186            Ayodhya                                Ram Janmabhoomi
## 187          Vrindavan                            Banke Bihari Temple
## 188          Allahabad                                 Triveni Sangam
## 189             Jhansi                                    Jhansi Fort
## 190            Sarnath                                   Dhamek Stupa
## 191     Fatehpur Sikri                                 Buland Darwaza
## 192              Noida                           Okhla Bird Sanctuary
## 193            Aligarh                                   Aligarh Fort
## 194             Meerut                               Augarnath Temple
## 195             Kanpur                               Allen Forest Zoo
## 196           Srinagar                                       Dal Lake
## 197                Leh                                    Pangong Tso
## 198           Pahalgam                                  Betaab Valley
## 199              Jammu                                   Vaishno Devi
## 200           Udhampur                                Patnitop Height
## 201           Anantnag                                  Amarnath Cave
## 202                Leh                              Thiksey Monastery
## 203       Nubra Valley                                   Nubra Valley
## 204             Kargil                            Kargil War Memorial
## 205             Diskit                               Diskit Monastery
## 206           Kishtwar                         Kishtwar National Park
## 207              Hemis                            Hemis National Park
## 208               Dras                              Dras War Memorial
## 209                Leh                                  Magnetic Hill
## 210                Leh                               Khardung La Pass
## 211                Leh                              Thiksey Monastery
## 212          Vrindavan                                    Prem Mandir
## 213          Porbandar                                   Kirti Mandir
## 214            Mathura                                      Nand Gaon
## 215            Mathura                                 Barsana Mandir
## 216         Darjeeling                                     Tiger Hill
## 217           Siliguri                        Jaldapara National Park
## 218         Sundarbans                       Sundarbans National Park
## 219              Digha                                    Digha Beach
## 220        Murshidabad                              Hazarduari Palace
## 221             Bolpur                             Kankalitala Temple
## 222            Hooghly                             Hangseswari Temple
## 223         Jalpaiguri                         Gorumara National Park
## 224        Cooch Behar                             Cooch Behar Palace
## 225            Purulia                                  Ayodhya Hills
## 226               Puri                               Jagannath Temple
## 227             Konark                                     Sun Temple
## 228        Bhubaneswar                                Lingaraj Temple
## 229           Rourkela                           Khandadhar Waterfall
## 230            Cuttack                                  Barabati Fort
## 231          Sambalpur                                    Hirakud Dam
## 232            Chilika                                   Chilika Lake
## 233          Berhampur                             Tara Tarini Temple
## 234           Keonjhar                          Badaghagara Waterfall
## 235           Balasore                                Chandipur Beach
## 236          Kendujhar                          Sanaghagara Waterfall
## 237            Chennai                                   Marina Beach
## 238            Madurai                         Meenakshi Amman Temple
## 239         Rameswaram                          Ramanathaswamy Temple
## 240        Kanyakumari                      Vivekananda Rock Memorial
## 241               Ooty                                      Ooty Lake
## 242         Coimbatore                             Marudamalai Temple
## 243         Kodaikanal                                Kodaikanal Lake
## 244          Thanjavur                          Brihadeeswarar Temple
## 245      Mahabalipuram                                   Shore Temple
## 246            Yercaud                                   Yercaud Lake
## 247        Tirunelveli                             Nellaiappar Temple
## 248        Chidambaram                                Nataraja Temple
## 249         Vijayawada                            Kanaka Durga Temple
## 250      Visakhapatnam                               Rishikonda Beach
## 251          Srisailam                      Mallikarjuna Swamy Temple
## 252        Rajahmundry                                    Papikondalu
## 253          Anantapur                                       Lepakshi
## 254            Kurnool                                    Belum Caves
## 255           Amravati                              Amaravathi Temple
## 256             Guntur                      Uppalapadu Bird Sanctuary
## 257             Kadapa                                 Gandikota Fort
## 258        Puttaparthi                              Prasanthi Nilayam
## 259       Vizianagaram                             Simhachalam Temple
## 260      Visakhapatnam                                    Kailasagiri
## 261      Visakhapatnam                               Submarine Museum
## 262      Visakhapatnam                                    Borra Caves
## 263      Visakhapatnam                                   War Memorial
## 264      Visakhapatnam                  Indira Gandhi Zoological Park
## 265      Visakhapatnam                        Matsyadarshini Aquarium
## 266      Visakhapatnam                                 Visakha Museum
## 267            Gangtok                                   Nathula Pass
## 268            Pelling                          Pemayangtse Monastery
## 269             Namchi                                      Char Dham
## 270            Gangtok                               Rumtek Monastery
## 271           Ravangla                                    Buddha Park
## 272            Gangtok                    Baba Harbhajan Singh Temple
## 273            Gangtok                                    Tsomgo Lake
## 274           Guwahati                                Kamakhya Temple
## 275          Kaziranga                        Kaziranga National Park
## 276           Guwahati                                Umananda Island
## 277          Sivasagar                              Sivasagar Sivadol
## 278             Majuli                                  Majuli Island
## 279              Manas                            Manas National Park
## 280               Hajo                       Hayagriva Madhava Temple
## 281           Guwahati                    Pobitora Wildlife Sanctuary
## 282             Tawang                               Tawang Monastery
## 283           Agartala                               Ujjayanta Palace
## 284            Dumboor                                   Dumboor Lake
## 285            Unakoti                          Unakoti Rock Carvings
## 286             Bastar                               Chitrakote Falls
## 287      Dzükou Valley                                  Dzükou Valley
## 288         Puducherry                                Promenade Beach
## 289          Auroville                                      Auroville
## 290         Puducherry                                 Paradise Beach
## 291         Port Blair                                  Cellular Jail
## 292    Havelock Island                               Radhanagar Beach
## 293        Neil Island                                Bharatpur Beach
## 294    Baratang Island                                Limestone Caves
## 295                Diu                                    Naida Caves
## 296                Diu                                       Diu Fort
## 297            Deoghar                         Baba Baidyanath Temple
## 298             Ranchi                                  Pahari Mandir
## 299          Bodh Gaya                               Mahabodhi Temple
## 300              Patna                  Sanjay Gandhi Biological Park
## 301              Patna          Takhat Shri Harimandir Ji Patna Sahib
## 302              Patna                             Budhha Smriti Park
## 303           Gurugram                              Kingdom of Dreams
## 304           Gurugram                                  Ambience Mall
## 305           Gurugram                                   DLF CyberHub
## 306          New Delhi                         Gurudwara Bangla Sahib
## 307          Kedarnath                                      Kedarnath
## 308              Noida                              DLF Mall of India
## 309      Greater Noida                          The Grand Venice Mall
## 310          Bengaluru                        Wonderla Amusement Park
## 311        Bhubaneswar                    Nandankanan Zoological Park
## 312          Bengaluru                                     Orion Mall
## 313          Hyderabad                         Inorbit Mall Cyberabad
## 314          New Delhi                                    Jama Masjid
## 315         Rameswaram                          Ramanathaswamy Temple
## 316      Greater Noida                    Buddh International Circuit
## 317            Lucknow                               Phoenix Palassio
## 318              Kochi               LuLu International Shopping Mall
## 319          New Delhi                                    Rail Museum
## 320        Cherrapunji                             Living Root Bridge
## 321        Gandhinagar                                     Akshardham
## 322               Agra                                      Agra Fort
## 323             Bhopal                   Madhya Pradesh Tribal Museum
## 324             Jaipur                                    City Palace
## 325             Jaipur                             Albert Hall Museum
##                          Type Establishment.Year time.needed.to.visit.in.hrs
## 1                War Memorial               1921                  0.00000000
## 2                        Tomb               1572                  0.23076923
## 3                      Temple               2005                  0.69230769
## 4                  Theme Park               2019                  0.23076923
## 5                 Observatory               1724                  0.23076923
## 6                      Market               1700                  0.38461538
## 7                      Temple               1986                  0.07692308
## 8                        Fort               1648                  0.23076923
## 9                    Stepwell               1400                  0.07692308
## 10                       Park               1600                  0.23076923
## 11                       Park               2003                  0.23076923
## 12                       Park               1500                  0.07692308
## 13                     Museum               1954                  0.38461538
## 14                        Zoo               1959                  0.38461538
## 15                   Monument               1192                  0.07692308
## 16                    Science               1992                  0.69230769
## 17                  Promenade            Unknown                  0.23076923
## 18                   Monument               1924                  0.07692308
## 19                     Museum               1922                  0.07692308
## 20              National Park               1996                  0.38461538
## 21                     Temple               1881                  0.23076923
## 22                     Temple               1831                  0.07692308
## 23           Religious Shrine               1431                  0.23076923
## 24                      Beach            Unknown                  0.23076923
## 25             Amusement Park               1986                  0.69230769
## 26                   Monument               1987                  0.53846154
## 27             Amusement Park               2013                  0.69230769
## 28                     Palace               1878                  0.23076923
## 29           Botanical Garden               1760                  0.15384615
## 30                       Park               1870                  0.07692308
## 31        Government Building               1956                  0.00000000
## 32                     Temple               1997                  0.07692308
## 33                   Landmark               1591                  0.07692308
## 34                       Fort               1600                  0.23076923
## 35                       Lake               1563                  0.07692308
## 36                Film Studio               1996                  0.53846154
## 37                     Museum               1951                  0.23076923
## 38                      Tombs               1600                  0.07692308
## 39                     Temple               1976                  0.07692308
## 40                     Palace               1800                  0.15384615
## 41                        Zoo               1963                  0.38461538
## 42                       Park               1994                  0.07692308
## 43                     Museum               1921                  0.15384615
## 44                     Bridge               1943                  0.00000000
## 45                     Museum               1814                  0.23076923
## 46                     Temple               1855                  0.07692308
## 47                     Temple               1809                  0.07692308
## 48             Cricket Ground               1864                  0.38461538
## 49                        Zoo               1876                  0.23076923
## 50                    Science               1997                  0.38461538
## 51                       Site               1898                  0.15384615
## 52                     Palace               1835                  0.07692308
## 53                      Beach            Unknown                  0.23076923
## 54                     Church               1605                  0.07692308
## 55                       Fort               1612                  0.15384615
## 56                  Waterfall            Unknown                  0.38461538
## 57                      Beach            Unknown                  0.23076923
## 58                       Fort               1617                  0.07692308
## 59                     Church               1640                  0.07692308
## 60                      Beach            Unknown                  0.23076923
## 61                      Beach            Unknown                  0.23076923
## 62                      Beach            Unknown                  0.23076923
## 63                      Beach            Unknown                  0.23076923
## 64                      Beach            Unknown                  0.15384615
## 65                      Beach            Unknown                  0.23076923
## 66             Bird Sanctuary               1988                  0.23076923
## 67                 Historical               1915                  0.15384615
## 68                     Temple               -400                  0.23076923
## 69              National Park               1965                  0.38461538
## 70                       Site               1950                  0.30769231
## 71                     Palace               1890                  0.23076923
## 72                     Temple               1951                  0.23076923
## 73                   Cultural            Unknown                  0.38461538
## 74                   Monument               2018                  0.38461538
## 75                     Museum               2013                  0.15384615
## 76  Urban Development Project               2012                  0.07692308
## 77                     Market            Unknown                  0.23076923
## 78                       Lake               1451                  0.38461538
## 79                    Science               2002                  1.00000000
## 80                     Palace               1799                  0.07692308
## 81                     Palace               1559                  0.23076923
## 82                       Fort               1156                  0.30769231
## 83         Wildlife Sanctuary               1980                  0.38461538
## 84                     Temple               1400                  0.15384615
## 85                     Shrine               1236                  0.07692308
## 86                       Fort               1459                  0.23076923
## 87                       Fort                700                  0.23076923
## 88                     Temple               1100                  0.07692308
## 89                       Fort               1589                  0.23076923
## 90                       Fort               1592                  0.23076923
## 91                       Fort               1726                  0.15384615
## 92                       Lake               1362                  0.07692308
## 93             Religious Site               1604                  0.15384615
## 94                   Memorial               1951                  0.07692308
## 95            Border Crossing               1950                  0.23076923
## 96           Sculpture Garden               1976                  0.23076923
## 97                      Beach            Unknown                  0.15384615
## 98                Scenic Area            Unknown                  0.23076923
## 99                       Site               1503                  0.07692308
## 100                    Temple            Unknown                  0.07692308
## 101                     Beach            Unknown                  0.15384615
## 102        Wildlife Sanctuary            Unknown                  0.38461538
## 103             National Park               1982                  0.38461538
## 104            Bird Sanctuary               1972                  0.23076923
## 105                     Beach            Unknown                  0.23076923
## 106                      Fort               1650                  0.15384615
## 107                     Beach            Unknown                  0.23076923
## 108                      Fort               1505                  0.07692308
## 109                 Viewpoint            Unknown                  0.07692308
## 110                  Cultural               2009                  0.15384615
## 111            Amusement Park               2016                  0.76923077
## 112                    Palace               1912                  0.23076923
## 113                      Site            Unknown                  0.38461538
## 114                 Waterfall            Unknown                  0.07692308
## 115                     Beach            Unknown                  0.23076923
## 116             Mountain Peak            Unknown                  0.38461538
## 117                      Cave                600                  0.15384615
## 118                 Waterfall               1900                  0.15384615
## 119                     Beach            Unknown                  0.15384615
## 120                    Temple            Unknown                  0.07692308
## 121                 Mausoleum               1656                  0.15384615
## 122             National Park               1974                  0.38461538
## 123                    Temple               1121                  0.07692308
## 124                      Fort               1732                  0.23076923
## 125                      Cave                200                  0.38461538
## 126                  Vineyard               1999                  0.23076923
## 127                    Temple               1922                  0.15384615
## 128                     Beach            Unknown                  0.15384615
## 129                    Temple               1600                  0.07692308
## 130                  Monument               2001                  0.07692308
## 131                    Temple                700                  0.07692308
## 132                      Cave                200                  0.15384615
## 133                     Beach            Unknown                  0.23076923
## 134                    Valley            Unknown                  0.23076923
## 135                 Viewpoint               1828                  0.15384615
## 136                      Cave                600                  0.38461538
## 137                   Temples               -850                  0.23076923
## 138                  Monument               -300                  0.15384615
## 139                    Palace               1747                  0.07692308
## 140                      Fort                900                  0.30769231
## 141                    Temple              -3500                  0.15384615
## 142                 Waterfall            Unknown                  0.07692308
## 143                 Waterfall            Unknown                  0.15384615
## 144        Wildlife Sanctuary               1955                  0.38461538
## 145             National Park               1968                  0.38461538
## 146                      Fort               1500                  0.15384615
## 147                      Site               1500                  0.07692308
## 148          Prehistoric Site               1958                  0.23076923
## 149                    Temple               1200                  0.07692308
## 150                 Waterfall            Unknown                  0.15384615
## 151              Scenic Point            Unknown                  0.07692308
## 152                    Valley            Unknown                  0.23076923
## 153                    Temple               1959                  0.15384615
## 154                      Lake            Unknown                  0.15384615
## 155                 Monastery               1100                  0.07692308
## 156             National Park               1984                  0.38461538
## 157                      Lake            Unknown                  0.23076923
## 158                    Valley            Unknown                  0.23076923
## 159                      Fort                400                  0.23076923
## 160            Tea Plantation               1950                  0.15384615
## 161                      Lake               1400                  0.15384615
## 162           Adventure Sport               2005                  0.23076923
## 163                  Trekking            Unknown                  0.69230769
## 164                 Gurudwara               1980                  0.07692308
## 165                 Viewpoint            Unknown                  0.23076923
## 166                    Valley            Unknown                  0.23076923
## 167                      Lake            Unknown                  0.30769231
## 168                Ski Resort               1975                  0.69230769
## 169                      Lake            Unknown                  0.15384615
## 170         Suspension Bridge               1939                  0.07692308
## 171                      Ghat            Unknown                  0.07692308
## 172                      Cave            Unknown                  0.15384615
## 173                 Waterfall            Unknown                  0.15384615
## 174                Ski Resort               1990                  0.38461538
## 175                    Temple               -820                  0.07692308
## 176        Wildlife Sanctuary               1988                  0.23076923
## 177                   Orchard               1868                  0.07692308
## 178             National Park               1936                  0.38461538
## 179                    Temple               1751                  0.07692308
## 180                    Temple                751                  0.23076923
## 181             National Park               1982                  0.69230769
## 182                 Mausoleum               1632                  0.23076923
## 183                    Temple            Unknown                  0.07692308
## 184                  Monument               1784                  0.15384615
## 185                    Temple            Unknown                  0.07692308
## 186            Religious Site            Unknown                  0.07692308
## 187                    Temple               1864                  0.07692308
## 188                Confluence            Unknown                  0.07692308
## 189                      Fort               1613                  0.15384615
## 190                  Monument               -500                  0.07692308
## 191                  Monument               1571                  0.23076923
## 192            Bird Sanctuary               1990                  0.15384615
## 193                      Fort               1524                  0.07692308
## 194                    Temple            Unknown                  0.07692308
## 195                       Zoo               1971                  0.23076923
## 196                      Lake            Unknown                  0.23076923
## 197                      Lake            Unknown                  0.23076923
## 198                    Valley            Unknown                  0.23076923
## 199                    Temple            Unknown                  0.69230769
## 200                      Hill            Unknown                  0.23076923
## 201                    Temple            Unknown                  0.84615385
## 202                 Monastery               1430                  0.15384615
## 203                    Valley            Unknown                  0.23076923
## 204              War Memorial                 24                  0.07692308
## 205                 Monastery               1351                  0.07692308
## 206             National Park               1981                  0.38461538
## 207             National Park               1981                  0.53846154
## 208              War Memorial            Unknown                  0.07692308
## 209              Gravity Hill            Unknown                  0.00000000
## 210                      Hill            Unknown                  0.07692308
## 211                 Monastery               1430                  0.15384615
## 212                    Temple               2012                  0.15384615
## 213                  Memorial               1950                  0.07692308
## 214                   Village            Unknown                  0.07692308
## 215                    Temple            Unknown                  0.07692308
## 216             Sunrise Point            Unknown                  0.07692308
## 217        Wildlife Sanctuary               1941                  0.38461538
## 218             National Park               1984                  0.53846154
## 219                     Beach            Unknown                  0.15384615
## 220                    Palace               1837                  0.15384615
## 221                    Temple            Unknown                  0.00000000
## 222                    Temple               1814                  0.00000000
## 223             National Park               1949                  0.38461538
## 224                    Palace               1887                  0.07692308
## 225                      Hill            Unknown                  0.30769231
## 226                    Temple       12th century                  0.23076923
## 227                    Temple               1250                  0.15384615
## 228                    Temple       11th century                  0.07692308
## 229                 Waterfall            Unknown                  0.15384615
## 230                      Fort               -987                  0.07692308
## 231                       Dam               1957                  0.07692308
## 232                      Lake            Unknown                  0.23076923
## 233                    Temple            Ancient                  0.07692308
## 234                 Waterfall            Unknown                  0.07692308
## 235                     Beach            Unknown                  0.15384615
## 236                 Waterfall            Unknown                  0.07692308
## 237                     Beach            Unknown                  0.15384615
## 238                    Temple     6th century AD                  0.23076923
## 239                    Temple       12th century                  0.15384615
## 240                  Memorial               1970                  0.07692308
## 241                      Lake               1824                  0.07692308
## 242                    Temple       12th century                  0.07692308
## 243                      Lake               1863                  0.23076923
## 244                    Temple                110                  0.15384615
## 245                    Temple        7th century                  0.07692308
## 246                      Lake            Unknown                  0.07692308
## 247                    Temple        7th century                  0.07692308
## 248                    Temple       10th century                  0.07692308
## 249                    Temple            Unknown                  0.07692308
## 250                     Beach            Unknown                  0.15384615
## 251                    Temple       14th century                  0.07692308
## 252                      Hill            Unknown                  0.23076923
## 253                      Site       16th century                  0.15384615
## 254                      Cave            Unknown                  0.15384615
## 255                    Temple            Unknown                  0.07692308
## 256            Bird Sanctuary            Unknown                  0.07692308
## 257                      Fort       12th century                  0.15384615
## 258          Spiritual Center               1950                  0.07692308
## 259                    Temple                198                  0.07692308
## 260                      Hill            Unknown                  0.23076923
## 261                    Museum                 22                  0.07692308
## 262                      Cave            Unknown                  0.23076923
## 263              War Memorial            Unknown                  0.07692308
## 264                       Zoo               1977                  0.23076923
## 265                  Aquarium            Unknown                  0.07692308
## 266                    Museum               1991                  0.07692308
## 267                      Hill            Unknown                  0.23076923
## 268                 Monastery               1705                  0.07692308
## 269         Religious Complex                211                  0.23076923
## 270                 Monastery              1960s                  0.07692308
## 271                      Park                213                  0.07692308
## 272                    Temple               1967                  0.07692308
## 273                      Lake            Unknown                  0.23076923
## 274                    Temple            Unknown                  0.23076923
## 275             National Park               1905                  0.38461538
## 276                    Island            Unknown                  0.07692308
## 277                    Temple               1734                  0.07692308
## 278              River Island            Unknown                  0.23076923
## 279             National Park               1990                  0.38461538
## 280                    Temple            Unknown                  0.07692308
## 281        Wildlife Sanctuary               1987                  0.23076923
## 282                 Monastery               1680                  0.23076923
## 283                    Palace               1901                  0.15384615
## 284                      Lake            Unknown                  0.07692308
## 285             Rock Carvings                700                  0.15384615
## 286                 Waterfall            Unknown                  0.15384615
## 287                    Valley            Unknown                  0.38461538
## 288                     Beach            Unknown                  0.07692308
## 289                  Township               1968                  0.23076923
## 290                     Beach            Unknown                  0.07692308
## 291                  Landmark               1906                  0.15384615
## 292                     Beach            Unknown                  0.07692308
## 293                     Beach            Unknown                  0.07692308
## 294           Natural Feature            Unknown                  0.15384615
## 295                      Cave            Unknown                  0.07692308
## 296                      Fort               1535                  0.15384615
## 297                    Temple            Unknown                  0.07692308
## 298                    Temple            Unknown                  0.07692308
## 299                    Temple               -260                  0.15384615
## 300                       Zoo            Unknown                  0.30769231
## 301                 Gurudwara            Unknown                  0.07692308
## 302                      Park            Unknown                  0.07692308
## 303             Entertainment               2010                  0.38461538
## 304                      Mall            Unknown                  0.23076923
## 305        Commercial Complex            Unknown                  0.23076923
## 306                 Gurudwara            Unknown                  0.07692308
## 307                    Temple            Unknown                  0.15384615
## 308                      Mall               2016                  0.23076923
## 309                      Mall            Unknown                  0.23076923
## 310            Amusement Park               2005                  0.53846154
## 311                       Zoo               1960                  0.38461538
## 312                      Mall               2012                  0.23076923
## 313                      Mall               2004                  0.23076923
## 314                    Mosque               1656                  0.07692308
## 315                    Temple            Unknown                  0.15384615
## 316                Race Track               2011                  0.23076923
## 317                      Mall               2020                  0.23076923
## 318                      Mall               2013                  0.38461538
## 319                    Museum               1977                  0.23076923
## 320           Natural Feature            Unknown                  0.23076923
## 321                    Temple               1992                  0.38461538
## 322                      Fort               1565                  0.23076923
## 323                    Museum               2013                  0.23076923
## 324                    Palace               1727                  0.23076923
## 325                    Museum               1887                  0.23076923
##     Google.review.rating
## 1              0.9142857
## 2              0.8857143
## 3              0.9142857
## 4              0.7714286
## 5              0.8000000
## 6              0.8000000
## 7              0.8857143
## 8              0.8857143
## 9              0.8000000
## 10             0.9142857
## 11             0.7714286
## 12             0.8857143
## 13             0.8857143
## 14             0.7714286
## 15             0.8857143
## 16             0.8571429
## 17             0.8857143
## 18             0.9142857
## 19             0.9142857
## 20             0.8285714
## 21             0.9714286
## 22             0.9428571
## 23             0.8571429
## 24             0.8285714
## 25             0.8285714
## 26             0.8285714
## 27             0.0000000
## 28             0.8000000
## 29             0.8571429
## 30             0.8571429
## 31             0.9142857
## 32             0.9142857
## 33             0.8857143
## 34             0.8571429
## 35             0.8285714
## 36             0.8571429
## 37             0.8571429
## 38             0.8571429
## 39             0.9428571
## 40             0.8571429
## 41             0.8000000
## 42             0.7714286
## 43             0.9142857
## 44             0.9142857
## 45             0.9142857
## 46             0.9428571
## 47             0.8571429
## 48             0.7714286
## 49             0.8285714
## 50             0.8571429
## 51             0.9428571
## 52             0.8571429
## 53             0.8571429
## 54             0.8857143
## 55             0.8000000
## 56             0.9142857
## 57             0.8571429
## 58             0.8000000
## 59             0.8857143
## 60             0.8857143
## 61             0.9142857
## 62             0.9142857
## 63             0.8285714
## 64             0.8000000
## 65             0.8857143
## 66             0.7142857
## 67             0.9142857
## 68             0.9428571
## 69             0.8857143
## 70             0.9142857
## 71             0.8571429
## 72             0.9714286
## 73             1.0000000
## 74             0.9142857
## 75             0.8857143
## 76             0.9142857
## 77             0.8571429
## 78             0.8857143
## 79             0.8571429
## 80             0.8571429
## 81             0.8571429
## 82             0.8571429
## 83             0.9142857
## 84             0.8571429
## 85             0.9142857
## 86             0.9142857
## 87             0.9142857
## 88             0.9142857
## 89             0.8857143
## 90             0.9142857
## 91             0.8857143
## 92             0.9142857
## 93             1.0000000
## 94             0.9714286
## 95             0.9714286
## 96             0.8857143
## 97             0.8857143
## 98             0.8285714
## 99             0.8571429
## 100            0.9428571
## 101            0.7142857
## 102            0.8857143
## 103            0.8285714
## 104            0.6857143
## 105            0.9142857
## 106            0.8857143
## 107            0.8571429
## 108            0.8571429
## 109            0.8857143
## 110            0.8571429
## 111            0.9142857
## 112            0.9142857
## 113            0.9428571
## 114            0.7714286
## 115            0.8857143
## 116            0.8857143
## 117            0.9142857
## 118            0.9142857
## 119            0.8857143
## 120            0.9428571
## 121            0.8857143
## 122            0.8571429
## 123            0.9428571
## 124            0.8571429
## 125            0.9142857
## 126            0.7714286
## 127            0.9428571
## 128            0.8000000
## 129            0.9428571
## 130            0.8857143
## 131            0.9714286
## 132            0.8571429
## 133            0.9142857
## 134            0.8571429
## 135            0.8571429
## 136            0.9428571
## 137            0.9428571
## 138            0.9428571
## 139            0.8571429
## 140            0.8857143
## 141            0.9714286
## 142            0.8857143
## 143            0.9142857
## 144            0.8857143
## 145            0.8857143
## 146            0.9714286
## 147            0.7142857
## 148            0.9142857
## 149            0.8571429
## 150            0.8571429
## 151            0.9428571
## 152            0.7714286
## 153            0.9428571
## 154            0.8857143
## 155            0.9714286
## 156            0.8857143
## 157            0.8571429
## 158            0.8857143
## 159            0.8571429
## 160            0.9142857
## 161            0.9142857
## 162            0.9714286
## 163            0.9714286
## 164            0.9142857
## 165            0.8857143
## 166            0.9428571
## 167            0.8571429
## 168            0.6857143
## 169            0.8000000
## 170            0.8571429
## 171            0.8857143
## 172            0.8857143
## 173            0.8000000
## 174            0.8857143
## 175            0.9714286
## 176            0.8285714
## 177            0.7428571
## 178            0.8571429
## 179            0.9714286
## 180            0.9714286
## 181            0.9428571
## 182            0.9142857
## 183            0.9428571
## 184            0.8571429
## 185            0.9428571
## 186            0.9714286
## 187            0.9714286
## 188            0.8857143
## 189            0.8571429
## 190            0.9142857
## 191            0.8571429
## 192            0.8285714
## 193            0.7714286
## 194            0.9714286
## 195            0.8000000
## 196            0.9142857
## 197            1.0000000
## 198            0.9142857
## 199            0.9428571
## 200            0.7714286
## 201            0.8857143
## 202            0.9428571
## 203            0.8857143
## 204            0.9714286
## 205            0.9428571
## 206            0.8285714
## 207            0.8571429
## 208            0.9714286
## 209            0.6571429
## 210            0.8857143
## 211            0.9428571
## 212            0.9714286
## 213            0.9714286
## 214            0.7714286
## 215            0.9714286
## 216            0.8857143
## 217            0.8571429
## 218            0.8571429
## 219            0.8857143
## 220            0.8857143
## 221            0.9428571
## 222            0.9142857
## 223            0.8571429
## 224            0.8857143
## 225            0.8857143
## 226            0.9428571
## 227            0.9428571
## 228            0.9142857
## 229            0.8857143
## 230            0.8857143
## 231            0.8857143
## 232            0.7142857
## 233            0.9142857
## 234            0.8285714
## 235            0.8000000
## 236            0.8571429
## 237            0.7142857
## 238            0.9428571
## 239            0.9142857
## 240            0.9142857
## 241            0.7714286
## 242            0.9428571
## 243            0.7142857
## 244            0.9714286
## 245            0.9142857
## 246            0.8000000
## 247            0.9142857
## 248            0.9428571
## 249            0.9428571
## 250            0.8857143
## 251            0.9428571
## 252            0.8285714
## 253            0.9142857
## 254            0.8571429
## 255            0.9428571
## 256            0.8571429
## 257            0.8857143
## 258            0.9428571
## 259            0.9428571
## 260            0.8857143
## 261            0.9142857
## 262            0.8857143
## 263            0.9142857
## 264            0.7714286
## 265            0.6857143
## 266            0.8285714
## 267            0.8285714
## 268            0.9142857
## 269            0.9428571
## 270            0.9142857
## 271            0.9714286
## 272            0.9428571
## 273            0.8857143
## 274            0.9142857
## 275            0.8857143
## 276            0.7714286
## 277            0.9428571
## 278            0.9428571
## 279            0.9142857
## 280            0.8857143
## 281            0.8571429
## 282            0.9428571
## 283            0.8857143
## 284            0.8857143
## 285            0.8857143
## 286            0.9142857
## 287            0.9428571
## 288            0.8857143
## 289            0.7714286
## 290            0.8857143
## 291            0.9428571
## 292            0.9714286
## 293            0.8857143
## 294            0.8571429
## 295            0.8857143
## 296            0.9142857
## 297            0.9428571
## 298            0.9142857
## 299            0.9428571
## 300            0.8285714
## 301            0.9428571
## 302            0.8571429
## 303            0.8571429
## 304            0.9142857
## 305            0.9428571
## 306            0.9714286
## 307            0.9714286
## 308            0.9142857
## 309            0.8000000
## 310            0.8857143
## 311            0.8571429
## 312            0.8857143
## 313            0.8857143
## 314            0.8857143
## 315            0.9428571
## 316            0.9142857
## 317            0.9142857
## 318            0.9142857
## 319            0.8571429
## 320            0.9142857
## 321            0.9142857
## 322            0.8857143
## 323            0.9428571
## 324            0.8571429
## 325            0.8857143

XIII. Modelamiento predictivo

a. Regresión lineal simple

Ingresamos los datos

dataPredic <- data.frame(ganancia=c(150,300,450,500,600,620,700,800,850),
                       inversion=c(40,45,50,55,60,65,70,75,80))

dataPredic
##   ganancia inversion
## 1      150        40
## 2      300        45
## 3      450        50
## 4      500        55
## 5      600        60
## 6      620        65
## 7      700        70
## 8      800        75
## 9      850        80

Pasos para construir un modelo de regresixón:

Paso 1: Determinar las variables X,Y

  • Variable independiente (X): Inversión
  • Variable dependiente (y): ganancia

Paso 2: Evaluar la relación entre variables (Correlación) graficamente

Diagrama de dispersión o puntos

plot(x=dataPredic$inversion,y=dataPredic$ganancia)

pairs(dataPredic)

Coeficiente de correlación

# Mediante la función cor
cor(dataPredic) # Matriz de correlaciones
##            ganancia inversion
## ganancia  1.0000000 0.9831876
## inversion 0.9831876 1.0000000

Coeficiente de correlación:

r = 0.9831876
Interpretación: Existe correlación positiva entre la inversión y la ganancia.

Como en este caso el coeficiente de correlación es superior a 1.0, es viable la regresión.

Paso 3: Regresión

Regresión lineal simple

Para obtener el modelo, se va a utilizar una función de R > lm

# lm, notación: Y ~ X, data=
modelo1 <- lm(ganancia ~ inversion, data=dataPredic)

# Resumen de resultados
summary(modelo1)
## 
## Call:
## lm(formula = ganancia ~ inversion, data = dataPredic)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -74.222 -16.222  -6.222  29.778  61.778 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) -431.778     70.654  -6.111 0.000486 ***
## inversion     16.400      1.151  14.246    2e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 44.59 on 7 degrees of freedom
## Multiple R-squared:  0.9667, Adjusted R-squared:  0.9619 
## F-statistic: 202.9 on 1 and 7 DF,  p-value: 1.996e-06
##Coefficients:
##            Estimate Std. Error t value Pr(>|t|)    
##(Intercept) -431.778     70.654  -6.111 0.000486 ***
##inversion     16.400      1.151  14.246    2e-06 ***
##---
##Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

##Residual standard error: 44.59 on 7 degrees of freedom
##Multiple R-squared:  0.9667,  Adjusted R-squared:  0.9619 
##F-statistic: 202.9 on 1 and 7 DF,  p-value: 1.996e-06

Modelo final con los resultados:

Modelo general

$ = -431.778 +16.400 X $

Modelo para el caso:

\(\hat{ganancia} = -431.778 + 16.400 Inversión\)

b. Regresión lineal múltiple

# lm, notación: Y ~ X, data=
modeloMulti <- lm(viajes$X ~ viajes$Google.review.rating + viajes$time.needed.to.visit.in.hrs, data =dataPredic)

#Resumen de resultados
summary(modeloMulti)
## 
## Call:
## lm(formula = viajes$X ~ viajes$Google.review.rating + viajes$time.needed.to.visit.in.hrs, 
##     data = dataPredic)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -181.348  -80.283    0.022   76.833  170.069 
## 
## Coefficients:
##                                    Estimate Std. Error t value Pr(>|t|)  
## (Intercept)                         -23.743     88.226  -0.269   0.7880  
## viajes$Google.review.rating          45.760     19.091   2.397   0.0171 *
## viajes$time.needed.to.visit.in.hrs  -10.812      5.396  -2.003   0.0460 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 92.53 on 322 degrees of freedom
## Multiple R-squared:  0.03622,    Adjusted R-squared:  0.03024 
## F-statistic: 6.051 on 2 and 322 DF,  p-value: 0.002631

c. Regresión lineal logistica

#lm, notación: Y ~ X, data=
#modeloLog <- glm(viajes$X ~ viajes$Establishment.Year + viajes$Entrance.Fee.in.INR, data = viajes, family = binomial())

# Resumen de resultados
#summary(modeloLog)