From 11f3a570142399ab62bd8ca1507a2eabf45e4b70 Mon Sep 17 00:00:00 2001 From: marcelcosta Date: Fri, 27 Jan 2023 12:56:03 +0100 Subject: [PATCH] =?UTF-8?q?C=C3=A1lculo=20de=20Vol=C3=BAmenes.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- invivos/app.R | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/invivos/app.R b/invivos/app.R index 9f9a0d7..bc56f91 100755 --- a/invivos/app.R +++ b/invivos/app.R @@ -349,6 +349,13 @@ server <- function(input, output) { if (!is.null(input$file_analy)){ table<-read.xlsx(input$file_analy$datapath, sheet = 1, check.names = F, sep.names = " ") 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]]) + table[i,"Volume"]<-sum(sapply(1:length(long), function(x) (long[x]*wide[x]*wide[x])*(pi/6))) + } analysis$taula<-table } })