Last updated: 2021-11-02

Checks: 6 1

Knit directory: HenriqueDGen/

This reproducible R Markdown analysis was created with workflowr (version 1.6.2). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.


The R Markdown file has unstaged changes. To know which version of the R Markdown file created these results, you’ll want to first commit it to the Git repo. If you’re still working on the analysis, you can ignore this warning. When you’re finished, you can run wflow_publish to commit the R Markdown file and build the HTML.

Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.

The command set.seed(20211012) was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.

Great job! Recording the operating system, R version, and package versions is critical for reproducibility.

Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.

Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.

Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.

The results in this page were generated with repository version 5570701. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.

Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish or wflow_git_commit). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:


Ignored files:
    Ignored:    .DS_Store
    Ignored:    .Rhistory
    Ignored:    .Rproj.user/

Untracked files:
    Untracked:  analysis/PCA_DAPC.Rmd

Unstaged changes:
    Modified:   analysis/AnalisesModelosMistos.Rmd
    Deleted:    analysis/SH_PCA_DAPC.Rmd
    Modified:   analysis/index.Rmd

Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.


These are the previous versions of the repository in which changes were made to the R Markdown (analysis/AnalisesModelosMistos.Rmd) and HTML (docs/AnalisesModelosMistos.html) files. If you’ve configured a remote Git repository (see ?wflow_git_remote), click on the hyperlinks in the table below to view the files as they were in that past version.

File Version Author Date Message
html b9ef481 LucianoRogerio 2021-11-02 Build site and add new Data
Rmd 7286357 LucianoRogerio 2021-11-02 Insercao do caractere Area de Antracnose e PCA
html 9f9ffff LucianoRogerio 2021-10-26 Build site.
Rmd 170ea91 LucianoRogerio 2021-10-26 BLUPs + Control Means for Diversity analysis
Rmd 60db375 LucianoRogerio 2021-10-26 BLUPS and Means effects estimated for Diversity analysis
html b8ca347 LucianoRogerio 2021-10-19 Build site.
Rmd b87ceea LucianoRogerio 2021-10-19 Add Mixed Models analysis for the repository
Rmd 106f55c LucianoRogerio 2021-10-19 Update Website
html 106f55c LucianoRogerio 2021-10-19 Update Website
Rmd b9ece4f LucianoRogerio 2021-10-12 Second Commit
html b9ece4f LucianoRogerio 2021-10-12 Second Commit
Rmd d2d70ff LucianoRogerio 2021-10-12 Second Commit
html d2d70ff LucianoRogerio 2021-10-12 Second Commit

Wrong Page?

Introduction

library(here)
here() starts at /Users/lbd54/Documents/GitHub/HenriqueDGen
suppressMessages(library(tidyverse))
suppressMessages(library(plyr))
library(reactable)
suppressMessages(library(data.table))
suppressMessages(source(here::here("code", "MixedModelsFunctions.R")))

PhenoData <- readRDS(here::here("output", "DadosFenotipicosv2.RDS"))


PhenoData$block_number <- as.character(PhenoData$block_number)
PhenoData2 <- PhenoData %>% filter(!is.na(Y))
traits <- unique(PhenoData2$traits)

fmfit <- PhenoData2 %>% dlply(.variables = c("traits"),
                              .fun = analyzeTrial.lme4)
ResFixEffect <- lapply(fmfit, FUN = as.data.frame(anova))
ResAnInt <- matrix(unlist(ResFixEffect,use.names = T),
                   nrow = 2, byrow = F)
ResAnFin <- rbind(ResAnInt[,1:4],
                  ResAnInt[,5:8],
                  ResAnInt[,9:12],
                  ResAnInt[,13:16],
                  ResAnInt[,17:20])
colnames(ResAnFin) <- c("DF", "SumSq", "MeanSq", "Fvalue")
ResAnovaFinal <- data.frame(Trait = rep(traits, each = 2),
                            Factor = rep(c("Control", "Block"),
                                         times = 5),
                            ResAnFin)

# Table 1. Anova of the fixed effects of Cassava foliar diseases
ResAnovaFinal %>% reactable(columns = list(
  SumSq = colDef(format = colFormat(digits = 3, locales = "en-US")),
  MeanSq = colDef(format = colFormat(digits = 3, locales = "en-US")),
  Fvalue = colDef(format = colFormat(digits = 3, locales = "en-US"))))
rdfmfit <- PhenoData2 %>% dlply(.variables = c("traits"),
                                .fun = analyzeTrialrdMod.lme4)


Deviances <- NULL
for(i in traits){
Deviances[[i]] <- data.frame(Deviance.MM(fmfit[[i]], rdfmfit[[i]]))[2,6:8]
rownames(Deviances[[i]]) <- i
  
}
refitting model(s) with ML (instead of REML)
refitting model(s) with ML (instead of REML)
refitting model(s) with ML (instead of REML)
refitting model(s) with ML (instead of REML)
refitting model(s) with ML (instead of REML)
ResDeviances <- data.frame(t(sapply(Deviances, FUN = rbind)))

# Table 2. Deviance Analysis for cassava foliar disease
ResDeviances %>% reactable()
H2 <- sapply(fmfit, FUN = getVarComp.lme4) %>% t() %>% as.data.frame()
colnames(H2) <- c("VarClone", "VarRes")
H2 <- H2 %>% mutate(VarClone = as.numeric(VarClone),
               VarRes = as.numeric(VarRes),
               VarFen = VarClone + VarRes,
               H2 = VarClone/VarFen)
# Table 3. Heritabilities of cassava foliar disease
H2 %>% reactable(columns = list(
  VarClone = colDef(format = colFormat(digits = 4, locales = "en-US")),
  VarRes = colDef(format = colFormat(digits = 4, locales = "en-US")),
  VarFen = colDef(format = colFormat(digits = 4, locales = "en-US")),
  H2 = colDef(format = colFormat(digits = 4, locales = "en-US"))))
### Obter estimativas de médias + Blups dos clones

MediasFix <- as.matrix(sapply(fmfit, FUN = (fixef)))
MediasFix[2:32, ] <- MediasFix[2:32,] +
  matrix(rep(MediasFix[1, 1:5], each = 31), nrow = 31, ncol = 5,
         byrow = F)
MediasFix <- as.data.frame(MediasFix)
rownames(MediasFix)[1] <- "controlClones"
MediasFix$CLONE <- rownames(MediasFix)

MediasFix %<>% filter(CLONE %like% "control") %>%
  as.data.frame() %>% dplyr::select(CLONE, everything())
rownames(MediasFix) <- NULL
MediasFix$CLONE <- gsub(pattern = "control", replacement = "", x = MediasFix$CLONE)
MediasFix %>% filter(CLONE != "Clones") -> MediasFix

#### Obter os efeitos aleatorio dos Clones

BLUPsAle <- lapply(fmfit, FUN = getBLUPs.lme4)

BLUPSDisea <- data.frame(CLONE = rownames(BLUPsAle[1]$AnAr))

for(i in names(BLUPsAle)){
  drg<-data.frame(CLONE = rownames(BLUPsAle[[i]]), stringsAsFactors=F)
  drg[,i] <-BLUPsAle[[i]]
  BLUPSDisea<-merge(BLUPSDisea,drg,by="CLONE",all.x=T)
}

BLUPSDisea <- BLUPSDisea %>% filter(CLONE %like% ":1")
BLUPSDisea$CLONE <- gsub(pattern = ":1", replacement = "", BLUPSDisea$CLONE)

BLUPS <- rbind(BLUPSDisea, MediasFix)

saveRDS(BLUPS, here::here("output", "BLUPsDisease.RDS"))

# Table 3. Blups of the accessions for cassava foliar diseases
BLUPS %>% reactable(defaultPageSize = 25, columns = list(
  AnAr = colDef(format = colFormat(digits = 4, locales = "en-US")),
  Anth = colDef(format = colFormat(digits = 4, locales = "en-US")),
  BlLS = colDef(format = colFormat(digits = 4, locales = "en-US")),
  BrLS = colDef(format = colFormat(digits = 4, locales = "en-US")),
  WhLS = colDef(format = colFormat(digits = 4, locales = "en-US"))))

Next page Last page Back to home


sessionInfo()
R version 4.1.1 (2021-08-10)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Big Sur 11.6.1

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] lme4_1.1-27.1     sommer_4.1.4      crayon_1.4.2      lattice_0.20-44  
 [5] MASS_7.3-54       Matrix_1.3-4      data.table_1.14.2 reactable_0.2.3  
 [9] plyr_1.8.6        forcats_0.5.1     stringr_1.4.0     dplyr_1.0.7      
[13] purrr_0.3.4       readr_2.0.2       tidyr_1.1.4       tibble_3.1.5     
[17] ggplot2_3.3.5     tidyverse_1.3.1   here_1.0.1       

loaded via a namespace (and not attached):
 [1] httr_1.4.2        sass_0.4.0        jsonlite_1.7.2    splines_4.1.1    
 [5] modelr_0.1.8      bslib_0.3.1       assertthat_0.2.1  cellranger_1.1.0 
 [9] yaml_2.2.1        pillar_1.6.4      backports_1.2.1   glue_1.4.2       
[13] digest_0.6.28     promises_1.2.0.1  minqa_1.2.4       rvest_1.0.2      
[17] colorspace_2.0-2  htmltools_0.5.2   httpuv_1.6.3      reactR_0.4.4     
[21] pkgconfig_2.0.3   broom_0.7.9       haven_2.4.3       scales_1.1.1     
[25] whisker_0.4       later_1.3.0       tzdb_0.1.2        git2r_0.28.0     
[29] generics_0.1.1    ellipsis_0.3.2    withr_2.4.2       cli_3.1.0        
[33] magrittr_2.0.1    readxl_1.3.1      evaluate_0.14     fs_1.5.0         
[37] fansi_0.5.0       nlme_3.1-152      xml2_1.3.2        tools_4.1.1      
[41] hms_1.1.1         lifecycle_1.0.1   munsell_0.5.0     reprex_2.0.1     
[45] compiler_4.1.1    jquerylib_0.1.4   rlang_0.4.12      nloptr_1.2.2.2   
[49] grid_4.1.1        rstudioapi_0.13   htmlwidgets_1.5.4 crosstalk_1.1.1  
[53] rmarkdown_2.11    boot_1.3-28       gtable_0.3.0      DBI_1.1.1        
[57] R6_2.5.1          lubridate_1.8.0   knitr_1.36        fastmap_1.1.0    
[61] utf8_1.2.2        workflowr_1.6.2   rprojroot_2.0.2   stringi_1.7.5    
[65] Rcpp_1.0.7        vctrs_0.3.8       dbplyr_2.1.1      tidyselect_1.1.1 
[69] xfun_0.27