« first day (2083 days earlier)      last day (1728 days later) » 

10:30 AM
Hi, a bit too broad for a proper SO question, but do you have an idea why := isn't mentioned on the operator precedence help page ? ?Syntax stat.ethz.ch/R-manual/R-devel/library/base/html/Syntax.html
 
11:02 AM
@Moody_Mudskipper := is no longer part of base R for long time now
data.table exports it and I think tibbliverse too
 
11:24 AM
@DavidArenburg So it's deliberately not documented anymore ? meaning its use is discouraged ? It still must have a precedence rank though, I guess just behind =.
 
@Moody_Mudskipper What you mean by "discouraged"? You can't really use it all as it is not exported.
 
You can define it and use it, as I do in my dotdot package (github.com/moodymudskipper/dotdot)
`:=` <- function(e1,e2) {
mc <- match.call()
mc[[1]] <- quote(.Primitive("<-"))
mc[[3]] <- eval(substitute(
substitute(e2, list(.. = mc[[2]])),list(e2 = mc[[3]])
))
eval.parent(mc)
}
x <- 3; x := .. + 1
Trying to gather what I can from SO and google (its story/usage...) but I can't search for ":=" and "column equal" / "column equals" don't seem to return anything relevant, I don't know how to look it up on Rdocumentation.org either to see which packages use it.
 
11:45 AM
There are some relevant links on SO regarding this:
15
Q: What is the R assignment operator := for?

Romain JacotinBy digging into R source code (file R-3.2.2/src/main/gram.y lines 2836 to 2852) I found that the R parser/tokenizer considers that := is a LEFT_ASSIGNMENT token. But when trying to use it as an assignment operator in R.3.2.2, I have an error (impossible to find function for := ...) but as you ca...

40
Q: Why has data.table defined := rather than overloading <-?

Matt Dowledata.table has introduced the := operator. Why not overload <-?

 
That's really helpful, thanks a lot, that comment from Roland made me smile and might explain all : "I think they simply forgot to remove it and then Matt came along with data.table and now they can't remove it anymore."
 
 
1 hour later…
1:03 PM
@DavidArenburg FYI I created the tag colon-equals to make these searches more convenient, it's not much used but well worth it IMO. stackoverflow.com/questions/tagged/colon-equals
 
 
6 hours later…
7:17 PM
can someone look at this post and see if I addressed the OP's questions properly? I did my best but I wanna avoid from giving misinformation. Thanks. stackoverflow.com/questions/53213418/…
OP's questions are mostly in the comment section. I answered some of the questions in the comments and explained my solution in the original answer. Cheers
 

« first day (2083 days earlier)      last day (1728 days later) »