HI all..
Newbie and not a coder of R or Rstudio.
We use Rstudio to run and interpret data from a medical instrument. I am constantly getting "Error: 'sheetNames' is not an exported object from 'namespace:gdata" when the program would run without issue previously.
I think it might be related to the Excel macro-enabled spreadsheet not running the VBA code in the previous step but i just dont know. I have tried contacting vendors and other connections but i am not getting anywhere and just need someone to assist (to reiterate, I know absolutely nothing about coding or R but am trying to get patient results out!)
Please help!!
Hi @BronC ,
in your R script you have a piece of code that calls a function named sheetNames. Now since the package gdata doesn't have such a function you get the error.
Without an example (at least a fake one, since i assume you can't share the script itself) it will be hard to help.
Please try to make a minimal example or share the sheetNames function or the piece of code where you call it.
Hi @vedoa
I have searched the script and there is no line calling for sheetNames.
What immediately precedes this, is a script requesting an xls read:
Ask to enter RCC excel file name.
excel.file <- file.choose()
File name can direclty written:
excel.file <- "FileName.xlsm"
#read in the RCC excel file
nano.raw <- read.xls.RCC(x = excel.file, sheet = 1, sample.id="Sample ID")
This xlsm file has embedded macros (which i have enabled to run via developer). The error as above shows in the RStudio console immediately after selecting this file.
The output then shows repeated errors. For example:
Error in .path.package("gdata") : could not find function ".path.package"
nano.raw is divided in two:
nano.raw$x -> sample names with gene names and count numbers.
nano.raw$header -> sample names, file.names, rlf id, fov.count,...
Eliminate the "header" and keep the actual data.
nano.raw <- nano.raw$x
Error: object 'nano.raw' not found
And:
#import the test set
test.data <-list(x=nano.norm, genenames=rownames(nano.norm), y=colnames(nano.norm), geneid=NULL, samplelabels=NULL, batchlabels=NULL)
Error: object 'nano.norm' not found#make predictions
For each samples, calculate confidence to belong to one of the 4 subgroups.
test.predict<-pamr.predict(train.train, test.data$x , threshold=1, type="posterior")
Error in diag.disc((newx - centroid.overall)/sd, delta.shrunk, prior, :
object 'test.data' not found
The script calls the following programs from the library at the start of the script:
NanostringNorm
vsn
pamr (source("pamr.from.excel.R"))
Thanks for trying to help!
Bron.
Hi @BronC ,
so the function read.xls.RCC is part of the (not maintained anymore) NanoStringNorm package which uses gdata in its calls (see source https://rdrr.io/cran/NanoStringNorm/src/R/read.xls.RCC.R).
The problem is that gdata has deprecated all that excel support (see -> Releases · r-gregmisc/gdata · GitHub Release 2.19.0).
So the naive solution would be to revert back to that version of the package which still has the function with:
install.packages("gdata", repos = "https://packagemanager.posit.co/cran/2023-05-06")
This will probably work. But this will not hold for long, since the next time you install new packages - gdata will be updated again (R always uses the newest release).
Now you can freeze everythning like i did above - installing all packages from a freezed repository date (example https://packagemanager.posit.co/cran/2023-05-06). But you are using a package that is not mantained anymore with dependencies which have deprecated their functions (like gdata::sheetNames), so i am afraid that a rewrite is necessary.
@vedoa Thank YOU! I needed to install the earlier version of gdata and also remove and reinstall Perl (and associated libraries) which worked with the msi version. Running gdata::installXLSXsupport after the reboot located the perl libraries and now I can run the script successfully. Thanks again.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.