The following object is masked from 'package:ggplot2':
last_plot
The following object is masked from 'package:stats':
filter
The following object is masked from 'package:graphics':
layout
library("gplots")
Attaching package: 'gplots'
The following object is masked from 'package:stats':
lowess
Load data
Using ReadXL to read from Excel spreadsheet.
There are 3095 rows and 823 columns. That’s a lot of data.
x <-read_xlsx("Khoury_Clean_Asplenia_COVID study_18102023.xlsx")
Warning: Expecting logical in HI1996 / R1996C217: got 'Yes'
Warning: Expecting logical in HJ1996 / R1996C218: got 'Yes'
Warning: Expecting logical in HK1996 / R1996C219: got 'No'
Warning: Expecting logical in HL2267 / R2267C220: got 'No'
Warning: Expecting logical in HQ2267 / R2267C225: got 'Yes'
Warning: Expecting logical in IZ2267 / R2267C260: got 'No'
Warning: Expecting logical in JO2267 / R2267C275: got 'No'
New names:
• `` -> `...7`
• `` -> `...10`
• `` -> `...88`
• `Other side-effects` -> `Other side-effects...97`
• `` -> `...147`
• `Other side-effects` -> `Other side-effects...156`
• `` -> `...206`
• `Other side-effects` -> `Other side-effects...215`
• `` -> `...265`
• `Other side-effects` -> `Other side-effects...274`
• `` -> `...324`
• `Other side-effects` -> `Other side-effects...333`
• `` -> `...805`
• `The other vaccine that I received:` -> `The other vaccine that I
received:...808`
• `The other vaccine that I received:` -> `The other vaccine that I
received:...810`
• `The other vaccine that I received:` -> `The other vaccine that I
received:...812`
• `The other vaccine that I received:` -> `The other vaccine that I
received:...814`
• `The other vaccine that I received:` -> `The other vaccine that I
received:...816`
• `` -> `...817`
dim(x)
[1] 3095 823
Look at some simple data visualisation
Gender
Here we will do a simple analysis of the gender composition of this group.
par(mar=c(3,15,2,1))vals <-table(x$`What is your gender?`)vals <- vals[order(vals)]barplot(vals,xlim=c(0,2000),main="gender breakdown",xlab="no. participants",cex.names=0.8,las=1,horiz =TRUE)text(vals+150,((1:length(vals)-0.4)*1.2),labels = vals)
Asplenia in gender groups
Now we will look at the spleen status in these gender groups.
par(mar=c(3,15,25,1))woman <-subset(x,`What is your gender?`=="Woman")man <-subset(x,`What is your gender?`=="Man")womanvals <-table(woman$`Have you ever been diagnosed with a spleen that doesn't work OR had it surgically removed?`)womanvals <- womanvals[order(womanvals)]names(womanvals) <-paste("(W)",names(womanvals))manvals <-table(man$`Have you ever been diagnosed with a spleen that doesn't work OR had it surgically removed?`)manvals <- manvals[order(manvals)]names(manvals) <-paste("(M)",names(manvals))catnames <-names(table(x$`Have you ever been diagnosed with a spleen that doesn't work OR had it surgically removed?`))vals <-cbind("men"=manvals,"women"=womanvals)par(mar=c(5,5,5,1))barplot(vals,horiz =TRUE,las=1,main="spleen status by gender",xlab="no. participants",col=c("white","lightgray","darkgray"))legend("right",legend=catnames,fill =c("white","lightgray","darkgray"),title="spleen status")text(c(15,70,700,40,160,800),1.2*(c(0.9,1.1,1,1.9,2.1,2)-0.4),labels = vals,col="black",cex=1)
pc <-cbind("man"=manvals/sum(manvals)*100,"woman"=womanvals/sum(womanvals)*100)barplot(pc,horiz =TRUE,las=1,main="spleen status by gender",xlab="proportion participants (%)",col =c("white","lightgray","darkgray","white","lightgray","darkgray"))legend("right",legend=catnames,fill =c("white","lightgray","darkgray"),title="spleen status")pcr <-signif(pc,digits =2)text(c(1.5,6,45,2.5,10,45),1.2*(c(0.9,1.1,1,1.9,2.1,2)-0.4),labels = pcr,col="black",cex=1)#plot(0,type='n',axes=FALSE,ann=FALSE)legend("right",legend=catnames,fill =c("white","lightgray","darkgray"),title="spleen status")
Clean NA
Need to check for NA values. Then convert responses to factors and then to numerical values.
I am willing to participate in this project
1 Yes
2 Yes
3 Yes
4 Yes
Have you ever been diagnosed with a spleen that doesn't work OR had it surgically removed?
1 Yes, mine has been removed
2 Yes, mine has been removed
3 Yes, mine has been removed
4 Yes, mine has been removed
Please select your age range What is your gender? ...7
1 41-50 Woman <NA>
2 41-50 Man <NA>
3 51-60 Woman <NA>
4 61-70 Woman <NA>
hist(apply(x2,1,function(y) { length(which(is.na(y))) } ),main="NAs per row",xlab="NA count")
hist(apply(x2,2,function(y) { length(which(is.na(y))) } ),main="NAs per column",xlab="NA count")
List of 4
$ layout: num [1:3095, 1:2] 2.74 5.97 1.99 1.68 -15.09 ...
..- attr(*, "dimnames")=List of 2
.. ..$ : chr [1:3095] "1" "2" "3" "4" ...
.. ..$ : NULL
$ data : num [1:3095, 1:673] 1 2 2 1 2 1 2 2 2 2 ...
..- attr(*, "dimnames")=List of 2
.. ..$ : chr [1:3095] "1" "2" "3" "4" ...
.. ..$ : chr [1:673] "PRIOR TO THE PANDEMIC, did you have any of the below medical conditions?Please tick the one(s) that apply (choice=Allergies)" "PRIOR TO THE PANDEMIC, did you have any of the below medical conditions?Please tick the one(s) that apply (choice=Anxiety)" "PRIOR TO THE PANDEMIC, did you have any of the below medical conditions?Please tick the one(s) that apply (choice=Arthritis)" "PRIOR TO THE PANDEMIC, did you have any of the below medical conditions?Please tick the one(s) that apply (choice=Asthma)" ...
$ knn :List of 2
..$ indexes : num [1:3095, 1:15] 1 2 3 4 5 6 7 8 9 10 ...
.. ..- attr(*, "dimnames")=List of 2
.. .. ..$ : chr [1:3095] "1" "2" "3" "4" ...
.. .. ..$ : NULL
..$ distances: num [1:3095, 1:15] 0 0 0 0 0 0 0 0 0 0 ...
.. ..- attr(*, "dimnames")=List of 2
.. .. ..$ : chr [1:3095] "1" "2" "3" "4" ...
.. .. ..$ : NULL
..- attr(*, "class")= chr "umap.knn"
$ config:List of 24
..$ n_neighbors : int 15
..$ n_components : int 2
..$ metric : chr "euclidean"
..$ n_epochs : int 200
..$ input : chr "data"
..$ init : chr "spectral"
..$ min_dist : num 0.1
..$ set_op_mix_ratio : num 1
..$ local_connectivity : num 1
..$ bandwidth : num 1
..$ alpha : num 1
..$ gamma : num 1
..$ negative_sample_rate: int 5
..$ a : num 1.58
..$ b : num 0.895
..$ spread : num 1
..$ random_state : int 330461345
..$ transform_state : int NA
..$ knn : logi NA
..$ knn_repeats : num 1
..$ verbose : logi FALSE
..$ umap_learn_args : logi NA
..$ method : chr "naive"
..$ metric.function :function (m, origin, targets)
..- attr(*, "class")= chr "umap.config"
- attr(*, "class")= chr "umap"
ma
PRIOR TO THE PANDEMIC, did you have any of the below medical conditions?Please tick the one(s) that apply (choice=Allergies) 1.998028
PRIOR TO THE PANDEMIC, did you have any of the below medical conditions?Please tick the one(s) that apply (choice=Anxiety) 2.000000
PRIOR TO THE PANDEMIC, did you have any of the below medical conditions?Please tick the one(s) that apply (choice=Arthritis) 2.000000
PRIOR TO THE PANDEMIC, did you have any of the below medical conditions?Please tick the one(s) that apply (choice=Asthma) 1.996055
PRIOR TO THE PANDEMIC, did you have any of the below medical conditions?Please tick the one(s) that apply (choice=Autoimmune diseases (e.g. Rheumatoid arthritis, Lupus)) 2.000000
PRIOR TO THE PANDEMIC, did you have any of the below medical conditions?Please tick the one(s) that apply (choice=Bronchiectasis (damage to the airways in the lung)) 1.998028
mb
PRIOR TO THE PANDEMIC, did you have any of the below medical conditions?Please tick the one(s) that apply (choice=Allergies) 1.991736
PRIOR TO THE PANDEMIC, did you have any of the below medical conditions?Please tick the one(s) that apply (choice=Anxiety) 2.000000
PRIOR TO THE PANDEMIC, did you have any of the below medical conditions?Please tick the one(s) that apply (choice=Arthritis) 1.995868
PRIOR TO THE PANDEMIC, did you have any of the below medical conditions?Please tick the one(s) that apply (choice=Asthma) 1.995868
PRIOR TO THE PANDEMIC, did you have any of the below medical conditions?Please tick the one(s) that apply (choice=Autoimmune diseases (e.g. Rheumatoid arthritis, Lupus)) 2.000000
PRIOR TO THE PANDEMIC, did you have any of the below medical conditions?Please tick the one(s) that apply (choice=Bronchiectasis (damage to the airways in the lung)) 2.000000
mc
PRIOR TO THE PANDEMIC, did you have any of the below medical conditions?Please tick the one(s) that apply (choice=Allergies) 1.728477
PRIOR TO THE PANDEMIC, did you have any of the below medical conditions?Please tick the one(s) that apply (choice=Anxiety) 1.000000
PRIOR TO THE PANDEMIC, did you have any of the below medical conditions?Please tick the one(s) that apply (choice=Arthritis) 1.695364
PRIOR TO THE PANDEMIC, did you have any of the below medical conditions?Please tick the one(s) that apply (choice=Asthma) 1.781457
PRIOR TO THE PANDEMIC, did you have any of the below medical conditions?Please tick the one(s) that apply (choice=Autoimmune diseases (e.g. Rheumatoid arthritis, Lupus)) 1.841060
PRIOR TO THE PANDEMIC, did you have any of the below medical conditions?Please tick the one(s) that apply (choice=Bronchiectasis (damage to the airways in the lung)) 1.933775
md
PRIOR TO THE PANDEMIC, did you have any of the below medical conditions?Please tick the one(s) that apply (choice=Allergies) 1.936508
PRIOR TO THE PANDEMIC, did you have any of the below medical conditions?Please tick the one(s) that apply (choice=Anxiety) 1.984127
PRIOR TO THE PANDEMIC, did you have any of the below medical conditions?Please tick the one(s) that apply (choice=Arthritis) 1.878307
PRIOR TO THE PANDEMIC, did you have any of the below medical conditions?Please tick the one(s) that apply (choice=Asthma) 1.962963
PRIOR TO THE PANDEMIC, did you have any of the below medical conditions?Please tick the one(s) that apply (choice=Autoimmune diseases (e.g. Rheumatoid arthritis, Lupus)) 1.936508
PRIOR TO THE PANDEMIC, did you have any of the below medical conditions?Please tick the one(s) that apply (choice=Bronchiectasis (damage to the airways in the lung)) 1.984127
me
PRIOR TO THE PANDEMIC, did you have any of the below medical conditions?Please tick the one(s) that apply (choice=Allergies) 1.848580
PRIOR TO THE PANDEMIC, did you have any of the below medical conditions?Please tick the one(s) that apply (choice=Anxiety) 1.940063
PRIOR TO THE PANDEMIC, did you have any of the below medical conditions?Please tick the one(s) that apply (choice=Arthritis) 1.700315
PRIOR TO THE PANDEMIC, did you have any of the below medical conditions?Please tick the one(s) that apply (choice=Asthma) 1.899054
PRIOR TO THE PANDEMIC, did you have any of the below medical conditions?Please tick the one(s) that apply (choice=Autoimmune diseases (e.g. Rheumatoid arthritis, Lupus)) 1.946372
PRIOR TO THE PANDEMIC, did you have any of the below medical conditions?Please tick the one(s) that apply (choice=Bronchiectasis (damage to the airways in the lung)) 1.971609
mf
PRIOR TO THE PANDEMIC, did you have any of the below medical conditions?Please tick the one(s) that apply (choice=Allergies) 1.536810
PRIOR TO THE PANDEMIC, did you have any of the below medical conditions?Please tick the one(s) that apply (choice=Anxiety) 1.779141
PRIOR TO THE PANDEMIC, did you have any of the below medical conditions?Please tick the one(s) that apply (choice=Arthritis) 1.631902
PRIOR TO THE PANDEMIC, did you have any of the below medical conditions?Please tick the one(s) that apply (choice=Asthma) 1.723926
PRIOR TO THE PANDEMIC, did you have any of the below medical conditions?Please tick the one(s) that apply (choice=Autoimmune diseases (e.g. Rheumatoid arthritis, Lupus)) 1.748466
PRIOR TO THE PANDEMIC, did you have any of the below medical conditions?Please tick the one(s) that apply (choice=Bronchiectasis (damage to the airways in the lung)) 1.975460
mg
PRIOR TO THE PANDEMIC, did you have any of the below medical conditions?Please tick the one(s) that apply (choice=Allergies) 1.827688
PRIOR TO THE PANDEMIC, did you have any of the below medical conditions?Please tick the one(s) that apply (choice=Anxiety) 1.848306
PRIOR TO THE PANDEMIC, did you have any of the below medical conditions?Please tick the one(s) that apply (choice=Arthritis) 1.864507
PRIOR TO THE PANDEMIC, did you have any of the below medical conditions?Please tick the one(s) that apply (choice=Asthma) 1.871870
PRIOR TO THE PANDEMIC, did you have any of the below medical conditions?Please tick the one(s) that apply (choice=Autoimmune diseases (e.g. Rheumatoid arthritis, Lupus)) 1.891016
PRIOR TO THE PANDEMIC, did you have any of the below medical conditions?Please tick the one(s) that apply (choice=Bronchiectasis (damage to the airways in the lung)) 1.988218
Selecting rows with some coefficient of variation.
rn <-gsub("TO THE PANDEMIC, did you have any of the below medical conditions\\?Please tick the one\\(s\\) that apply","symptoms:",rownames(j3))rn <-gsub("Which test did confirm your diagnosis\\?Please tick the one\\(s\\) that apply ","test:",rn)rn <-gsub("Which test did confirm your diagnosis\\? Pleas tick the one\\(s\\) that apply","test:",rn)rn <-gsub("During the FIRST TWO WEEKS of your confirmed COVID diagnosis, did you experience any of the below COVID related-symptoms Please tick the one\\(s\\) that apply","symptoms:",rn)rn <-gsub("If YES, which treatment\\(s\\) did you receive\\? Please tick the one\\(s\\) that apply","teatment:",rn)rn <-gsub("Did you experience any side effects from the treatment\\(s\\)\\? Please tick the one\\(s\\) that apply","side effects:",rn)rn