1

I am new to R and I am having a hard time understanding and making the following snippet functional :

fMatrix <- DT[c(v1,v2), ] %.% select(f1,f2,f3) %.% lapply(...)

logically, it seems to make sense, as it is (probably) trying to take a subset and perform certain operations by some sort of method chaining using (dot operator). The problem is my R interpreter doesn't recognizes %.%

I am guessing the operator comes from a package I didn't import or something like that. Any insights are welcome.

smci
  • 32,567
  • 20
  • 113
  • 146
sud03r
  • 19,109
  • 16
  • 77
  • 96
  • Yes, the `%.%` probably does come from a different package, but any package is free to create an operator with that name. Unless you know which package that line of code was written for, it's not really possible to guarantee the results are correct even if does run without error. Where did you find this line of code? – MrFlick Aug 28 '14 at 21:22
  • @Gregor, I spent a lot of time googling but didn't came across that question. Apparently questions with special symbols are hard to google up (unless there is a smarter way I don't know of). Thanks for the link :) (I will also vote to close) – sud03r Aug 28 '14 at 21:29
  • 1
    @sud03r They definitely are hard to find. I did it by looking for questions tagged with [tag:dplyr], but that only worked because I knew what to look for! – Gregor Thomas Aug 28 '14 at 21:32
  • As of 2014, `%.%` is deprecated in favor of` `%>%` instead, in dplyr. – smci May 29 '15 at 21:26
  • Also, I tagged this [tag:chaining] – smci May 29 '15 at 21:29

1 Answers1

1

Look at librarydplyr, in R. The docs say it is related to chain

See the dplyr docs here, at p.7.

Rusan Kax
  • 1,894
  • 2
  • 13
  • 17