# To clean environment 
rm(list = ls(all.names = TRUE)) 
gc()
##          used (Mb) gc trigger (Mb) max used (Mb)
## Ncells 516970 27.7    1154957 61.7   644200 34.5
## Vcells 920683  7.1    8388608 64.0  1634597 12.5
library(readxl)
library(Hmisc)
## Loading required package: lattice
## Loading required package: survival
## Loading required package: Formula
## Loading required package: ggplot2
## 
## Attaching package: 'Hmisc'
## The following objects are masked from 'package:base':
## 
##     format.pval, units
library(readxl)
Vester <- read_excel("C:/Users/luisc/Downloads/Vester.xlsx")
View(Vester)
class(Vester)
## [1] "tbl_df"     "tbl"        "data.frame"
Vester
## # A tibble: 19 × 3
##    cat       x     y
##    <chr> <dbl> <dbl>
##  1 A       7    21  
##  2 B      14    12  
##  3 C      23    13  
##  4 D      18    19  
##  5 E      16    17  
##  6 F      31     4  
##  7 G      26     3  
##  8 H      18    10  
##  9 I      30    32  
## 10 J      18    11  
## 11 K      12    22  
## 12 L      17     4  
## 13 M      20     8  
## 14 N      16    22  
## 15 O      32    31  
## 16 P       3    25  
## 17 Q       0    45  
## 18 R      14    16  
## 19 <NA>   17.5  17.5
med = mean(Vester$x)
Vester$cat = as.factor(Vester$cat)
plot(Vester$x,Vester$y, cex= 1,
     pch = 21:25,
     bg = 1:25,
     lwd = 3,
     col = Vester$cat,
     xlab = "Influencia/Causalidad", 
     ylab = "Dependencia/Consecuencia",
     xlim = c(0,50),
     ylim = c(0,60),
     main = "Matriz de Vester",
     cex.lab = 1.5,
     cex.main = 2.2,
     cex.axis = 0.8)
minor.tick(nx = 5,ny = 10)
abline(v = mean(Vester$x), col = "blue", lwd = 3, lty = 6)
abline(h = mean(Vester$y), col = "blue", lwd = 3, lty = 6)
text(9.5, 43, "Causas indirectas", font = 4 )
text(35.5, 43, "Causas directas", font = 4)
text(37.5, 16, "Efectos", font = 4)
text(2.1, 16, "Indiferentes", font = 4)
text(24, 7.0, mean(Vester$x))
text(Vester$x, Vester$y, labels = Vester$cat, pos = 4)

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

You can also embed plots, for example:

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