Solucionar bug firstoper.

This commit is contained in:
2024-01-17 13:04:58 +01:00
parent 43776f80cb
commit 455901a1db
+8 -7
View File
@@ -493,12 +493,12 @@ server <- function(input, output) {
scale_x_continuous(expand = expansion(mult = c(0,0.05)), limits = c(0, (round(max(table$DayPostInoc) / 5)+1)*5))+ scale_x_continuous(expand = expansion(mult = c(0,0.05)), limits = c(0, (round(max(table$DayPostInoc) / 5)+1)*5))+
theme_bw() theme_bw()
}else{ }else{
firstoper<- filter(table, !is.na(substr(Observations,1,1)) & substr(Observations,1,1) == "*") %>% firstoper<- filter(table, !is.na(substr(Observations,1,1)) & substr(Observations,1,1) == "*") %>%
pull(DayPostInoc) %>% min(na.rm = T) pull(DayPostInoc) %>% min(na.rm = T)
print(firstoper) if (firstoper == Inf){firstoper<-c()}
if (input$operated == TRUE & nrow(firstoper) > 0){ if (input$operated == TRUE & length(firstoper) > 0){
table<-table %>% filter(DayPostInoc < firstoper) table<-table %>% filter(DayPostInoc < firstoper)
}else{ }else{
deadmice<-filter(table, !is.na(substr(Observations,1,1)) & substr(Observations,1,1) == "+") %>% deadmice<-filter(table, !is.na(substr(Observations,1,1)) & substr(Observations,1,1) == "+") %>%
@@ -569,9 +569,9 @@ server <- function(input, output) {
}else{ }else{
firstoper<- filter(table, !is.na(substr(Observations,1,1)) & substr(Observations,1,1) == "*") %>% firstoper<- filter(table, !is.na(substr(Observations,1,1)) & substr(Observations,1,1) == "*") %>%
pull(DayPostInoc) %>% min(na.rm = T) pull(DayPostInoc) %>% min(na.rm = T)
print(firstoper) if (firstoper == Inf){firstoper<-c()}
if (input$operated == TRUE & nrow(firstoper) > 0){ if (input$operated == TRUE & length(firstoper) > 0){
table<-table %>% filter(DayPostInoc < firstoper) table<-table %>% filter(DayPostInoc < firstoper)
}else{ }else{
deadmice<-filter(table, !is.na(substr(Observations,1,1)) & substr(Observations,1,1) == "+") %>% deadmice<-filter(table, !is.na(substr(Observations,1,1)) & substr(Observations,1,1) == "+") %>%
@@ -601,8 +601,9 @@ server <- function(input, output) {
if (input$vacc == "Sí"){ if (input$vacc == "Sí"){
firstoper<- filter(table, !is.na(substr(Observations,1,1)) & substr(Observations,1,1) == "*") %>% firstoper<- filter(table, !is.na(substr(Observations,1,1)) & substr(Observations,1,1) == "*") %>%
select(DayPostInoc, Side) %>% unique() %>% select(DayPostInoc, Side) %>% unique() %>%
group_by(Side) %>% summarise(FirstOper=min(DayPostInoc)) if (firstoper == Inf){firstoper<-c()}
if (input$operated == TRUE & nrow(firstoper) > 0){
if (input$operated == TRUE & length(firstoper) > 0){
for (i in 1:nrow(firstoper)){ for (i in 1:nrow(firstoper)){
table<-table %>% filter(DayPostInoc < firstoper$FirstOper[i] | Side != firstoper$Side[i]) table<-table %>% filter(DayPostInoc < firstoper$FirstOper[i] | Side != firstoper$Side[i])
} }