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 in rep(NA, (width - length(x))) : invalid 'times' argument #2

Open
SansMorel opened this issue Nov 5, 2019 · 4 comments
Open

Comments

@SansMorel
Copy link

SansMorel commented Nov 5, 2019

Hi, I am having a problem running testCV.
After running prepareFlowSOM on my reference samples I try to run testCV but get the error in the title.

I believe the error originates from this line:

rep(NA,

Perhaps because length(x)>width.

@SansMorel
Copy link
Author

I think the error might be caused by the default value of cluster_values parameter in testCV. If cluster_values is set to a cluster that doesn't exist (for example through using the default parameter) the error seems to occur.
Perhaps an error message could be displayed if cluster_values is set to a nonexistent cluster?

@tomashhurst
Copy link

@SansMorel I came up with the same error. After pulling the function apart, the first problem comes up in this part of testCV, at the end of the function:

res <- named.list(pctgs, cvs, meta_cl) if(plot){ PlotOverviewCV(fsom, res) }

and specifically: PlotOverviewCV(fsom, res) returns:

Error in rep(NA, (width - length(x))) : invalid 'times' argument

So the issues is in the PlotOverviewCV function, which is defined just below it. The issue comes up here:

cv_matrix <- do.call(rbind, lapply(cvs[as.character(cluster_values)], function (x) { c(x, rep(NA, (width - length(x)))) }))

@tomashhurst
Copy link

So yes, it carries the cluster_values value the whole way through to that point. If you change it fro c(5, 10, 15) to c(5, 10) then it works fine.

@SofieVG
Copy link
Member

SofieVG commented Nov 22, 2019

@SansMorel @tomashhurst
I just pushed a fix for this issue, thanks for pointing it out and figuring out where it went wrong! Let me know if you still run into any related problems.

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

3 participants