covaruber / sommer

38 stars 25 forks source link

bug in vpredict #29

Closed johannesgeibel closed 3 years ago

johannesgeibel commented 3 years ago

Hi, there seems to be a bug in vpredict that prevents the output of class "vpredict.mmer" to behave like a data.frame. If you consider to change this code at the end:

toreturn2 <- data.frame(row.names = tname, Estimate = tvalue, SE = se)
class(toreturn2) <- "vpredict.mmer"

to:

toreturn2 <- data.frame(Estimate = tvalue, SE = se)
rownames(toreturn2 ) <- tname # seemed not to be evaluated correctly before in all cases
class(toreturn2) <- c("vpredict.mmer","data.frame") # allows data.frame inheritance

all data.frame methods should work, too and handling will be eased

Regards, Johannes

covaruber commented 3 years ago

Thanks for noticing this Johannes. I have added your lines of code and I will push it in the next minutes :)