« first day (951 days earlier)      last day (2348 days later) » 

Sorry @sharvan we have rules davidarenburg.github.io/GMTs you will need 1000 reputation to have write access.
 
Hello all :-)
cannot delete anything yet but voted on both the others :-)
 
You still have time till xmas to get 20K :D
 
Morning all
 
7:45 AM
@zx8754 lol not so sure about that, I have less and less time to spend on SO :-(
 
8:19 AM
Interesting challenge? stackoverflow.com/q/47526577/680068
 
9:04 AM
How can I get that extra bit of information which comes with na.omit?
They seem to be indices of NA elements.
 
Hello @Sharvan, sorry but we have some rules about write access here, you can read them from the link in the topic
 
ohhh..BTW if it is not clear, I mean x <- c(1, 2, 3, NA, 5, NA); and when you do na.omit(x), the output is
#[1] 1 2 3 5
#attr(,"na.action")
#[1] 4 6
#attr(,"class")
#[1] "omit"
How can i get these (4, 6) indices ?
 
grepl(NA) ?
 
@RonakShah attr(na.omit(x), "na.action")
 
9:21 AM
@Cath cool..thanks :)
 
@RonakShah which(is.na(x)) would be an easier way of getting these.
 
@Roland yep, I know! But I recently stumbled upon this and didn't know how to get it.
 
 
2 hours later…
11:19 AM
MASS package is part of the R "basic" install, right ?
 
AFAIK: yes
hello all btw :-)
 
@Jaap thanks Jaap :-) That what I thought but wasn't sure and I couldn't find the info on the CRAN (maybe I searched badly...)
And hi ! :-)
 
x <- installed.packages(); x[ !is.na(x[ ,"Priority"]), ]
MASS is part of "recommended" bunch of packages.
 
@zx8754 nice thanks, I've never looked at the output of installed.package closely. So recommended = installed but not loaded ?
hmm though I thought one had to load grid but it is in "base". So what's the difference between "base" and "recommended" ?
 
Yes, installed, not loaded
 
11:37 AM
thanks :-)
 
@Cath no, I take it back, not all base packages are attached. When we start new R session and run sessionInfo, it shows which ones are attached, grid is not one of them.
attached base packages:
[1] stats graphics grDevices utils datasets methods base
 
@zx8754 yep (I knew that grid wasn't loaded, R "insulted" me once for thinking it was attached ;-) ) but then I don't see the difference between base/recommended in the last column
 
12:09 PM
Implicit in this organization is that base packages are only updated with releases of R; there is a one-to-one relationship between versions of the base packages and versions of R. Recommended packages, since they are hosted on CRAN, can be and are updated between releases of R. — Brian Diggs Mar 14 '12 at 16:40
 
12:48 PM
@zx8754 thanks :-)
 
1:00 PM
smelly business in The Netherlands
 
@Jaap conflict of interest: none declared ?....... everything is rotten in the industrial world :-(
 
serious conflict of interest, particularly when you know that the outcome of this test can make or break your fish shop/stall
 
@Jaap closed
 
1:20 PM
Interesting...
You probably intended to do k = x+2 [(!is.na(x)) && x>0] , but it's not clear why someone would actually write this code. — Tim Biegeleisen 45 secs ago
So what is the difference between & and &&?
 
@Sotos && does not check the other item of a vector (IIRC)
 
In other words...not vectorized..?
 
@Sotos yes and no, it's just in case you need to check only first element. I haven't found a case where it is handy yet ;-)
 
@Cath I doubt I ll ever use it but good to know. Cheerzz :)
 
TIL. I would have expected this to throw a warning: 0:2 && TRUE (and it probably should)
 
1:42 PM
@lionel Yeah people often say that one should use && in if statements. But I'd rather get the warning.
but they are smart people, so perhaps I'm missing something
 
hah...function of the day, startsWith
 
1:57 PM
@Axeman I have said as much in the past. I think even if you prefer the lighter-weight version of &&, you should at least acknowledge that you're giving up the warning generated by if when it gets a vector.
 
2:07 PM
@Sotos you mean grepl('^Sot', GMTs) ? ;-)
 
2:38 PM
huh, never thought of the && issue
btw, hi all
 
Never had to use &&
 
@Axeman && and || are short circuiting, which means they evaluates as little code as possible. i.e compare TRUE || stop("!") vs TRUE | stop("!")
&& and || are scalar operations which means that they're a good fit for if statements because they can only handle a single TRUE or FALSE
 
2:54 PM
@hadley I think people are mostly aware of that. The issue that gets glossed over is that && and || silently reduce vectors to scalar logicals.
By "people" I mean the people here.
 
@BrodieG ok, but I'm not sure what you're getting at
 
@hadley Everyone recommends using && and || for if statements, but generally they don't highlight that there is a drawback, which is that they can silently conceal an unintended error (i.e. using vectors in the if test).
 
the short-circuiting can be useful sometimes e.g. if you know the second statement will fail if the first is true. (Although situations like that don't come up very much for me.) But I like the warning in if, since I'm dumb and it helps me catch bugs.
 
3:13 PM
@Axeman FWIW the warning will be an error in the next version of R; it might be possible to make && and || give warnings for non-vector inputs at the same time
@Axeman but the more I think about this the more I think that we must be using if statements in different ways because that's not generally a problem that I have
 
@hadley I think both of those would be great.
 
3:27 PM
@Jaap hahaha yeah, pretty much :p
 
3:49 PM
yeah, looking at my code, i guess the vector thing will rarely bite me (eg, writing stopifnot(is.numeric(n_pl) && length(n_pl) == 1L) ... which i will hopefully soon simplify to vetr::vet(NUM.1, n_pl) or similar ), but it's still interesting to note
 
4:16 PM
@zx8754 apperently the grace period is longer than 15 minutes, see example here
 
@hadley You probably make fewer mistakes than us. We're not talking about intentional usage. I've certainly been bit by mistakenly thinking a variable or expression resolved to a scalar when in reality it resolved to a vector, and the && concealed the issue.
 
19 messages moved to Trash can
 
@BrodieG Or you write a quick & dumb function that doesn't check inputs, and attempt to use it two months later...
 
@hadley You mean for non-scalar inputs?
 
@Jaap yes, that's what I thought, too.
 
4:32 PM
@Frank you could also write stopifnot(is.numeric(n_pl), length(n_pl) == 1) ;)
@BrodieG I am sceptical of arguments based on the assumption that I make few mistakes, as I make a lot of mistakes. I think it's more likely we are using if statements in different contexts
 
4:59 PM
@hadley ah right, thanks! not yet used to the implicit "and" between args (there nor in dplyr::filter)
 
5:45 PM
@DavidArenburg do you need to separately invite people to a chat room in addition to giving them write access?
I created a new chat room:
I'm trying to add all here, but it might take me a while so please feel free to request access.
 
@BrodieG I guess so, since I didn't get a message
 
@Axeman That's silly, thanks though.
 
 
5 hours later…
10:54 PM
@Axeman well that make sense, it ends up with one value, what would you do in this case if c(T, F, T)?
I should stop answering before reading all transcript :)
 

« first day (951 days earlier)      last day (2348 days later) »