Question: try command in R
0
gravatar for anu014
21 months ago by
anu014170
India
anu014170 wrote:

Hi all,

Can anyone tell me how to use 'try' command for a block of commands? Right now I'm using try for each command like this :

try(m<-MAplot(genes(cuff),args[1],args[2]))
try(png('MA_plot.png'))
try(m)
try(dev.off ())
try(print("MA_plot"))

Please help. Thanks :)

R • 466 views
ADD COMMENTlink modified 21 months ago by e.rempel780 • written 21 months ago by anu014170
1

Maybe this helps: http://mazamascience.com/WorkingWithData/?p=929

However, I would post this on Stack Overflow, this sounds much more like a general IT question than a bioinformatics one.

ADD REPLYlink written 21 months ago by Macspider3.0k

Yeah. That's true. Have to take care next time.. Thanks for answering anyways :)

ADD REPLYlink written 21 months ago by anu014170
2
gravatar for e.rempel
21 months ago by
e.rempel780
Germany, Heidelberg, COS
e.rempel780 wrote:

Hi,

quick Google search redirected me to the book of Hadley Wickham. Here he suggests:

To pass larger blocks of code to try(), wrap them in {}:

try({
a <- 1
b <- "x"
a + b
})

HTH

ADD COMMENTlink written 21 months ago by e.rempel780
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: 1737 users visited in the last hour