how to include System Call Results in Sweave PDF report ?
1
0
Entering edit mode
a.afshinfard ▴ 10
@aafshinfard-7617
Last seen 9.5 years ago
Iran, Islamic Republic Of

Hi everyone!

I need to include Results and Reports of the System calls in Sweave pdf Report but i can't find any parameter for that in chunk parameters.

for example when i apply the code below :

    > system(" makeblastdb -in mouseX.fasta -dbtype nucl -parse_seqids -out mouseXdb")

it Reports :

    Building a new DB, current time: 05/01/2015 18:31:57
    New DB name:   mouseXdb
    New DB title:  mouseX.fasta
    Sequence type: Nucleotide
    Keep Linkouts: T
    Keep MBits: T
    Maximum file size: 1000000000B
    Adding sequences from FASTA; added 1 sequences in 1.08783 seconds.

but I can't put it in Sweave Report with parameters like print, echo and or any other parameters...

as another example I want to include header of a file in my Report using System call to header command

thanks for reading

Sweave rstudio • 1.3k views
ADD COMMENT
0
Entering edit mode
Dan Tenenbaum ★ 8.2k
@dan-tenenbaum-4256
Last seen 5 months ago
United States

Try

system(" makeblastdb -in mouseX.fasta -dbtype nucl -parse_seqids -out mouseXdb", TRUE)

 

ADD COMMENT
0
Entering edit mode

not working ! have you tried it yourself ?

ADD REPLY
0
Entering edit mode

I don't have the makeblastdb binary so I can't test it myself. (BTW you may want to remove the space before 'makeblastdb').

The point is that if you run a command with system(), by default the output of that command is printed to the console but not returned. If you specify the intern argument (the second argument positionally) as TRUE, it returns a character vector. So if your vignette chunk is evaluated and echoed, then you should see that character vector. Try it with a simple command (like ls, if that command exists on your system, which it should unless you are on windows).

 

You should refer to the help for ?system and also check out ?system2 which provides more control over executing system commands.

ADD REPLY

Login before adding your answer.

Traffic: 896 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