G'day Federico,

On Wed, 17 May 2023 10:42:17 +0000
"Calboli Federico (LUKE)" <federico.calb...@luke.fi> wrote:

> sexsnp = rep(NA, 1750)
> for(i in 1:1750){tryCatch(sexsnp[i] = fisher.test(table(data[,3],
> data[,i + 38]))$p, error = function(e) print(NA))} Error: unexpected
> '=' in "for(i in 1:1750){tryCatch(sexsnp[i] ="

Try:

R> for(i in 1:1750){tryCatch(eval(expression("sexsnp[i] = 
fisher.test(table(data[,3], data[,i+38]))$p")), error=function(e)print(NA))}

or

R> for(i in 1:1750){tryCatch(bquote("sexsnp[i] = fisher.test(table(data[,3], 
data[,i+38]))$p"), error=function(e) print(NA))}

or 

R> for(i in 1:1750){tryCatch(.("sexsnp[i] = fisher.test(table(data[,3], 
data[,i+38]))$p"), error=function(e) print(NA))}

If you want to use the '='.

Cheers,

        Berwin

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to