Cargamos las librerias previamente instaladas

library(readxl)#libreria para leer archivos .xlsx

library(Bchron)#cargamos la libreria bchron para generar los PDF
## Warning: package 'Bchron' was built under R version 4.3.2

Luego cargamos los datos a utilizar

getwd()#observamos el directorio
## [1] "C:/Users/Usuario/Desktop"
setwd("C:/Users/Usuario/Desktop/Programacion tesis maestria/Tesis MAestrĆ­a/Programacion completa")#cambiamos el directorio donde esten los documentos 

read.csv(file="C:/Users/Usuario/Desktop/Programacion tesis maestria/Tesis MAestrĆ­a/Programacion completa/BetaSole.csv")->BETA#cargamos los datos de las edades arqueologicas

BETAPUB<- read_excel("C:/Users/Usuario/Desktop/Programacion tesis maestria/Tesis MAestrĆ­a/Programacion completa/BetaSolePub.xlsx")#cargamos las edades calibradas

Beta<-BETAPUB
AgesBeta<-BchronCalibrate(ages=Beta$ages,ageSds=Beta$ageSds,

                          calCurves=Beta$calCurves, positions=Beta$position)#calculamos las curvas de calibracion

plot(AgesBeta)#graficamos las edades

summary(AgesBeta)#resumen de las densidades basados en las edades
## 95% Highest density regions for Date1
## $`4.5%`
## [1]  0 26
## 
## $`13.2%`
## [1]  60 116
## 
## $`43.2%`
## [1] 137 232
## 
## $`34.2%`
## [1] 238 285
## 
## 
## 95% Highest density regions for Date2
## $`13%`
## [1] 299 341
## 
## $`82%`
## [1] 347 452
## 
## 
## 95% Highest density regions for Date3
## $`37.1%`
## [1] 323 412
## 
## $`0.7%`
## [1] 414 414
## 
## $`3.7%`
## [1] 419 423
## 
## $`53.7%`
## [1] 434 495
## 
## 
## 95% Highest density regions for Date4
## $`43.9%`
## [1] 509 559
## 
## $`51.1%`
## [1] 605 625
## 
## 
## 95% Highest density regions for Date5
## $`2.8%`
## [1] 771 780
## 
## $`92.2%`
## [1] 790 922
## 
## 
## 95% Highest density regions for Date6
## $`51.5%`
## [1] 1065 1170
## 
## $`3.6%`
## [1] 1174 1178
## 
## $`40%`
## [1] 1212 1261
## 
## 
## 95% Highest density regions for Date7
## $`7.3%`
## [1] 1180 1210
## 
## $`0.5%`
## [1] 1242 1242
## 
## $`63.5%`
## [1] 1263 1314
## 
## $`23.7%`
## [1] 1336 1345
## 
## 
## 95% Highest density regions for Date8
## $`64.2%`
## [1] 1305 1380
## 
## $`30.9%`
## [1] 1386 1407
## 
## 
## 95% Highest density regions for Date9
## $`66.9%`
## [1] 1310 1427
## 
## $`13.2%`
## [1] 1442 1452
## 
## $`15%`
## [1] 1460 1471
## 
## 
## 95% Highest density regions for Date10
## $`3.6%`
## [1] 1315 1335
## 
## $`26.6%`
## [1] 1345 1433
## 
## $`42.1%`
## [1] 1436 1482
## 
## $`22.8%`
## [1] 1494 1513
## 
## 
## 95% Highest density regions for Date11
## $`2.7%`
## [1] 1749 1770
## 
## $`1.8%`
## [1] 1787 1797
## 
## $`69.9%`
## [1] 1813 1929
## 
## $`20.5%`
## [1] 1970 1988
## 
## 
## 95% Highest density regions for Date12
## $`12.9%`
## [1] 1927 1973
## 
## $`82.1%`
## [1] 1983 2093
## 
## 
## 95% Highest density regions for Date13
## $`2.1%`
## [1] 2369 2384
## 
## $`0.1%`
## [1] 2412 2412
## 
## $`92.8%`
## [1] 2415 2722
## 
## 
## 95% Highest density regions for Date14
## $`0.1%`
## [1] 2939 2940
## 
## $`90.1%`
## [1] 2947 3173
## 
## $`4.7%`
## [1] 3197 3204
## 
## 
## 95% Highest density regions for Date15
## $`79.2%`
## [1] 3354 3457
## 
## $`15.9%`
## [1] 3470 3482
## 
## 
## 95% Highest density regions for Date16
## $`3%`
## [1] 3643 3666
## 
## $`86.7%`
## [1] 3684 3850
## 
## $`5.3%`
## [1] 3862 3869
## 
## 
## 95% Highest density regions for Date17
## $`1.4%`
## [1] 3850 3858
## 
## $`52.8%`
## [1] 3864 4020
## 
## $`40.9%`
## [1] 4022 4085
rep(c("gold", "tan1", "darkolivegreen4","darkolivegreen1", "green3", "lightblue","gray75"), times=c(1,3,1,3,2,4,3))->colores#asignamos colores

vineta<-rep(c(15:20,15), times=c(1,3,1,3,2,4,3))#asignamos viƱetas

plot(Beta$CALIBRATED, col=colores, pch=vineta, cex=3)#ploteamos las edades calibradas

BetaDens = BchronDensity(ages=Beta$ages,ageSds=Beta$ageSds,calCurves=Beta$calCurves);#generamos los PDF
## 
  |                                                                  
  |                                                            |   0%
  |                                                                  
  |                                                            |   1%
  |                                                                  
  |=                                                           |   1%
  |                                                                  
  |=                                                           |   2%
  |                                                                  
  |==                                                          |   3%
  |                                                                  
  |==                                                          |   4%
  |                                                                  
  |===                                                         |   4%
  |                                                                  
  |===                                                         |   5%
  |                                                                  
  |===                                                         |   6%
  |                                                                  
  |====                                                        |   6%
  |                                                                  
  |====                                                        |   7%
  |                                                                  
  |=====                                                       |   8%
  |                                                                  
  |=====                                                       |   9%
  |                                                                  
  |======                                                      |   9%
  |                                                                  
  |======                                                      |  10%
  |                                                                  
  |======                                                      |  11%
  |                                                                  
  |=======                                                     |  11%
  |                                                                  
  |=======                                                     |  12%
  |                                                                  
  |========                                                    |  13%
  |                                                                  
  |========                                                    |  14%
  |                                                                  
  |=========                                                   |  14%
  |                                                                  
  |=========                                                   |  15%
  |                                                                  
  |=========                                                   |  16%
  |                                                                  
  |==========                                                  |  16%
  |                                                                  
  |==========                                                  |  17%
  |                                                                  
  |===========                                                 |  18%
  |                                                                  
  |===========                                                 |  19%
  |                                                                  
  |============                                                |  19%
  |                                                                  
  |============                                                |  20%
  |                                                                  
  |============                                                |  21%
  |                                                                  
  |=============                                               |  21%
  |                                                                  
  |=============                                               |  22%
  |                                                                  
  |==============                                              |  23%
  |                                                                  
  |==============                                              |  24%
  |                                                                  
  |===============                                             |  24%
  |                                                                  
  |===============                                             |  25%
  |                                                                  
  |===============                                             |  26%
  |                                                                  
  |================                                            |  26%
  |                                                                  
  |================                                            |  27%
  |                                                                  
  |=================                                           |  28%
  |                                                                  
  |=================                                           |  29%
  |                                                                  
  |==================                                          |  29%
  |                                                                  
  |==================                                          |  30%
  |                                                                  
  |==================                                          |  31%
  |                                                                  
  |===================                                         |  31%
  |                                                                  
  |===================                                         |  32%
  |                                                                  
  |====================                                        |  33%
  |                                                                  
  |====================                                        |  34%
  |                                                                  
  |=====================                                       |  34%
  |                                                                  
  |=====================                                       |  35%
  |                                                                  
  |=====================                                       |  36%
  |                                                                  
  |======================                                      |  36%
  |                                                                  
  |======================                                      |  37%
  |                                                                  
  |=======================                                     |  38%
  |                                                                  
  |=======================                                     |  39%
  |                                                                  
  |========================                                    |  39%
  |                                                                  
  |========================                                    |  40%
  |                                                                  
  |========================                                    |  41%
  |                                                                  
  |=========================                                   |  41%
  |                                                                  
  |=========================                                   |  42%
  |                                                                  
  |==========================                                  |  43%
  |                                                                  
  |==========================                                  |  44%
  |                                                                  
  |===========================                                 |  44%
  |                                                                  
  |===========================                                 |  45%
  |                                                                  
  |===========================                                 |  46%
  |                                                                  
  |============================                                |  46%
  |                                                                  
  |============================                                |  47%
  |                                                                  
  |=============================                               |  48%
  |                                                                  
  |=============================                               |  49%
  |                                                                  
  |==============================                              |  49%
  |                                                                  
  |==============================                              |  50%
  |                                                                  
  |==============================                              |  51%
  |                                                                  
  |===============================                             |  51%
  |                                                                  
  |===============================                             |  52%
  |                                                                  
  |================================                            |  53%
  |                                                                  
  |================================                            |  54%
  |                                                                  
  |=================================                           |  54%
  |                                                                  
  |=================================                           |  55%
  |                                                                  
  |=================================                           |  56%
  |                                                                  
  |==================================                          |  56%
  |                                                                  
  |==================================                          |  57%
  |                                                                  
  |===================================                         |  58%
  |                                                                  
  |===================================                         |  59%
  |                                                                  
  |====================================                        |  59%
  |                                                                  
  |====================================                        |  60%
  |                                                                  
  |====================================                        |  61%
  |                                                                  
  |=====================================                       |  61%
  |                                                                  
  |=====================================                       |  62%
  |                                                                  
  |======================================                      |  63%
  |                                                                  
  |======================================                      |  64%
  |                                                                  
  |=======================================                     |  64%
  |                                                                  
  |=======================================                     |  65%
  |                                                                  
  |=======================================                     |  66%
  |                                                                  
  |========================================                    |  66%
  |                                                                  
  |========================================                    |  67%
  |                                                                  
  |=========================================                   |  68%
  |                                                                  
  |=========================================                   |  69%
  |                                                                  
  |==========================================                  |  69%
  |                                                                  
  |==========================================                  |  70%
  |                                                                  
  |==========================================                  |  71%
  |                                                                  
  |===========================================                 |  71%
  |                                                                  
  |===========================================                 |  72%
  |                                                                  
  |============================================                |  73%
  |                                                                  
  |============================================                |  74%
  |                                                                  
  |=============================================               |  74%
  |                                                                  
  |=============================================               |  75%
  |                                                                  
  |=============================================               |  76%
  |                                                                  
  |==============================================              |  76%
  |                                                                  
  |==============================================              |  77%
  |                                                                  
  |===============================================             |  78%
  |                                                                  
  |===============================================             |  79%
  |                                                                  
  |================================================            |  79%
  |                                                                  
  |================================================            |  80%
  |                                                                  
  |================================================            |  81%
  |                                                                  
  |=================================================           |  81%
  |                                                                  
  |=================================================           |  82%
  |                                                                  
  |==================================================          |  83%
  |                                                                  
  |==================================================          |  84%
  |                                                                  
  |===================================================         |  84%
  |                                                                  
  |===================================================         |  85%
  |                                                                  
  |===================================================         |  86%
  |                                                                  
  |====================================================        |  86%
  |                                                                  
  |====================================================        |  87%
  |                                                                  
  |=====================================================       |  88%
  |                                                                  
  |=====================================================       |  89%
  |                                                                  
  |======================================================      |  89%
  |                                                                  
  |======================================================      |  90%
  |                                                                  
  |======================================================      |  91%
  |                                                                  
  |=======================================================     |  91%
  |                                                                  
  |=======================================================     |  92%
  |                                                                  
  |========================================================    |  93%
  |                                                                  
  |========================================================    |  94%
  |                                                                  
  |=========================================================   |  94%
  |                                                                  
  |=========================================================   |  95%
  |                                                                  
  |=========================================================   |  96%
  |                                                                  
  |==========================================================  |  96%
  |                                                                  
  |==========================================================  |  97%
  |                                                                  
  |=========================================================== |  98%
  |                                                                  
  |=========================================================== |  99%
  |                                                                  
  |============================================================|  99%
  |                                                                  
  |============================================================| 100%
plot(AgesBeta, col= colores)#graficamos las edades con colores

plot(BetaDens)#graficamos los PDF

summary(BetaDens)#observamos los periodos de ocupacion
## At probability level 0.95 there were 6 phases found.
## Phase 1 
## From 185 to 1468 
## Phase 2 
## From 1731 to 2146 
## Phase 3 
## From 2321 to 2615 
## Phase 4 
## From 2886 to 3158 
## Phase 5 
## From 3284 to 3592 
## Phase 6 
## From 3710 to 4064