« first day (1338 days earlier)      last day (1975 days later) » 

2:45 AM
@Cath thanks for the explanation. Re-reading it with fresh mind I think I am able to understand.
Does it mean that FUN in ave should always return output of same type as x or at least it should be coercible to type of x.
 
 
3 hours later…
6:15 AM
26 messages moved to Trash can
 
 
1 hour later…
7:27 AM
Good morning all
 
gone..delete as well ?
 
yup
 
8:20 AM
@RonakShah I think in most cases, it is coerced with no problem, dates are more complex...
and good morning all :-)
 
8:36 AM
Aloha.
 
9:07 AM
Hello guys ! How are you doing ?
Hey @Cath ! :)
 
Hey @eliasah :-)
 
9:22 AM
How are you doing ?
preparing for the holidays (soon) ?
 
@eliasah yep, holidays in 2 days yoo-hoo !! :-)
 
@Cath Me too !
 
are you taking holidays as well?
 
staying in Nantes ?
 
(oh so yeah :-) )
 
9:32 AM
it's a must for me
 
@eliasah more or less: Nantes and LaBaule where my family-in-law lives
 
we are spending Christmas at the inlaws in Zagreb
 
my husband doesn't have holidays though :-/
 
oh too bad
I have lots of days
 
@eliasah cool :-) warmth and sun hopefully :-)
@eliasah I'm taking 2 weeks off :-D
 
9:33 AM
@Cath good ! :)
 
(all the school holidays)
I have a lots of wrapping to do till monday though ;-)
 
@Cath it will be cold and snow in Zagreb but Christmas is nice there
hehe us too :|
 
@eliasah oh? well snow goes well with Christmas, as long as you don't get stuck in it...
 
@Cath it's mainly for the kids :)
you know how it goes hehe
 
kids love snow ! and probably a little more since frozen Elsa....
 
10:03 AM
@eliasah There's snow in Zagreb? Slovenia has basically no snow except in the Alps.
And temperatures are going around zero. We even had a sprinkle of rain today.
 
10:20 AM
This is a bit paradox...You can post an answer without rep mattering, but to comment you need >50..I 'm confused with the hierarchy :/
 
10:30 AM
it was snowing last week @RomanLuštrik :)
@Cath tell me about it ! I took my kid to Disney on Ice last weekend and all that mattered to my kid was Elsa hehe
@Sotos anti-spam protection
 
@eliasah I had to eat quickly (well matter of weeks still he...) a whole glass of mustard because it was a frozen Elsa glass and my girl was too eager to use it for water...
 
Hehe.
 
@Cath I've found the same glass with small pickles. I've just threw them in another jar hehe
 
@eliasah lol you're smarter than I am ;-)
 
@Cath hehe I was like : "I love mustard but no way on earth I can finish this one quickly enough"
 
11:03 AM
lol
 
11:22 AM
My search foo fails me. I have a bunch of values which I would like to classify based on thresholds provided in two columns. Is there a convenient function for this?
 
 
1 hour later…
12:38 PM
xy <-data.frame(class = c("low", "medium", "high"),
                lower = c(1, 11, 21), upper = c(10, 20, 30))

c(0, 3, 11, 15, 23, 40)
# aftre classifying
c(NA, "low", "medium", "medium", "high", NA)
Something along these lines.
I can come up with an algorithm, I was just wondering if somebody's implemented this already.
x <- 3
xy[xy$lower <= x & xy$upper >= x, ]
That wasn't so hard. :rolleyes:
And then
sapply(input, FUN = function(x, xy) {
  out <- as.character(xy[x >= xy$lower & x <= xy$upper, "class"])

  if (length(out) == 0) return(NA)
  out
}, xy = xy)
[1] NA       "low"    "medium" "medium" "high"   NA
 
 
5 hours later…
5:47 PM
@RomanLuštrik an approach with :
library(data.table)
setDT(xy)[data.table(c(0, 3, 11, 15, 23, 40))
          , on = .(lower <= V1, upper >= V1)
          , as.character(class)]
The result:
 [1] NA       "low"    "medium" "medium" "high"   NA
 
 
5 hours later…

« first day (1338 days earlier)      last day (1975 days later) »