MareesAT / GWA_tutorial

A comprehensive tutorial about GWAS and PRS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error: 'legend' is of length 0

Adonyo-Emmanuel opened this issue · 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?

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)

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

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.