Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: 'legend' is of length 0 #18

Open
Adonyo-Emmanuel opened this issue May 9, 2022 · 3 comments
Open

Error: 'legend' is of length 0 #18

Adonyo-Emmanuel opened this issue May 9, 2022 · 3 comments

Comments

@Adonyo-Emmanuel
Copy link

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?

@gc-content
Copy link

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)

@mpage21
Copy link

mpage21 commented Sep 9, 2022

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

@YachengPan
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants