library(readxl)
library("Hmisc")
## Warning: package 'Hmisc' was built under R version 4.2.1
## 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
vester <- read_excel("C:/Users/IngMa/Downloads/UNIVERSIDAD NACIONAL/2022/CICLO1/vester.xlsx")

class(vester)
## [1] "tbl_df"     "tbl"        "data.frame"
vester
## # A tibble: 20 × 3
##    cat       x     y
##    <chr> <dbl> <dbl>
##  1 A        30     8
##  2 B        29    41
##  3 C        19    35
##  4 D        21    30
##  5 E        28    10
##  6 F        31    13
##  7 G        12    13
##  8 H        27    22
##  9 I        34     9
## 10 J        27    17
## 11 K        30    34
## 12 L        21    28
## 13 M        17    33
## 14 N        35    29
## 15 O        15    32
## 16 P        11    27
## 17 Q        14    26
## 18 R        22    25
## 19 S        15    12
## 20 T         8    10
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 = "Activos", 
     ylab = "Pasivos",
     xlim = c(7,38),
     ylim = c(5,43),
     main = "Matriz de Vester",
     cex.lab = 1.5,
     cex.main = 2,
     cex.axis = 0.8)
minor.tick(nx = 5,ny = 10)
abline(v = mean(vester$x), col = "orange", lwd = 3, lty = 6)
abline(h = mean(vester$y), col = "orange", lwd = 3, lty = 6)
text(9.5, 43, "Causas directas", font = 4 )
text(35.5, 43, "Causas indirectas", font = 4)
text(37.5, 21, "Efectos", font = 4)
text(8.5, 21, "Indiferentes", font = 4)
text(24, 7.0, mean(vester$x))
text(vester$x, vester$y, labels = vester$cat, pos = 4)

attach(USJudgeRatings)