Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DATA ANALYSIS #1

Open
inakiintxaurbe opened this issue Aug 18, 2023 · 0 comments
Open

DATA ANALYSIS #1

inakiintxaurbe opened this issue Aug 18, 2023 · 0 comments

Comments

@inakiintxaurbe
Copy link
Owner

#install packages

install.packages(c("FactoMineR", "factoextra", "tidyverse"))
#> Installing packages into 'C:/Users/Inaki/AppData/Local/R/win-library/4.2'
#> (as 'lib' is unspecified)
#> package 'FactoMineR' successfully unpacked and MD5 sums checked
#> Warning: cannot remove prior installation of package 'FactoMineR'
#> Warning in file.copy(savedcopy, lib, recursive = TRUE): problema al copiar
#> C:\Users\Inaki\AppData\Local\R\win-library\4.2\00LOCK\FactoMineR\libs\x64\FactoMineR.dll
#> a
#> C:\Users\Inaki\AppData\Local\R\win-library\4.2\FactoMineR\libs\x64\FactoMineR.dll:
#> Permission denied
#> Warning: restored 'FactoMineR'
#> package 'factoextra' successfully unpacked and MD5 sums checked
#> package 'tidyverse' successfully unpacked and MD5 sums checked
#> 
#> The downloaded binary packages are in
#>  C:\Users\Inaki\AppData\Local\Temp\Rtmp0Uqzar\downloaded_packages
library(xlsx)
#> Warning: package 'xlsx' was built under R version 4.2.2
library(FactoMineR)
#> Warning: package 'FactoMineR' was built under R version 4.2.3
library(factoextra)
#> Warning: package 'factoextra' was built under R version 4.2.3
#> Loading required package: ggplot2
#> Warning: package 'ggplot2' was built under R version 4.2.3
#> Welcome! Want to learn more? See two factoextra-related books at https://goo.gl/ve3WBa
library(ggplot2)
library(tidyverse)
#> Warning: package 'tidyverse' was built under R version 4.2.3
#> Warning: package 'tibble' was built under R version 4.2.3
#> Warning: package 'tidyr' was built under R version 4.2.2
#> Warning: package 'readr' was built under R version 4.2.2
#> Warning: package 'purrr' was built under R version 4.2.2
#> Warning: package 'dplyr' was built under R version 4.2.3
#> Warning: package 'stringr' was built under R version 4.2.2
#> Warning: package 'forcats' was built under R version 4.2.2
#> Warning: package 'lubridate' was built under R version 4.2.2
library(scales)
#> Warning: package 'scales' was built under R version 4.2.2
#> 
#> Attaching package: 'scales'
#> The following object is masked from 'package:purrr':
#> 
#>     discard
#> The following object is masked from 'package:readr':
#> 
#>     col_factor

#Read Data

a<-read.xlsx("C:/Users/Inaki/Desktop/statistics/Analysis/1 DATA ANALYSIS/Table.xlsx",sheetIndex=1)

#Organize Data

a2<-a[,-1]
row.names(a2)<-a[,1]
summary(a)
#>       GU                Cave              Theme               Tech          
#>  Length:502         Length:502         Length:502         Length:502        
#>  Class :character   Class :character   Class :character   Class :character  
#>  Mode  :character   Mode  :character   Mode  :character   Mode  :character  
#>                                                                             
#>                                                                             
#>                                                                             
#>                                                                             
#>  Canvas.support     Support.texture       Format             Finish         
#>  Length:502         Length:502         Length:502         Length:502        
#>  Class :character   Class :character   Class :character   Class :character  
#>  Mode  :character   Mode  :character   Mode  :character   Mode  :character  
#>                                                                             
#>                                                                             
#>                                                                             
#>                                                                             
#>    Realism             Orient              Incl              morph          
#>  Length:502         Length:502         Length:502         Length:502        
#>  Class :character   Class :character   Class :character   Class :character  
#>  Mode  :character   Mode  :character   Mode  :character   Mode  :character  
#>                                                                             
#>                                                                             
#>                                                                             
#>                                                                             
#>     Bound                Dim               DifVal             LCP        
#>  Length:502         Min.   :    0.25   Min.   :   0.74   Min.   : 11.95  
#>  Class :character   1st Qu.:  267.50   1st Qu.:  23.86   1st Qu.: 68.89  
#>  Mode  :character   Median :  742.00   Median : 116.70   Median :125.34  
#>                     Mean   : 1392.47   Mean   : 210.52   Mean   :158.96  
#>                     3rd Qu.: 1713.75   3rd Qu.: 274.64   3rd Qu.:241.91  
#>                     Max.   :14338.00   Max.   :1319.53   Max.   :389.02  
#>                                                                          
#>       ETA             DistGr       Threshold           Posture         
#>  Min.   : 0.150   Min.   :0.020   Length:502         Length:502        
#>  1st Qu.: 2.220   1st Qu.:0.880   Class :character   Class :character  
#>  Median : 6.255   Median :1.220   Mode  :character   Mode  :character  
#>  Mean   :11.778   Mean   :1.225                                        
#>  3rd Qu.:12.985   3rd Qu.:1.520                                        
#>  Max.   :45.960   Max.   :3.450                                        
#>                                                                        
#>       View          ClustersI       ClustersII     ClustersIII   
#>  Min.   : 0.000   Min.   :1.000   Min.   :1.000   Min.   :1.000  
#>  1st Qu.: 3.000   1st Qu.:1.000   1st Qu.:1.000   1st Qu.:1.000  
#>  Median : 5.000   Median :2.000   Median :2.000   Median :2.000  
#>  Mean   : 6.763   Mean   :1.739   Mean   :1.722   Mean   :2.031  
#>  3rd Qu.:10.000   3rd Qu.:2.000   3rd Qu.:2.000   3rd Qu.:2.750  
#>  Max.   :26.000   Max.   :4.000   Max.   :3.000   Max.   :5.000  
#>                                   NA's   :48      NA's   :48

#Access Difficulty Values statistics in each Cave

a_access <- a[,c(2,15)]
a_Etxeberri <- filter(a_access, Cave == "Etxeberri")
a_Etxeberri <- mutate(a_Etxeberri, Etxeberri=DifVal)
a_Etxeberri <- tibble::rowid_to_column(a_Etxeberri, "ID")
a_Etxeberri <- a_Etxeberri[,c(1,4)]
a_Alkerdi <- filter(a_access, Cave == "Alkerdi 1")
a_Alkerdi <- mutate(a_Alkerdi, Alkerdi_1=DifVal)
a_Alkerdi <- tibble::rowid_to_column(a_Alkerdi, "ID")
a_Alkerdi <- a_Alkerdi[,c(1,4)]
a_Aitzbitarte_IV <- filter(a_access, Cave == "Aitzbitarte IV")
a_Aitzbitarte_IV <- mutate(a_Aitzbitarte_IV, Aitzbitarte_IV=DifVal)
a_Aitzbitarte_IV <- tibble::rowid_to_column(a_Aitzbitarte_IV, "ID")
a_Aitzbitarte_IV <- a_Aitzbitarte_IV[,c(1,4)]
a_Aitzbitarte_V <- filter(a_access, Cave == "Aitzbitarte V")
a_Aitzbitarte_V <- mutate(a_Aitzbitarte_V, Aitzbitarte_V=DifVal)
a_Aitzbitarte_V <- tibble::rowid_to_column(a_Aitzbitarte_V, "ID")
a_Aitzbitarte_V <- a_Aitzbitarte_V[,c(1,4)]
a_Altxerri <- filter(a_access, Cave == "Altxerri")
a_Altxerri <- mutate(a_Altxerri, Altxerri=DifVal)
a_Altxerri <- tibble::rowid_to_column(a_Altxerri, "ID")
a_Altxerri <- a_Altxerri[,c(1,4)]
a_Ekain <- filter(a_access, Cave == "Ekain")
a_Ekain <- mutate(a_Ekain, Ekain=DifVal)
a_Ekain <- tibble::rowid_to_column(a_Ekain, "ID")
a_Ekain <- a_Ekain[,c(1,4)]
a_Atxurra <- filter(a_access, Cave == "Atxurra")
a_Atxurra <- mutate(a_Atxurra, Atxurra=DifVal)
a_Atxurra <- tibble::rowid_to_column(a_Atxurra, "ID")
a_Atxurra <- a_Atxurra[,c(1,4)]
a_Lumentxa <- filter(a_access, Cave == "Lumentxa")
a_Lumentxa <- mutate(a_Lumentxa, Lumentxa=DifVal)
a_Lumentxa <- tibble::rowid_to_column(a_Lumentxa, "ID")
a_Lumentxa <- a_Lumentxa[,c(1,4)]
a_Santimamiñe <- filter(a_access, Cave == "Santimamiñe")
a_Santimamiñe <- mutate(a_Santimamiñe, Santimamiñe=DifVal)
a_Santimamiñe <- tibble::rowid_to_column(a_Santimamiñe, "ID")
a_Santimamiñe <- a_Santimamiñe[,c(1,4)]
DiffValues<-merge(a_Etxeberri,merge(a_Alkerdi,merge(a_Aitzbitarte_IV,
  merge(a_Aitzbitarte_V,merge(a_Altxerri,merge(a_Ekain,merge(a_Atxurra,
  merge(a_Lumentxa,a_Santimamiñe,all=TRUE),all=TRUE),all=TRUE),all=TRUE),
  all=TRUE),all=TRUE),all=TRUE),all=TRUE)
DiffValues<-DiffValues[,c(2,4,10,8,5,3,7,6,9)]
boxplot(DiffValues, col="bisque1",ylab="Access difficulty values")

#LCP Values statistics in each Cave

a_lcp <- a[,c(2,16)]
a_Etxeberri <- filter(a_lcp, Cave == "Etxeberri")
a_Etxeberri <- mutate(a_Etxeberri, Etxeberri=LCP)
a_Etxeberri <- tibble::rowid_to_column(a_Etxeberri, "ID")
a_Etxeberri <- a_Etxeberri[,c(1,4)]
a_Alkerdi <- filter(a_lcp, Cave == "Alkerdi 1")
a_Alkerdi <- mutate(a_Alkerdi, Alkerdi_1=LCP)
a_Alkerdi <- tibble::rowid_to_column(a_Alkerdi, "ID")
a_Alkerdi <- a_Alkerdi[,c(1,4)]
a_Aitzbitarte_IV <- filter(a_lcp, Cave == "Aitzbitarte IV")
a_Aitzbitarte_IV <- mutate(a_Aitzbitarte_IV, Aitzbitarte_IV=LCP)
a_Aitzbitarte_IV <- tibble::rowid_to_column(a_Aitzbitarte_IV, "ID")
a_Aitzbitarte_IV <- a_Aitzbitarte_IV[,c(1,4)]
a_Aitzbitarte_V <- filter(a_lcp, Cave == "Aitzbitarte V")
a_Aitzbitarte_V <- mutate(a_Aitzbitarte_V, Aitzbitarte_V=LCP)
a_Aitzbitarte_V <- tibble::rowid_to_column(a_Aitzbitarte_V, "ID")
a_Aitzbitarte_V <- a_Aitzbitarte_V[,c(1,4)]
a_Altxerri <- filter(a_lcp, Cave == "Altxerri")
a_Altxerri <- mutate(a_Altxerri, Altxerri=LCP)
a_Altxerri <- tibble::rowid_to_column(a_Altxerri, "ID")
a_Altxerri <- a_Altxerri[,c(1,4)]
a_Ekain <- filter(a_lcp, Cave == "Ekain")
a_Ekain <- mutate(a_Ekain, Ekain=LCP)
a_Ekain <- tibble::rowid_to_column(a_Ekain, "ID")
a_Ekain <- a_Ekain[,c(1,4)]
a_Atxurra <- filter(a_lcp, Cave == "Atxurra")
a_Atxurra <- mutate(a_Atxurra, Atxurra=LCP)
a_Atxurra <- tibble::rowid_to_column(a_Atxurra, "ID")
a_Atxurra <- a_Atxurra[,c(1,4)]
a_Lumentxa <- filter(a_lcp, Cave == "Lumentxa")
a_Lumentxa <- mutate(a_Lumentxa, Lumentxa=LCP)
a_Lumentxa <- tibble::rowid_to_column(a_Lumentxa, "ID")
a_Lumentxa <- a_Lumentxa[,c(1,4)]
a_Santimamiñe <- filter(a_lcp, Cave == "Santimamiñe")
a_Santimamiñe <- mutate(a_Santimamiñe, Santimamiñe=LCP)
a_Santimamiñe <- tibble::rowid_to_column(a_Santimamiñe, "ID")
a_Santimamiñe <- a_Santimamiñe[,c(1,4)]
LeastCostPath<-merge(a_Etxeberri,merge(a_Alkerdi,merge(a_Aitzbitarte_IV,
  merge(a_Aitzbitarte_V,merge(a_Altxerri,merge(a_Ekain,merge(a_Atxurra,
  merge(a_Lumentxa,a_Santimamiñe,all=TRUE),all=TRUE),all=TRUE),all=TRUE),
  all=TRUE),all=TRUE),all=TRUE),all=TRUE)
LeastCostPath<-LeastCostPath[,c(8,2,4,6,7,5,10,3,9)]
boxplot(LeastCostPath, col="bisque1",ylab="Least cost path length (m)")

#ETA Values statistics in each Cave

a_eta <- a[,c(2,17)]
a_Etxeberri <- filter(a_eta, Cave == "Etxeberri")
a_Etxeberri <- mutate(a_Etxeberri, Etxeberri=ETA)
a_Etxeberri <- tibble::rowid_to_column(a_Etxeberri, "ID")
a_Etxeberri <- a_Etxeberri[,c(1,4)]
a_Alkerdi <- filter(a_eta, Cave == "Alkerdi 1")
a_Alkerdi <- mutate(a_Alkerdi, Alkerdi_1=ETA)
a_Alkerdi <- tibble::rowid_to_column(a_Alkerdi, "ID")
a_Alkerdi <- a_Alkerdi[,c(1,4)]
a_Aitzbitarte_IV <- filter(a_eta, Cave == "Aitzbitarte IV")
a_Aitzbitarte_IV <- mutate(a_Aitzbitarte_IV, Aitzbitarte_IV=ETA)
a_Aitzbitarte_IV <- tibble::rowid_to_column(a_Aitzbitarte_IV, "ID")
a_Aitzbitarte_IV <- a_Aitzbitarte_IV[,c(1,4)]
a_Aitzbitarte_V <- filter(a_eta, Cave == "Aitzbitarte V")
a_Aitzbitarte_V <- mutate(a_Aitzbitarte_V, Aitzbitarte_V=ETA)
a_Aitzbitarte_V <- tibble::rowid_to_column(a_Aitzbitarte_V, "ID")
a_Aitzbitarte_V <- a_Aitzbitarte_V[,c(1,4)]
a_Altxerri <- filter(a_eta, Cave == "Altxerri")
a_Altxerri <- mutate(a_Altxerri, Altxerri=ETA)
a_Altxerri <- tibble::rowid_to_column(a_Altxerri, "ID")
a_Altxerri <- a_Altxerri[,c(1,4)]
a_Ekain <- filter(a_eta, Cave == "Ekain")
a_Ekain <- mutate(a_Ekain, Ekain=ETA)
a_Ekain <- tibble::rowid_to_column(a_Ekain, "ID")
a_Ekain <- a_Ekain[,c(1,4)]
a_Atxurra <- filter(a_eta, Cave == "Atxurra")
a_Atxurra <- mutate(a_Atxurra, Atxurra=ETA)
a_Atxurra <- tibble::rowid_to_column(a_Atxurra, "ID")
a_Atxurra <- a_Atxurra[,c(1,4)]
a_Lumentxa <- filter(a_eta, Cave == "Lumentxa")
a_Lumentxa <- mutate(a_Lumentxa, Lumentxa=ETA)
a_Lumentxa <- tibble::rowid_to_column(a_Lumentxa, "ID")
a_Lumentxa <- a_Lumentxa[,c(1,4)]
a_Santimamiñe <- filter(a_eta, Cave == "Santimamiñe")
a_Santimamiñe <- mutate(a_Santimamiñe, Santimamiñe=ETA)
a_Santimamiñe <- tibble::rowid_to_column(a_Santimamiñe, "ID")
a_Santimamiñe <- a_Santimamiñe[,c(1,4)]
EstimatedTimeArrival<-merge(a_Etxeberri,merge(a_Alkerdi,merge(a_Aitzbitarte_IV,
  merge(a_Aitzbitarte_V,merge(a_Altxerri,merge(a_Ekain,merge(a_Atxurra,
  merge(a_Lumentxa,a_Santimamiñe,all=TRUE),all=TRUE),all=TRUE),all=TRUE),
  all=TRUE),all=TRUE),all=TRUE),all=TRUE)
EstimatedTimeArrival<-EstimatedTimeArrival[,c(8,2,4,10,5,7,3,6,9)]
boxplot(EstimatedTimeArrival, col="bisque1",ylab="Estimated minutes to arrive")

#Estimated viewers statistics in each Cave

a_viewers <- a[,c(2,21)]
a_Etxeberri <- filter(a_viewers, Cave == "Etxeberri")
a_Etxeberri <- mutate(a_Etxeberri, Etxeberri=View)
a_Etxeberri <- tibble::rowid_to_column(a_Etxeberri, "ID")
a_Etxeberri <- a_Etxeberri[,c(1,4)]
a_Alkerdi <- filter(a_viewers, Cave == "Alkerdi 1")
a_Alkerdi <- mutate(a_Alkerdi, Alkerdi_1=View)
a_Alkerdi <- tibble::rowid_to_column(a_Alkerdi, "ID")
a_Alkerdi <- a_Alkerdi[,c(1,4)]
a_Aitzbitarte_IV <- filter(a_viewers, Cave == "Aitzbitarte IV")
a_Aitzbitarte_IV <- mutate(a_Aitzbitarte_IV, Aitzbitarte_IV=View)
a_Aitzbitarte_IV <- tibble::rowid_to_column(a_Aitzbitarte_IV, "ID")
a_Aitzbitarte_IV <- a_Aitzbitarte_IV[,c(1,4)]
a_Aitzbitarte_V <- filter(a_viewers, Cave == "Aitzbitarte V")
a_Aitzbitarte_V <- mutate(a_Aitzbitarte_V, Aitzbitarte_V=View)
a_Aitzbitarte_V <- tibble::rowid_to_column(a_Aitzbitarte_V, "ID")
a_Aitzbitarte_V <- a_Aitzbitarte_V[,c(1,4)]
a_Altxerri <- filter(a_viewers, Cave == "Altxerri")
a_Altxerri <- mutate(a_Altxerri, Altxerri=View)
a_Altxerri <- tibble::rowid_to_column(a_Altxerri, "ID")
a_Altxerri <- a_Altxerri[,c(1,4)]
a_Ekain <- filter(a_viewers, Cave == "Ekain")
a_Ekain <- mutate(a_Ekain, Ekain=View)
a_Ekain <- tibble::rowid_to_column(a_Ekain, "ID")
a_Ekain <- a_Ekain[,c(1,4)]
a_Atxurra <- filter(a_viewers, Cave == "Atxurra")
a_Atxurra <- mutate(a_Atxurra, Atxurra=View)
a_Atxurra <- tibble::rowid_to_column(a_Atxurra, "ID")
a_Atxurra <- a_Atxurra[,c(1,4)]
a_Lumentxa <- filter(a_viewers, Cave == "Lumentxa")
a_Lumentxa <- mutate(a_Lumentxa, Lumentxa=View)
a_Lumentxa <- tibble::rowid_to_column(a_Lumentxa, "ID")
a_Lumentxa <- a_Lumentxa[,c(1,4)]
a_Santimamiñe <- filter(a_viewers, Cave == "Santimamiñe")
a_Santimamiñe <- mutate(a_Santimamiñe, Santimamiñe=View)
a_Santimamiñe <- tibble::rowid_to_column(a_Santimamiñe, "ID")
a_Santimamiñe <- a_Santimamiñe[,c(1,4)]
Viewers<-merge(a_Etxeberri,merge(a_Alkerdi,merge(a_Aitzbitarte_IV,
  merge(a_Aitzbitarte_V,merge(a_Altxerri,merge(a_Ekain,merge(a_Atxurra,
  merge(a_Lumentxa,a_Santimamiñe,all=TRUE),all=TRUE),all=TRUE),all=TRUE),
  all=TRUE),all=TRUE),all=TRUE),all=TRUE)
Viewers<-Viewers[,c(7,9,8,10,6,2,5,3,4)]
boxplot(Viewers, col="bisque1",ylab="Estimated maximum nº of viewers")

#Analyse estimated posture of the artist, according to each Cave

a_Caves <- a[,c(2,20)]
a_Caves_a <- a_Caves %>%
  filter(Posture != "NULL") %>%
  group_by(Cave) %>%
  count(Posture) %>%
  mutate(perc = (n/sum(n)*100))

ggplot(a_Caves_a, aes(Cave,perc,fill= Posture))+
  geom_bar(stat = "identity")+
  scale_fill_manual("Posture", values = c("1 Kneeling" = "sienna1", 
  "2 Leaning" = "bisque1","3 Lean/Up" = "lightblue","4 Upright" = "lawngreen",
  "5 Elevated" = "springgreen4"))+
  labs(X= "ClustersI", y= "Posture")

#Analyse estimated posture of the artist, according to each Cluster
#Clusters 1 to 4 from 1st FAMD and HCPC (ClustersI)

a_ClustersI <- a[,c(20,22)]
a_ClustersI_a <- a_ClustersI %>%
  filter(Posture != "NULL") %>%
  group_by(ClustersI) %>%
  count(Posture) %>%
  mutate(perc = (n/sum(n)*100))

ggplot(a_ClustersI_a, aes(ClustersI,perc,fill= Posture))+
  geom_bar(stat = "identity")+
  scale_fill_manual("Posture", values = c("1 Kneeling" = "sienna1", 
  "2 Leaning" = "bisque1","3 Lean/Up" = "lightblue","4 Upright" = "lawngreen",
  "5 Elevated" = "springgreen4"))+
  labs(X= "ClustersI", y= "Posture")

#Clusters 1 to 3 from 2nd FAMD and HCPC (ClustersII)

a_ClustersII <- a[,c(20,23)]
a_ClustersII_a <- a_ClustersII %>%
  filter(Posture != "NULL") %>%
  group_by(ClustersII) %>%
  count(Posture) %>%
  mutate(perc = (n/sum(n)*100))

ggplot(a_ClustersII_a, aes(ClustersII,perc,fill= Posture))+
  geom_bar(stat = "identity")+
  scale_fill_manual("Posture", values = c("1 Kneeling" = "sienna1", 
  "2 Leaning" = "bisque1","3 Lean/Up" = "lightblue","4 Upright" = "lawngreen",
  "5 Elevated" = "springgreen4"))+
  labs(X= "ClustersII", y= "Posture")
#> Warning: Removed 5 rows containing missing values (`position_stack()`).

#Clusters 1 to 5 from 3rd FAMD and HCPC (ClustersIII)

a_ClustersIII <- a[,c(20,24)]
a_ClustersIII_a <- a_ClustersIII %>%
  filter(Posture != "NULL") %>%
  group_by(ClustersIII) %>%
  count(Posture) %>%
  mutate(perc = (n/sum(n)*100))

ggplot(a_ClustersIII_a, aes(ClustersIII,perc,fill= Posture))+
  geom_bar(stat = "identity")+
  scale_fill_manual("Posture", values = c("1 Kneeling" = "sienna1", 
  "2 Leaning" = "bisque1","3 Lean/Up" = "lightblue","4 Upright" = "lawngreen",
  "5 Elevated" = "springgreen4"))+
  labs(X= "ClustersIII", y= "Posture")
#> Warning: Removed 5 rows containing missing values (`position_stack()`).

Created on 2023-08-18 with reprex v2.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant