R Markdown

R Markdown

R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

summary(cars)
##      speed           dist       
##  Min.   : 4.0   Min.   :  2.00  
##  1st Qu.:12.0   1st Qu.: 26.00  
##  Median :15.0   Median : 36.00  
##  Mean   :15.4   Mean   : 42.98  
##  3rd Qu.:19.0   3rd Qu.: 56.00  
##  Max.   :25.0   Max.   :120.00

Including Plots

hoteles <- factor(c(rep("Capilla del Mar", 4),
                    rep("Caribe", 6),
                    rep("Charleston", 5),
                    rep("De Camerón", 12),
                    rep("Hilton", 6),
                    rep("Las Américas", 6),
                    rep("Santa Clara", 8)
                    ))
hoteles
##  [1] Capilla del Mar Capilla del Mar Capilla del Mar Capilla del Mar
##  [5] Caribe          Caribe          Caribe          Caribe         
##  [9] Caribe          Caribe          Charleston      Charleston     
## [13] Charleston      Charleston      Charleston      De Camerón     
## [17] De Camerón      De Camerón      De Camerón      De Camerón     
## [21] De Camerón      De Camerón      De Camerón      De Camerón     
## [25] De Camerón      De Camerón      De Camerón      Hilton         
## [29] Hilton          Hilton          Hilton          Hilton         
## [33] Hilton          Las Américas    Las Américas    Las Américas   
## [37] Las Américas    Las Américas    Las Américas    Santa Clara    
## [41] Santa Clara     Santa Clara     Santa Clara     Santa Clara    
## [45] Santa Clara     Santa Clara     Santa Clara    
## 7 Levels: Capilla del Mar Caribe Charleston De Camerón Hilton ... Santa Clara
Tabla <- table(hoteles);Tabla
## hoteles
## Capilla del Mar          Caribe      Charleston      De Camerón          Hilton 
##               4               6               5              12               6 
##    Las Américas     Santa Clara 
##               6               8
pie(Tabla)

#install.packages("lessR")
library(lessR)
## 
## lessR 4.1.7                         feedback: gerbing@pdx.edu 
## --------------------------------------------------------------
## > d <- Read("")   Read text, Excel, SPSS, SAS, or R data file
##   d is default data frame, data= in analysis routines optional
## 
## Learn about reading, writing, and manipulating data, graphics,
## testing means and proportions, regression, factor analysis,
## customization, and descriptive statistics from pivot tables.
##   Enter:  browseVignettes("lessR")
## 
## View changes in this or recent versions of lessR.
##   Enter: help(package=lessR)  Click: Package NEWS
##   Enter: interact()  for access to interactive graphics
##   New function: reshape_long() to move data from wide to long

Datos<- data.frame(hoteles = hoteles);Datos
##            hoteles
## 1  Capilla del Mar
## 2  Capilla del Mar
## 3  Capilla del Mar
## 4  Capilla del Mar
## 5           Caribe
## 6           Caribe
## 7           Caribe
## 8           Caribe
## 9           Caribe
## 10          Caribe
## 11      Charleston
## 12      Charleston
## 13      Charleston
## 14      Charleston
## 15      Charleston
## 16      De Camerón
## 17      De Camerón
## 18      De Camerón
## 19      De Camerón
## 20      De Camerón
## 21      De Camerón
## 22      De Camerón
## 23      De Camerón
## 24      De Camerón
## 25      De Camerón
## 26      De Camerón
## 27      De Camerón
## 28          Hilton
## 29          Hilton
## 30          Hilton
## 31          Hilton
## 32          Hilton
## 33          Hilton
## 34    Las Américas
## 35    Las Américas
## 36    Las Américas
## 37    Las Américas
## 38    Las Américas
## 39    Las Américas
## 40     Santa Clara
## 41     Santa Clara
## 42     Santa Clara
## 43     Santa Clara
## 44     Santa Clara
## 45     Santa Clara
## 46     Santa Clara
## 47     Santa Clara
PieChart(hoteles, hole = 0, values = "%", data = Datos,
         fill = rainbow(7), main = "Hoteles de preferencia por los Turistas")
## >>> Note: hoteles is not in a data frame (table)

## >>> Suggestions
## PieChart(hoteles, hole=0)  # traditional pie chart
## PieChart(hoteles, values="%")  # display %'s on the chart
## PieChart(hoteles)  # bar chart
## Plot(hoteles)  # bubble plot
## Plot(hoteles, values="count")  # lollipop plot 
## 
## --- hoteles --- 
## 
##         hoteles Count   Prop 
## ---------------------------- 
## Capilla del Mar    4   0.085 
##          Caribe    6   0.128 
##      Charleston    5   0.106 
##      De Camerón   12   0.255 
##          Hilton    6   0.128 
##    Las Américas    6   0.128 
##     Santa Clara    8   0.170 
## ---------------------------- 
##           Total   47   1.000 
## 
## Chi-squared test of null hypothesis of equal probabilities 
##   Chisq = 6.170, df = 6, p-value = 0.404
PieChart(hoteles, hole = 0, values = "%", data = Datos,
         fill = terrain.colors(7), main = "Hoteles de preferencia por los Turistas")
## >>> Note: hoteles is not in a data frame (table)

## >>> Suggestions
## PieChart(hoteles, hole=0)  # traditional pie chart
## PieChart(hoteles, values="%")  # display %'s on the chart
## PieChart(hoteles)  # bar chart
## Plot(hoteles)  # bubble plot
## Plot(hoteles, values="count")  # lollipop plot 
## 
## --- hoteles --- 
## 
##         hoteles Count   Prop 
## ---------------------------- 
## Capilla del Mar    4   0.085 
##          Caribe    6   0.128 
##      Charleston    5   0.106 
##      De Camerón   12   0.255 
##          Hilton    6   0.128 
##    Las Américas    6   0.128 
##     Santa Clara    8   0.170 
## ---------------------------- 
##           Total   47   1.000 
## 
## Chi-squared test of null hypothesis of equal probabilities 
##   Chisq = 6.170, df = 6, p-value = 0.404
PieChart(hoteles, hole = 0, values = "%", data = Datos,
         fill = heat.colors(7), main = "Hoteles de preferencia por los Turistas")
## >>> Note: hoteles is not in a data frame (table)

## >>> Suggestions
## PieChart(hoteles, hole=0)  # traditional pie chart
## PieChart(hoteles, values="%")  # display %'s on the chart
## PieChart(hoteles)  # bar chart
## Plot(hoteles)  # bubble plot
## Plot(hoteles, values="count")  # lollipop plot 
## 
## --- hoteles --- 
## 
##         hoteles Count   Prop 
## ---------------------------- 
## Capilla del Mar    4   0.085 
##          Caribe    6   0.128 
##      Charleston    5   0.106 
##      De Camerón   12   0.255 
##          Hilton    6   0.128 
##    Las Américas    6   0.128 
##     Santa Clara    8   0.170 
## ---------------------------- 
##           Total   47   1.000 
## 
## Chi-squared test of null hypothesis of equal probabilities 
##   Chisq = 6.170, df = 6, p-value = 0.404
PieChart(hoteles, hole = 0, values = "%", data = Datos,
         fill = topo.colors(7), main = "Hoteles de preferencia por los Turistas")
## >>> Note: hoteles is not in a data frame (table)

## >>> Suggestions
## PieChart(hoteles, hole=0)  # traditional pie chart
## PieChart(hoteles, values="%")  # display %'s on the chart
## PieChart(hoteles)  # bar chart
## Plot(hoteles)  # bubble plot
## Plot(hoteles, values="count")  # lollipop plot 
## 
## --- hoteles --- 
## 
##         hoteles Count   Prop 
## ---------------------------- 
## Capilla del Mar    4   0.085 
##          Caribe    6   0.128 
##      Charleston    5   0.106 
##      De Camerón   12   0.255 
##          Hilton    6   0.128 
##    Las Américas    6   0.128 
##     Santa Clara    8   0.170 
## ---------------------------- 
##           Total   47   1.000 
## 
## Chi-squared test of null hypothesis of equal probabilities 
##   Chisq = 6.170, df = 6, p-value = 0.404
PieChart(hoteles, hole = 0, values = "%", data = Datos,
         fill = cm.colors(7), main = "Hoteles de preferencia por los Turistas")
## >>> Note: hoteles is not in a data frame (table)

## >>> Suggestions
## PieChart(hoteles, hole=0)  # traditional pie chart
## PieChart(hoteles, values="%")  # display %'s on the chart
## PieChart(hoteles)  # bar chart
## Plot(hoteles)  # bubble plot
## Plot(hoteles, values="count")  # lollipop plot 
## 
## --- hoteles --- 
## 
##         hoteles Count   Prop 
## ---------------------------- 
## Capilla del Mar    4   0.085 
##          Caribe    6   0.128 
##      Charleston    5   0.106 
##      De Camerón   12   0.255 
##          Hilton    6   0.128 
##    Las Américas    6   0.128 
##     Santa Clara    8   0.170 
## ---------------------------- 
##           Total   47   1.000 
## 
## Chi-squared test of null hypothesis of equal probabilities 
##   Chisq = 6.170, df = 6, p-value = 0.404
PieChart(hoteles, hole = 0, values = "%", data = Datos,
         fill = c("#5F33FF","#FF33C1","#B633FF","#BDEC33","#174925","#050F75"), main = "Hoteles de preferencia por los Turistas")
## >>> Note: hoteles is not in a data frame (table)

## >>> Suggestions
## PieChart(hoteles, hole=0)  # traditional pie chart
## PieChart(hoteles, values="%")  # display %'s on the chart
## PieChart(hoteles)  # bar chart
## Plot(hoteles)  # bubble plot
## Plot(hoteles, values="count")  # lollipop plot 
## 
## --- hoteles --- 
## 
##         hoteles Count   Prop 
## ---------------------------- 
## Capilla del Mar    4   0.085 
##          Caribe    6   0.128 
##      Charleston    5   0.106 
##      De Camerón   12   0.255 
##          Hilton    6   0.128 
##    Las Américas    6   0.128 
##     Santa Clara    8   0.170 
## ---------------------------- 
##           Total   47   1.000 
## 
## Chi-squared test of null hypothesis of equal probabilities 
##   Chisq = 6.170, df = 6, p-value = 0.404

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.