Question: try command in R
0
gravatar for anu014
2.7 years ago by
anu014180
India
anu014180 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 • 649 views
ADD COMMENTlink modified 2.7 years ago by e.rempel890 • written 2.7 years ago by anu014180
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 2.7 years ago by Macspider3.1k

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

ADD REPLYlink written 2.7 years ago by anu014180
2
gravatar for e.rempel
2.7 years ago by
e.rempel890
Germany, Heidelberg, COS
e.rempel890 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 2.7 years ago by e.rempel890
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: 719 users visited in the last hour