Re: [R] Count data in random Forest

2023-05-18 Thread Bert Gunter
This is R-**Help**, not R- **we give you all the answers.** Please read and follow the posting guide linked below for what sorts of questions are appropriate for this list and what you should include when asking them. Incidentally, there are several packages in R that do (versions of) random fores

Re: [R] Count data in random Forest

2023-05-18 Thread Suriya Kannan
Respected Sir Good Evening. My name is V.Suriya, I am a research scholar. Doing my Ph.D at University of Madras, Tamil Nadu, India. I need the r code for random forest count data. It helps me lot to complete my research work sir. And also need the r code for comparison of predictors with the help

Re: [R] suprising behaviour of tryCatch()

2023-05-18 Thread Berwin A Turlach
G'day Henrik, On Thu, 18 May 2023 08:35:38 -0700 Henrik Bengtsson wrote: > ... or just put the R expression inside curly brackets, e.g. I was wondering whether I was having a fortunes::fortune(106) moment. :-) Cheers, Berwin __ R-help@r-pro

Re: [R] suprising behaviour of tryCatch()

2023-05-18 Thread Berwin A Turlach
G'day Greg, On Thu, 18 May 2023 08:57:55 -0600 Greg Snow <538...@gmail.com> wrote: [...] > `fun(x <- expr)` Assigns the value of `expr` to the variable `x` in > the frame/environment that `fun` is called from. Only if the argument 'x' is evaluated during the function call AFAIK. If it is not, d

Re: [R] suprising behaviour of tryCatch()

2023-05-18 Thread Henrik Bengtsson
... or just put the R expression inside curly brackets, e.g. tryCatch({ sexsnp[i] = fisher.test(table(data[,3], data[,i+38]))$p }, error=function(e) print(NA)) Exercise: Compare > list(a = 2) $a [1] 2 with > list({ a = 2 }) [[1]] [1] 2 and > list(b = { a = 2 }) $b [1] 2 BTW, note how the

Re: [R] suprising behaviour of tryCatch()

2023-05-18 Thread Berwin A Turlach
G'day Federico, On Wed, 17 May 2023 10:42:17 + "Calboli Federico (LUKE)" 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] ="

Re: [R] suprising behaviour of tryCatch()

2023-05-18 Thread Berwin A Turlach
G'day Federico, On Wed, 17 May 2023 10:42:17 + "Calboli Federico (LUKE)" wrote: > I_d be obliged if someone can explain why tryCatch assigns items with _<-_ > and not _=_. It is not just tryCatch but any function. In function calls the "=" is used to assign actual arguments to formal argu

Re: [R] suprising behaviour of tryCatch()

2023-05-18 Thread Greg Snow
Because `<-` and `=` do different things (and I am one of the old fossils that wish they had not been confounded). `fun(x <- expr)` Assigns the value of `expr` to the variable `x` in the frame/environment that `fun` is called from. `fun(x = expr)` Assigns the value of `expr`to the variable `x` in

Re: [R] suprising behaviour of tryCatch()

2023-05-18 Thread Bill Dunlap
> The only difference is the use of ’=’ or ‘<-‘ to assign the p value of the fisher test to the vector. I stopped using ‘<-‘ eons ago so it took a bit to figure out. The '=' has a context-dependent meaning - in a function call it is used to name arguments and outside of a function call it is use

[R] suprising behaviour of tryCatch()

2023-05-18 Thread Calboli Federico (LUKE)
Hello, I run a fisher.test() in a loop, with the issue that some of the data will not be useable. To protect the loop I used tryCatch but: 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: unexpecte

Re: [R] mclapply enters into an infinite loop....

2023-05-18 Thread Ivan Krylov
On Wed, 17 May 2023 13:55:59 + akshay kulkarni wrote: > So that means mclapply should run properly, i.e output a try class > object and exit. But it didn't. Can you shed some light on why this > happened? What's your sessionInfo()? Are you using a GUI frontend? mclapply() relies on the fork