similar to: ifelse logic and multiple assignments

Displaying 20 results from an estimated 10000 matches similar to: "ifelse logic and multiple assignments"

2017 Sep 22
1
Treating NA in timeSeries package
Dear All, I am facing problem with NA treatment in my financial time series data. # data reading aluminum = read.csv(file="alu.csv", header=T, sep=",") fut = aluminum [,2] spt = aluminum [,3] # Missing Value Treatment (Linear Interpolation) spt = interpNA(spt, method = c("linear")) fut = interpNA(fut, method = c("linear")) fut=fut[,1] spt =spt[,1]
2019 Jan 17
1
[hivex PATCH] ruby: improve test functions
Use better functions to check for proper values instead of assert: - refute_nil for non-null functions - assert_equal for checking equality Also, make sure that the parameters for assert_equal are correct: expected value, then got value. --- ruby/tests/tc_120_rlenvalue.rb | 4 ++-- ruby/tests/tc_130_special.rb | 12 ++++++------ ruby/tests/tc_200_write.rb | 4 ++--
2018 Nov 29
2
MRutter PPA versioning issue, again
Michael, ESS broke again on my laptop after I upgraded to Ubuntu 18.10. The elpa-ess package seems to be provided multiple times, sadly the one with xenial (16.04) in its name wins ... and breaks the setup. I one for cosmic, I had one from bionic (18.04), but because the names 'wrapped' the 'x' wins over 'b' and 'c'. We had talked about that in the past, it
2013 Jun 09
2
Minitest mock or stub methods
Hi I''m building a small library to use in my Rails app which interacts with a 3rd party API. It fetches artists and tracks. So I have: lib/my_lib.rb lib/my_lib/artist.rb lib/my_lib/track.rb To get an artist I do artist = MyLib::Artist.find("Oasis") Which returns an instance of Artist if it finds (via 3rd party API) it or nil otherwise. Then I can call artist.tracks which
2011 Oct 19
1
Rails 3.1 and minitest
I''m looking for a simple way to integrate minitest/spec with Rails 3.1. Anybody have it working? There''s an older article on MetaSkills about this but it adds stuff I don''t want. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to
2012 Mar 13
4
minitest validations - is there a cleaner way?
i am trying out minitest, but need some advice on a clean way to test validations. I setup my testing to use minitest by following the following railscast plus i added miniskirt for Factories. http://railscasts.com/episodes/327-minitest-with-rails everything works well, but there has to be a cleaner way of testing failed validations. would i be better off using something besides
2004 Mar 17
1
ANCOVA when you don't know factor levels
Hello people I am doing some thinking about how to analyse data on dimorphic animals - where different individuals of the same species have rather different morphology. An example of this is that some male beetles have large horns and small wings, and rely on beating the other guys up to get access to mates, whereas others have smaller horns and larger wings, and rely on mobility to
2007 Apr 26
3
A coding question involving variable assignments in ifelse()
Dear List, Below is a simple, standard loss model that takes into account the terms of an insurance policy: deductible <- 15 coverage.limit <- 75 insurance.threshold <- deductible + coverage.limit tmpf <- function() { loss <- rlnorm(rpois(1, 3), 2, 5) sum(ifelse(loss > insurance.threshold, loss - coverage.limit, pmin(loss, deductible))) } net <- replicate(1000000, tmpf())
2012 Oct 20
1
Logistic regression/Cut point? predict ??
I am new to R and I am trying to do a monte carlo simulation where I generate data and interject error then test various cut points; however, my output was garbage (at x equal zero, I did not get .50) I am basically testing the performance of classifiers. Here is the code: n <- 1000; # Sample size fitglm <- function(sigma,tau){ x <- rnorm(n,0,sigma) intercept <- 0 beta
2012 Oct 25
2
How to extract auc, specificity and sensitivity
I am running my code in a loop and it does not work but when I run it outside the loop I get the values I want. n <- 1000; # Sample size fitglm <- function(sigma,tau){ x <- rnorm(n,0,sigma) intercept <- 0 beta <- 0 ystar <- intercept+beta*x z <- rbinom(n,1,plogis(ystar)) xerr <- x + rnorm(n,0,tau) model<-glm(z ~ xerr, family=binomial(logit))
2010 Nov 24
1
segfault interest?
in a long program, I ran into ?*** caught segfault *** address 0xdc3f9b48, cause 'memory not mapped' Traceback: ?1: rep.int(seq_len(nx), rep.int(rep.fac, nx)) ?2: rep.int(rep.int(seq_len(nx), rep.int(rep.fac, nx)), orep) ?3: expand.grid(seq_len(nx), seq_len(ny)) ?4: merge.data.frame(d, ss) ?5: merge(d, ss) ?6: valid.range(opt) ?7: eval.with.vis(expr, envir, enclos) ?8: eval.with.vis(ei,
2016 Jun 07
3
[PATCH 1/2] ruby: Print exceptions thrown by event callbacks.
--- generator/ruby.ml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/generator/ruby.ml b/generator/ruby.ml index 97ccfdc..0f71ccc 100644 --- a/generator/ruby.ml +++ b/generator/ruby.ml @@ -404,15 +404,17 @@ event_callback_wrapper_wrapper (VALUE argvv) return Qnil; } +/* Callbacks aren't supposed to throw exceptions. We just print the + * exception on
2020 Oct 23
0
How to shade area between lines in ggplot2
Hi What about something like p+geom_ribbon(aes(ymin = slope_1*x + intercept_1 - 1/w[2], ymax = slope_1*x + intercept_1 + 1/w[2], fill = "grey70", alpha=0.1)) Cheers Petr > -----Original Message----- > From: Luigi Marongiu <marongiu.luigi at gmail.com> > Sent: Friday, October 23, 2020 11:11 AM > To: PIKAL Petr <petr.pikal at precheza.cz> > Cc: r-help
2020 Oct 26
0
How to shade area between lines in ggplot2
Hi Put fill outside aes p+geom_ribbon(aes(ymin = slope_1*x + intercept_1 - 1/w[2], ymax = slope_1*x + intercept_1 + 1/w[2]), fill = "blue", alpha=0.1) The "hole" is because you have two levels of data (red and blue). To get rid of this you should put new data in ribbon call. Something like newdat <- trainset newdat$z <- factor(0) p+geom_ribbon(data=newdat, aes(ymin =
2016 Jun 07
0
[PATCH 2/2] ruby: tests: Give each test class and method a unique name.
'tc_410_close_event.rb' was not being run. You could prove this by simply inserting "exit 1" into that test. The reason is unclear, but by renaming every class and method in the tests to be unique, this ensures the tests are run. --- ruby/t/tc_010_load.rb | 4 ++-- ruby/t/tc_020_create.rb | 4 ++-- ruby/t/tc_030_create_flags.rb | 4 ++--
2020 Oct 23
2
How to shade area between lines in ggplot2
Thank you, but this split the area into two and distorts the shape of the plot. (compared to ``` p + geom_abline(slope = slope_1, intercept = intercept_1 - 1/w[2], linetype = "dashed", col = "royalblue") + geom_abline(slope = slope_1, intercept = intercept_1 + 1/w[2], linetype = "dashed", col = "royalblue") ``` Why there
2020 Oct 23
2
How to shade area between lines in ggplot2
also from this site: https://plotly.com/ggplot2/geom_ribbon/ I get the answer is geom_ribbon but I am still missing something ``` #! plot p = ggplot(data = trainset, aes(x=x, y=y, color=z)) + geom_point() + scale_color_manual(values = c("red", "blue")) # show support vectors df_sv = trainset[svm_model$index, ] p = p + geom_point(data = df_sv, aes(x=x, y=y),
2010 Aug 26
3
Help with ddply to eliminate a for..loop
I created a small example to show something that I do a lot of. "scale" data by month and return a data.frame with the output. "id" represents repeated observations over "time" and I want to scale the "slope" variable. The "out" variable shows the output I want. My for..loop does the job but is probably very slow versus other methods. ddply
2009 Nov 30
3
bug or bizarre feature?
Hello, I'm running into a very strange problem: > xrange <- c(-2.5,2.5) > xdim <- 100 > mobility <- 0.1 > slope <- 1.16 > urange <- slope*xrange > udim <- max(slope*xdim,5) > du <- (urange[2]-urange[1])/udim > uvec <- urange[1]+(1:udim-0.5)*du > # type dependent weight function > ckern <-
2020 Oct 23
0
How to shade area between lines in ggplot2
Hi Did you try google? I got several answers using your question e.g. https://stackoverflow.com/questions/54687321/fill-area-between-lines-using-g gplot-in-r Cheers Petr > -----Original Message----- > From: R-help <r-help-bounces at r-project.org> On Behalf Of Luigi Marongiu > Sent: Friday, October 23, 2020 9:59 AM > To: r-help <r-help at r-project.org> > Subject: