GWA_tutorial icon indicating copy to clipboard operation
GWA_tutorial copied to clipboard

Error: 'legend' is of length 0

Open Adonyo-Emmanuel opened this issue 2 years ago • 3 comments

When generating a plot to assess the type of relationship in the sample, I do get an R script erro. $ Rscript --no-save Relatedness.R Error in legend(1, 1, xjust = 1, yjust = 1, legend = levels(relatedness$RT), : 'legend' is of length 0 Execution halted.

What might be the problem?

Adonyo-Emmanuel avatar May 09 '22 16:05 Adonyo-Emmanuel

In Relatedness.R change line: relatedness = read.table("pihat_min0.2.genome", header=T)

to: relatedness = read.table("pihat_min0.2.genome", header=T, stringsAsFactors = T)

gc-content avatar Jun 09 '22 12:06 gc-content

Additionally, on the legend line you could change levels(relatedness$RT) to unique(relatedness$RT)

mpage21 avatar Sep 09 '22 19:09 mpage21

In Relatedness.R change line: relatedness = read.table("pihat_min0.2.genome", header=T)

to: relatedness = read.table("pihat_min0.2.genome", header=T, stringsAsFactors = T) Nice! It really works! Thank you very much.

YachengPan avatar Sep 04 '23 06:09 YachengPan