I have been working with R for about 2 months and have had a little bit of trouble getting a hold of how the $
and %%
terms.
I understand I can use the $
term to pull a certain value from a function (e.g. t.test(x)$p.value
), but I'm not sure if this is a universal definition. I also know it is possible to use this to specify to pull certain data.
I'm also curious about the use of the %%
term, in particular, if I am placing a value in between it (e.g. %x%) I am aware of using it as a modulator or remainder e.g. 7 %% 5
returns 2
. Perhaps I am being ignorant and this is not real?
Any help or links to literature would be greatly appreciated.
Note: I have been searching for this for a couple hours so excuse me if I couldn't find it!
pipes
(a coding method influenced by FSharp) in themagrittr
package. Searching for that should get you started.'%in%
is defined on the?match
page. Function with flanking %-signs are called "specials". The authors of magrittr and other packages that define "+" methods for graphical objects have defined additional functions which are being dispatched using the R class system which was originally being used for math or logical operations. This is usually called "overloading". The operator precedence is detailed in?Syntax
help page. And the?Ops
page might be interesting reading as well.$
doesn't really fit, but the%%
and%*%
elements of this question are a dupe of this r-faq.