gforge / Gmisc

An R package for creating tables, some plots and other useful utilities too small to merit their own package
49 stars 14 forks source link

Bug in prData2Plot function? (getSvdMostInfluential.R) #66

Closed okingfisher closed 1 year ago

okingfisher commented 1 year ago

I checked the getSvdMostInfluential() function after getting different results in the data output and the plot. I found that it calls Gmisc:::prData2Plot(). It defines a function within a lapply for building the plot x-axis labels (line 128 of getSvdMostInfluential.R). I believe that the line: ret <- paste(c(varnames[1:(prGetMaxNo2Print() - 1)], sprintf("+ %d other", length(x) + 1 - prGetMaxNo2Print())), collapse = "\n") should be: ret <- paste(c(varnames[x[1:(prGetMaxNo2Print() - 1)]], sprintf("+ %d other", length(x) + 1 - prGetMaxNo2Print())), collapse = "\n") Otherwise, it just prints the variable names in order, not the ones corresponding to that group. Greetings!

gforge commented 1 year ago

Thanks! Great that you found this, I've actually not used the function that much but this seems reasonable. I'm having issues running the example due to Error in La.svd(x, nu, nv) : error code 14 from Lapack routine 'dgesdd' - I'll try to install a newer LAPACK abd see if this helps.

gforge commented 1 year ago

Solved

okingfisher commented 1 year ago

Thank you, great work!