3 Commits

1 changed files with 15 additions and 6 deletions
Split View
  1. +15
    -6
      invivos/app.R

+ 15
- 6
invivos/app.R

@ -121,12 +121,17 @@ server <- function(input, output) {
}
table$Date<-format(table$Date, format="%d/%m/%Y")
if ("sex" %in% colnames(table)){table<-select(table, -sex)}
for (i in 1:nrow(table)){
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)))
if ("Abs" %in% colnames(table)){
table<-rename(table, "Volume"="Abs")
}else{
for (i in 1:nrow(table)){
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)))
}
table$Volume<-as.numeric(table$Volume)
}
table$Volume<-as.numeric(table$Volume)
if ("Cage" %in% colnames(table)){
table$Animal<-paste0(table$Cage, table$Animal)
table<-table[,-which(colnames(table) == "Cage")]
@ -194,6 +199,7 @@ server <- function(input, output) {
grafic<-eventReactive(input$goButton,{
df<-dades$taula %>% filter(DayPostInoc == input$day_vol)
df<-df[!is.na(df$Volume),]
print(df)
up_cuttof<-input$upcut
low_cuttof<-input$lowcut
@ -326,12 +332,15 @@ server <- function(input, output) {
# timepoint<-c(7,10,13,16,19,22,25)
if (!is.null(input$file_sizes)){
template<-dades$db %>% filter(!is.na(Group)) %>%
template<-dades$db %>%
select(Animal, Group) %>% unique()
dtemplate<-merge(dades$taula %>% select(-Group), template) %>%
arrange(DayPostInoc, Animal, Side) %>%
select(Animal, Date, DayPostInoc, Group, Side,
Weight, Long, Wide, Volume, Observations)
if ("Abs" %in% colnames(read.xlsx(input$file_sizes$datapath, sheet = 1, check.names = F, sep.names = " ", detectDates = T,cols=1:11))){
dtemplate<-rename(dtemplate, "Abs"="Volume")
}
}else{
template<-data.frame(

Loading…
Cancel
Save