Question: Export File Error In R ?
0
gravatar for Pluto
11 months ago by
Pluto10
Germany
Pluto10 wrote:

Hi , I executed the following code with that error Error in basename(file) : a character vector argument expected . Any suggestions?

if (!requireNamespace("BiocManager"))
install.packages("BiocManager")
BiocManager::install()
library(CellNOptR)
network =readSIF("C:/Users/T440s/Desktop/network.sif")
file = file.create("C:/Users/T440s/Desktop/network.sbml") 
toSBML(network,file, bitString = c(rep(1,length(network$reacID))),version=c("standard","cellnopt"))
R software error • 282 views
ADD COMMENTlink modified 11 months ago • written 11 months ago by Pluto10

is file defined?

ADD REPLYlink written 11 months ago by Asaf7.2k

SURE I created one named file

ADD REPLYlink written 11 months ago by Pluto10
1

Please share the line where you defined file

ADD REPLYlink written 11 months ago by Bastien Hervé4.5k

file = file.create("C:/Users/T440s/Desktop/network.sbml")

ADD REPLYlink written 11 months ago by Pluto10
2

And just with :

toSBML(network,"C:/Users/T440s/Desktop/network.sbml", bitString = c(rep(1,length(network$reacID))),version=c("standard","cellnopt"))
ADD REPLYlink modified 11 months ago • written 11 months ago by Bastien Hervé4.5k
2

To add to Bastien's point, the file argument to the CellNOptR::toSBML function is the name of the file to save to (according to the manual), which is a plain string.

file.create (as with all file manipulation operations of its class) returns a boolean value based on if the operation succeeded (see the relevant manual. You're passing a TRUE/FALSE value to a parameter than expects a filename string.

ADD REPLYlink modified 11 months ago • written 11 months ago by RamRS26k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 915 users visited in the last hour