TiagoOlivoto / metan

Package for multi-environment trial analysis
https://tiagoolivoto.github.io/metan/
GNU General Public License v3.0
35 stars 17 forks source link

Same code of "metan" running on on one dataset, but not on similar second dataset #25

Closed Shekhar-789 closed 1 year ago

Shekhar-789 commented 1 year ago

Dear Tiago, Sorry to say that I don't know how to prepare "reprex". But I will be precise.

PROBLEM :- Same code of "metan" to get MGIDI is running on one dataset (df.xlsx, attached) , but not on similar second dataset (df2.xlsx, attached). The code I used is pasted here. It generates following message after line "$$$" in code is run. :::

"Error in cor(means, use = use) : no complete element pairs In addition: Warning message: Missing values observed in the table of means. Using complete observations to compute the correlation matrix. "

CODE :-

getwd() setwd("C:/Users/hp/Desktop/MGIDI") library(metan) library(tidyverse) library(tidyr) library(dplyr) library(rio) df <- import("df2.xlsx", sheet=1) str(df) df <- df %>% mutate(across(where(is_character),as_factor)) str(df) mod <- gamem(df, gen = GEN, rep = REP, resp = c('T1', 'T2','T3','T4','T5','T6','T7'), verbose = F) print(mod) gmd(mod, "blupg")

$$$ mgidi_ind <- mgidi(mod, mineval=1,SI=33,ideotype = c("h, h, h, h, h, h, h")) gmd(mgidi_ind, "MGIDI")

p1 <- plot(mgidi_ind, type = "contribution" ) p2 <- plot(mgidi_ind, SI=33,type = "index", title = "MGIDI for Control") p2 + p1

DATA FILES ATTACHED::-

df.xlsx df2.xlsx

Hope you will consider my limitation and help.

Regards.

TiagoOlivoto commented 1 year ago

Dear @Shekhar-789 This occurs because the T3 in df2 has a genotypic variance equal to zero. Then, all the values are the intercept and you have no variance to compute the correlation.

image

I'd suggest removing such variable

Shekhar-789 commented 1 year ago

Dear Tiago Olivoto, Thank you for your kind support and explanation of the problem. Feeling obliged. You may add this case in the warning in simpler words, if you feel appropriate.

Thank you again.

Regards.

On Tue, 9 May 2023 at 21:31, TiagoOlivoto @.***> wrote:

Dear @Shekhar-789 https://github.com/Shekhar-789 This occurs because the T3 in df2 has a genotypic variance equal to zero. Then, all the values are the intercept and you have no variance to compute the correlation.

[image: image] https://user-images.githubusercontent.com/34458429/237152699-75f5a138-92c8-4592-931e-607897e1ed05.png

I'd suggest removing such variable

— Reply to this email directly, view it on GitHub https://github.com/TiagoOlivoto/metan/issues/25#issuecomment-1540460195, or unsubscribe https://github.com/notifications/unsubscribe-auth/A7TKHEFLNX74BVHBWAPCYBDXFJS5TANCNFSM6AAAAAAXVZWXMI . You are receiving this because you were mentioned.Message ID: @.***>

--

Dr. Shashi Shekhar

Asstt. Professor (Statistics) Department of Agricultural Engineering

Institute of Agricultural Sciences

Banaras Hindu University

Varanasi - 221005 (U.P.) Mobile +91-9454441427