-
Notifications
You must be signed in to change notification settings - Fork 1
/
scratch.R
48 lines (29 loc) · 1.26 KB
/
scratch.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
proto.fish <- openxlsx::loadWorkbook(file="~/Desktop/ObsidianSourcing (2).xlsx")
just.fish <- openxlsx::readWorkbook(proto.fish, sheet=5)
p.values <- just.fish
is.sig <- function(p.value){
if(length(p.value)==1 && !is.na(p.value)){
p.value <0.05
} else if(length(p.value)==1 && is.na(p.value)){
FALSE
} else if(length(p.value)!=1){
FALSE
}
}
is.sig.vec <- function(p.values){
first <- as.vector(sapply(p.values, is.sig))
first[is.na(first)] <- FALSE
first
}
is.sig.col <- function(p.value.frame){
p.value.frame[is.na(p.value.frame)] <- 1
logic.frame <- apply(p.value.frame[,-1], 2, is.sig.vec)
origional.columns <- colnames(p.value.frame[,-1])
source.hold <- rep("", length(p.value.frame[,1]))
for(i in 1:length(p.value.frame[,1])){
source.hold[i] <- paste(origional.columns[logic.frame[i,, drop=FALSE]], collapse=", ")
}
source.hold
}
temp.sources <- is.sig.col(p.values)
temp.list <- lapply(temp.sources, function(x) strsplit(x=x, split="\\__")[[1]])