Browse Source

Bug al randomizar con sexo.

master
marcelcosta 10 months ago
parent
commit
43776f80cb
1 changed files with 8 additions and 5 deletions
  1. +8
    -5
      invivos/app.R

+ 8
- 5
invivos/app.R

@ -193,7 +193,7 @@ server <- function(input, output) {
grafic<-eventReactive(input$goButton,{
df<-dades$taula %>% filter(DayPostInoc == input$day_vol)
print(df)
# print(df)
df<-df[!is.na(df$Volume),]
up_cuttof<-input$upcut
low_cuttof<-input$lowcut
@ -223,7 +223,7 @@ server <- function(input, output) {
while(interr == T){
ind<-sample(rep(dades$groups, each=ceiling(length(unique(df_sex$Animal))/ngroup)), length(unique(df_sex$Animal)))
df_sex<-merge(df_sex[,c("Animal", "Side","Volume")], data.frame("Animal"=unique(df_sex$Animal), "group"=as.factor(ind),check.names=F))
print(df_sex)
# print(df_sex)
if ((nrow(df_sex)/ngroup) %% 2 == 0){
interr<-any(table(df_sex$group) < floor(nrow(df_sex)/ngroup) | table(df_sex$group) > ceiling(nrow(df_sex)/ngroup))
}else{
@ -253,11 +253,14 @@ server <- function(input, output) {
if ("Group" %in% colnames(df_def)){
df_def<-df_def %>% select(-"Group")
}
df_def<-merge(
if(!is.null(dades$sex)){merge(dades$taula %>% filter(DayPostInoc == input$day_vol), dades$sex)}else{
if(!is.null(dades$sex)){merge(dades$taula %>% filter(DayPostInoc == input$day_vol), dades$sex)%>% select(-Group)}else{
dades$taula %>% filter(DayPostInoc == input$day_vol) %>% add_column(sex="undefined")} %>% select(-Group),
df_def[,c("Animal", "group")] %>% unique, all=T, by="Animal") %>% rename(Group=group)
df_def<-select(df_def, Animal, Date, DayPostInoc, Group, Side, Weight, Long, Wide, Volume, Observations)
df_def[,c("Animal", "group")] %>% unique, all=T, by="Animal")
df_def<-df_def %>% rename(Group=group)
df_def<-select(df_def, Animal, sex, Date, DayPostInoc, Group, Side, Weight, Long, Wide, Volume, Observations)
# if("DPV" %in% colnames(df_def)){df_def<-select(df_def, c(`ID animal`, `sex`,`ID tumor`, Volume, Cage, Major, Minor, group))}
# if("TS-Deep" %in% colnames(df_def)){df_def<-select(df_def, c(`ID animal`, `sex`,`ID tumor`, Volume, Cage, `TS-Deep`,`TS-Length`,`TS-Width`, group))}

Loading…
Cancel
Save