Browse Source

Corrección errores conversión en análisis.

master
marcelcosta 1 year ago
parent
commit
3e6b97c546
1 changed files with 4 additions and 2 deletions
  1. +4
    -2
      invivos/app.R

+ 4
- 2
invivos/app.R

@ -355,7 +355,7 @@ server <- function(input, output) {
observe({ observe({
if (!is.null(input$file_analy)){ if (!is.null(input$file_analy)){
table<-read.xlsx(input$file_analy$datapath, sheet = 1, check.names = F, sep.names = " ", detectDates = T) table<-read.xlsx(input$file_analy$datapath, sheet = 1, check.names = F, sep.names = " ", detectDates = T)
if("ID animal" %in% colnames(table)){
if("ID.animal" %in% colnames(table)){
table<-table %>% table<-table %>%
rename(Animal=`ID.animal`, Side=`ID.tumor`) rename(Animal=`ID.animal`, Side=`ID.tumor`)
table<-table %>% gather(DayPostInoc, Value, which(!is.na(as.numeric(colnames(table))))) %>% table<-table %>% gather(DayPostInoc, Value, which(!is.na(as.numeric(colnames(table))))) %>%
@ -365,6 +365,7 @@ server <- function(input, output) {
add_column(Weight="", .after="Group") %>% add_column(Weight="", .after="Group") %>%
add_column(Volume="",Observations="") %>% add_column(Volume="",Observations="") %>%
relocate(Side, .after = "Group") relocate(Side, .after = "Group")
table$DayPostInoc<-as.numeric(table$DayPostInoc)
} }
table$Date<-format(table$Date, format="%d/%m/%Y") table$Date<-format(table$Date, format="%d/%m/%Y")
@ -374,6 +375,7 @@ server <- function(input, output) {
wide<-as.numeric(gsub(",",".",strsplit(as.character(table[i,"Wide"]),"+", 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))) table[i,"Volume"]<-sum(sapply(1:length(long), function(x) (long[x]*wide[x]*wide[x])*(pi/6)))
} }
table$Volume<-as.numeric(table$Volume)
## Autocompletado de grupo ## Autocompletado de grupo
table_group<-merge( table_group<-merge(
@ -394,7 +396,7 @@ server <- function(input, output) {
table$Group<-factor(table$Group, levels=levels) table$Group<-factor(table$Group, levels=levels)
table<-filter(table, !is.na(Group)) table<-filter(table, !is.na(Group))
} }
print(str(table))
analysis$taula<-table analysis$taula<-table
} }
}) })

Loading…
Cancel
Save