Question: Export File Error In R ?
0
gravatar for Pluto
4 weeks ago by
Pluto0
Germany
Pluto0 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 • 132 views
ADD COMMENTlink modified 4 weeks ago • written 4 weeks ago by Pluto0

is file defined?

ADD REPLYlink written 4 weeks ago by Asaf5.6k

SURE I created one named file

ADD REPLYlink written 4 weeks ago by Pluto0
1

Please share the line where you defined file

ADD REPLYlink written 4 weeks ago by Bastien Hervé4.2k

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

ADD REPLYlink written 4 weeks ago by Pluto0
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 4 weeks ago • written 4 weeks ago by Bastien Hervé4.2k
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 4 weeks ago • written 4 weeks ago by RamRS21k
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: 1195 users visited in the last hour