Compare commits

..

2 Commits

Author SHA1 Message Date
marcelcosta bdbd8edf9d Corregir lectura de fechas en excel. 2023-01-27 15:23:04 +01:00
marcelcosta dde77d987c Autocompletado de grupo. 2023-01-27 15:20:05 +01:00
+15 -1
View File
@@ -347,7 +347,8 @@ server <- function(input, output) {
analysis$taula_vol<-NULL analysis$taula_vol<-NULL
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 = " ") 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)} if ("sex" %in% colnames(table)){table<-select(table, -sex)}
table$Long<-gsub(",",".", table$Long) table$Long<-gsub(",",".", table$Long)
table$Wide<-gsub(",",".", table$Wide) table$Wide<-gsub(",",".", table$Wide)
@@ -356,6 +357,19 @@ server <- function(input, output) {
wide<-as.numeric(strsplit(table[i,"Wide"],"+", fixed = T)[[1]]) wide<-as.numeric(strsplit(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)))
} }
## Autocompletado de grupo
table_group<-merge(
table %>% select(Animal, Group) %>% unique() %>% group_by(Animal) %>% count(),
table %>% select(Animal, Group) %>% unique()
) %>% filter(n > 1 & (!is.na(Group) | Group != "")) %>% select(-n)
table<-merge(
table %>% select(-Group),
table_group
) %>% relocate(Group, .after = DayPostInoc) %>% arrange(DayPostInoc, Animal, Side)
analysis$taula<-table analysis$taula<-table
} }
}) })