-
Notifications
You must be signed in to change notification settings - Fork 3
/
server.R
52 lines (41 loc) · 1.41 KB
/
server.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
# server.R
shinyServer(function(input, output, session){
output$titlePNG<-renderImage({
list(src="images/title.png", alt=NULL)
},deleteFile=FALSE)
output$logoPNG<-renderImage({
list(src="images/logo.png", alt=NULL)
},deleteFile=FALSE)
output$algoPNG<-renderImage({
list(src="images/redhyte algo.png",alt=NULL)
},deleteFile=FALSE)
Data<-reactive({
datFile<-input$datFile
path<-as.character(datFile$datapath)
df<-read.csv(path,
header=input$datHeader,
sep=input$datSep,
quote=input$datQuote,
stringsAsFactors=F)
if(input$datTranspose == TRUE) df<-t(df)
typ<-NULL
numCl<-NULL
for(i in seq(ncol(df))){
if(is.numeric(df[,i]) && length(unique(df[,i]))>input$maxClass){
typ<-c(typ,"Num")
numCl<-c(numCl,NA)
}
else{
typ<-c(typ,"Cate")
numCl<-c(numCl,length(unique(df[,i])))
}
}
names(typ)<-names(numCl)<-colnames(df)
return(list(df,typ,numCl))
})
#displaying a preview of the data, 10 rows, all columns
output$data.preview<-renderTable({
if(is.null(Data()[1])) return(NULL)
data.frame(Data()[[1]][1:input$previewRows,])
},digits=3)
})