Question: try command in R
0
gravatar for anu014
10 months ago by
anu014160
India
anu014160 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 • 296 views
ADD COMMENTlink modified 10 months ago by e.rempel710 • written 10 months ago by anu014160
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 10 months ago by Macspider2.6k

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

ADD REPLYlink written 10 months ago by anu014160
2
gravatar for e.rempel
10 months ago by
e.rempel710
Germany, Heidelberg, COS
e.rempel710 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 10 months ago by e.rempel710
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: 1181 users visited in the last hour