Export File Error In R ?
0
0
Entering edit mode
5.0 years ago
Pluto ▴ 10

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 • 3.8k views
ADD COMMENT
0
Entering edit mode

is file defined?

ADD REPLY
0
Entering edit mode

SURE I created one named file

ADD REPLY
1
Entering edit mode

Please share the line where you defined file

ADD REPLY
0
Entering edit mode

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

ADD REPLY
2
Entering edit mode

And just with :

toSBML(network,"C:/Users/T440s/Desktop/network.sbml", bitString = c(rep(1,length(network$reacID))),version=c("standard","cellnopt"))
ADD REPLY
2
Entering edit mode

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 REPLY

Login before adding your answer.

Traffic: 1972 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6