n_sites <- length(params$codes) n_confs <- length(params$confs) n_rows <- n_sites*n_confs df <- data.frame(Site = rep(NA, n_rows), Mode = rep(NA, n_rows), Path = rep(NA, n_rows)) df$SiteData = vector("list", n_rows) df$InputObject = vector("list", n_rows) df$Result = vector("list", n_rows) cnt <- 0 for(i in 1:n_sites) { site <- params$codes[i] for(j in 1:n_confs) { conf <- params$confs[j] cnt <- cnt+1 df$Site[cnt] <- site df$Mode[cnt] <- conf df$Path[cnt] <- file.path('Output', packageVersion('medfate')[[1]], params$model, conf, site) file_name_input <- file.path(df$Path[cnt], paste0('simulation_input.rds')) file_name_output <- file.path(df$Path[cnt], paste0('simulation_result.rds')) df$InputObject[[cnt]] = readRDS(file_name_input) df$Result[[cnt]] = readRDS(file_name_output) df$SiteData[[cnt]] <- medfatereports::load_list(site) } }
df_eval <-NULL for(i in 1:n_rows) { eval_REW <- "SWC" %in% names(df$SiteData[[i]]$measuredData) if(eval_REW) { v<-medfate::evaluation_stats(df$Result[[i]], df$SiteData[[i]]$measuredData, type= "REW") if(is.null(df)) df_eval <- v else df_eval <- cbind(df_eval, v) } } if(!is.null(df)) { df_all <- cbind(df[,c("Site", "Mode")], as.data.frame(t(df_eval))) row.names(df_all)<- NULL knitr::kable(df_all) }
df<-NULL cohNamesOut <- character() codesOut <- character() for(i in 1:length(codes)) { cohNames <- row.names(input_objects[[i]]$cohorts) for(j in 1:length(cohNames)) { measured_var <- paste0("E_", cohNames[j]) if(measured_var %in% names(site_data[[i]]$measuredData)) { v<-medfate::evaluation_stats(res[[i]], site_data[[i]]$measuredData, type= "E", cohort = cohNames[j]) if(is.null(df)) df <- v else df <- cbind(df, v) cohNamesOut <-c(cohNamesOut, cohNames[j]) codesOut<- c(codesOut, codes[i]) } } } if(!is.null(df)) { df <- data.frame(plot = codesOut, cohort = cohNamesOut, t(df)) knitr::kable(df, row.names = FALSE) }
df<-NULL wpNamesOut <- character() cohNamesOut <- character() codesOut <- character() for(i in 1:length(codes)) { control<- input_objects[[i]]$control if(control$transpirationMode =="Sperry") { cohNames <- row.names(input_objects[[i]]$cohorts) for(j in 1:length(cohNames)) { measured_var <- paste0("MD_", cohNames[j]) if(measured_var %in% names(site_data[[i]]$measuredData)) { v<-medfate::evaluation_stats(res[[i]], site_data[[i]]$measuredData, type= "WP", cohort = cohNames[j]) if(is.null(df)) df <- v else df <- rbind(df, v) wpNamesOut <-c(wpNamesOut, row.names(v)) cohNamesOut <-c(cohNamesOut, rep(cohNames[j],2)) codesOut<- c(codesOut, rep(codes[i],2)) } } } } if(!is.null(df)) { df <- data.frame(plot = codesOut, cohort = cohNamesOut, WP = wpNamesOut, df) df<- df[order(wpNamesOut),] knitr::kable(df, row.names = FALSE) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.