-
Notifications
You must be signed in to change notification settings - Fork 1
/
Advanced.R
110 lines (75 loc) · 2.01 KB
/
Advanced.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
library('shiny')
observeEvent(listentoDataInputs(),{
output$advancedsignalchange <- renderUI({
tagList(
selectInput(
'signalchangecolumn',
'Signal Change Column',
choices = names(loadedData())
),
actionButton('signalchange', 'Submit signal change')
)
})
output$advancedfactor <- renderUI({
tagList(
selectInput(
'factorcolumn',
'Force Factor Column',
choices = names(loadedData())
),
actionButton('factorchange', 'Change column to factor')
)
})
output$advancedlog <- renderUI({
tagList(
selectInput(
'logcolumn',
'Log values',
choices = names(loadedData())
),
actionButton('logchange', 'Log column values')
)
})
})
observeEvent(input$signalchange, {
try({
aa <- as.array(input$signalchangecolumn)
tmp <- loadedData()
tmp[aa] <- tmp[aa] * -1
loadedData(tmp) # update reactiveVal
changetext <- isolate(paste0(
'Signal changed to variable ',
input$signalchangecolumn,
' sucessfully'
))
output$signalchangeoutput <- renderText(changetext)
})
})
observeEvent(input$factorchange,{
try({
aa <- as.array(input$factorcolumn)
tmp <- loadedData()
#print(head(tmp[[aa]]))
#print(typeof(tmp[[aa]]))
tmp[[aa]] <- as.factor(tmp[[aa]])
#print(head(tmp[aa]))
loadedData(tmp) # update reactiveVal
changetext <- isolate(paste0(
input$factorcolumn, ' changed to factor variable sucessfully'
))
output$signalchangeoutput <- renderText(changetext)
})
})
observeEvent(input$logchange,{
try({
aa <- as.array(input$logcolumn)
tmp <- loadedData()
tmp[[aa]] <- log(tmp[[aa]])
tmp <- tmp[!is.infinite(rowSums(tmp)),]
loadedData(tmp)
changetext <- isolate(paste0(
input$logcolumn, ' was logged sucessfully'
))
output$signalchangeoutput <- renderText(changetext)
})
})