1

Hi I am trying to use the Finlay Wilkinson regression function FW in R for yield stability analysis. I tried running this, but am getting the below error

Error in FW(y = yield, VAR = genotype, ENV = location, method = "OLS") : object 'genotype' not found

My data file has the headers 'yield', 'genotype' and 'location' on it. Not sure what I am doing wrong here, since I just followed the syntax from the original publication. Please help!

My code below:

crop <- read.csv("barleygt6.csv", header = TRUE)
summary(crop)

install.packages("devtools")
library(devtools)
install.packages("remotes")
remotes::install_github("lian0090/FW")
library(FW)

lm1=FW(y= yield, VAR= genotype, ENV= location, method="OLS")
Anoushiravan R
  • 21,622
  • 3
  • 18
  • 41
  • 1
    It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input that can be used to test and verify possible solutions. Maybe try `lm1 <- with(crop , FW(y= yield, VAR= genotype, ENV= location, method="OLS"))` – MrFlick Feb 21 '22 at 20:34
  • If you are using the GitHub [help](https://github.com/lian0090/FW#basic-usage), notice they use `attach` just before calling `FM`. In R, `attach` is not recommended. Instead, consider `with()` context as MrFlick shows, or `$` extraction: `FW(y= crop$yield, VAR= crop$genotype, ENV= crop$location, method="OLS")` – Parfait Feb 21 '22 at 20:44

0 Answers0