Solucionar problemas con el exportado de volúmenes.
This commit is contained in:
+23
-12
@@ -86,9 +86,14 @@ ui <- fluidPage(
|
||||
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
# Define server logic required to draw a histogram
|
||||
server <- function(input, output) {
|
||||
|
||||
|
||||
# Diseño ------------------------------------------------------------------
|
||||
|
||||
# Diseño
|
||||
dades<-reactiveValues()
|
||||
dades$taula<-NULL
|
||||
@@ -339,8 +344,10 @@ server <- function(input, output) {
|
||||
write.xlsx(list("Measures"=dtemplate, "Groups"=NULL,"Sex"=NULL), file)
|
||||
}
|
||||
)
|
||||
|
||||
# Análisis
|
||||
|
||||
|
||||
# Análisis ----------------------------------------------------------------
|
||||
|
||||
analysis<-reactiveValues()
|
||||
analysis$taula<-NULL
|
||||
analysis$taula_def<-NULL
|
||||
@@ -350,14 +357,12 @@ server <- function(input, output) {
|
||||
table<-read.xlsx(input$file_analy$datapath, sheet = 1, check.names = F, sep.names = " ", detectDates = T)
|
||||
table$Date<-format(table$Date, format="%d/%m/%Y")
|
||||
if ("sex" %in% colnames(table)){table<-select(table, -sex)}
|
||||
table$Long<-gsub(",",".", table$Long)
|
||||
table$Wide<-gsub(",",".", table$Wide)
|
||||
for (i in 1:nrow(table)){
|
||||
long<-as.numeric(strsplit(table[i,"Long"],"+", fixed = T)[[1]])
|
||||
wide<-as.numeric(strsplit(table[i,"Wide"],"+", fixed = T)[[1]])
|
||||
long<-as.numeric(gsub(",",".",strsplit(as.character(table[i,"Long"]),"+", fixed = T)[[1]]))
|
||||
wide<-as.numeric(gsub(",",".",strsplit(as.character(table[i,"Wide"]),"+", fixed = T)[[1]]))
|
||||
table[i,"Volume"]<-sum(sapply(1:length(long), function(x) (long[x]*wide[x]*wide[x])*(pi/6)))
|
||||
}
|
||||
|
||||
|
||||
## Autocompletado de grupo
|
||||
table_group<-merge(
|
||||
table %>% select(Animal, Group) %>% unique() %>% group_by(Animal) %>% count(),
|
||||
@@ -367,9 +372,12 @@ server <- function(input, output) {
|
||||
table<-merge(
|
||||
table %>% select(-Group),
|
||||
table_group
|
||||
) %>% relocate(Group, .after = DayPostInoc) %>% arrange(DayPostInoc, Animal, Side)
|
||||
|
||||
) %>% relocate(Group, .after = DayPostInoc) %>%
|
||||
relocate(Cage, .before = Animal) %>%
|
||||
arrange(DayPostInoc, Animal, Side)
|
||||
|
||||
analysis$taula<-table
|
||||
print(table)
|
||||
}
|
||||
})
|
||||
output$cutoffUI<-renderUI({
|
||||
@@ -615,11 +623,14 @@ server <- function(input, output) {
|
||||
},
|
||||
content = function(file){
|
||||
dtemplate<-analysis$taula
|
||||
write.xlsx(dtemplate,file)
|
||||
# print(str(dtemplate))
|
||||
write.xlsx(dtemplate,file, )
|
||||
}
|
||||
)
|
||||
|
||||
##Exportar
|
||||
|
||||
# Exportar ----------------------------------------------------------------
|
||||
|
||||
output$expPlotUI<- renderUI({
|
||||
observeEvent(analysis$taula, {})
|
||||
if (!is.null(input$file_analy) & !is.null(analysis$taula)){
|
||||
|
||||
Reference in New Issue
Block a user