[R] " Error in firstnonmiss:lastnonmiss : argument of length 0 "

2019-10-29 Thread phil
I am having a problem that generates the error message: " Error in firstnonmiss:lastnonmiss : argument of length 0 ". There is an article on this in stackoverflow, but I have been unable to understand it well enough to solve my problem. Essentially, I have a data frame with 41 indicator series

Re: [R] decomposing a string representing a valid mathematical expression?

2019-10-29 Thread Bert Gunter
Yes, I agree. Maybe the clumsiness of my example might help clarify the importance of clarifying the context/understanding the difficulty. Cheers, Bert On Tue, Oct 29, 2019 at 5:22 PM Duncan Murdoch wrote: > On 29/10/2019 12:46 p.m., Bert Gunter wrote: > > Does something like the following mak

Re: [R] decomposing a string representing a valid mathematical expression?

2019-10-29 Thread Duncan Murdoch
On 29/10/2019 12:46 p.m., Bert Gunter wrote: Does something like the following make any sense for your context? z <- "(xy+ s)/ (ab +log(4.13))" lapply(parse(text = z), FUN = function(x)strsplit(deparse(x), split = "[[:space:]]+")) [[1]] [[1]][[1]] [1] "(xy""+" "s)/(ab" "+

[R] Parameters tuning in r

2019-10-29 Thread javed khan
For parameter tuning, in the trainControl function, instead of search =random or grid, can we use meta heuristic algorithms such as pso or genetic algorithm? What else we need to include meta heuristic algorithms for parameter Tuning than the steps we follow for grid or random search? Thanks

Re: [R] Error when using qvalue function

2019-10-29 Thread Ana Marija
Hello, I am am correct to assume that here: pvals=q$META qval_obj=qvalue(pvals) #is false discovery rate pi1=1-qval_obj$pi0 #TPR pi1 #TPR pi1 represents True Positive Rate? Thanks Ana On Mon, Oct 28, 2019 at 9:36 PM William Dunlap wrote: > > With qvalue-2.16.0 and R-3.6.1 many calls to qvalu

Re: [R] decomposing a string representing a valid mathematical expression?

2019-10-29 Thread Bert Gunter
Does something like the following make any sense for your context? > z <- "(xy+ s)/ (ab +log(4.13))" > > lapply(parse(text = z), FUN = function(x)strsplit(deparse(x), split = "[[:space:]]+")) [[1]] [[1]][[1]] [1] "(xy""+" "s)/(ab" "+" "log(4.13))" Cheers, Bert Ber

Re: [R] decomposing a string representing a valid mathematical expression?

2019-10-29 Thread Ivan Krylov
On Tue, 29 Oct 2019 13:55:27 +0100 Witold E Wolski wrote: > Since R knows how to parse expressions these type of expressions I > would like to reuse some existing functions and not to use gsub or > strsplit etc. You might be interested in the `parse` function: x <- "(a+b) * c/(d * (e - f))" str

Re: [R] decomposing a string representing a valid mathematical expression?

2019-10-29 Thread Bert Gunter
Not sure what you're looking for, but see ?deparse for deparsing **expressions.** -- Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Tue, Oct 29, 2019 at 5

[R] decomposing a string representing a valid mathematical expression?

2019-10-29 Thread Witold E Wolski
Hello, I would like to decompose a string i.e. "a - b" or "a +b" into an array or list ["a","-","b"] Since R knows how to parse expressions these type of expressions I would like to reuse some existing functions and not to use gsub or strsplit etc. Thank you Witek -- Witold Eryk Wolski