[R] Meaning of "%%"

Bert Gunter gunter.berton at gene.com
Wed Jul 13 15:47:39 CEST 2011


Vincy:

On Wed, Jul 13, 2011 at 3:27 AM, Vincy Pyne <vincy_pyne at yahoo.ca> wrote:
> Meaning of %%
>
> Thanks a lot for the guidance.
>
> Before posting this query, I had tried following things.
>
>> ?%%
> Error: unexpected SPECIAL in "?%%"
>> ??%%
> Error: unexpected SPECIAL in "??%%"

Instead of guessing,why not try reading the Help documentation more
carefully (a failing that I,too, sometimes commit).

help(help) says:

topic 	usually, a name or character string specifying the topic for
which help is sought. A character string (enclosed in explicit single
or double quotes) is always taken as naming a topic.

The DETAILS section then tells us:

Some topics need to be quoted (by backticks) or given as a character
string. There include those which cannot syntactically appear on their
own such as unary and binary operators, function and control-flow
reserved words (including if, else for, in, repeat, while, break and
next. The other reserved words can be used as if they were names, for
example TRUE, NA and Inf.

%% is a unary operator and ence you need:

help("%%")
or
?"%%"

Moral: The docs sometimes require careful reading -- but the
information is almost always there, so they should be the first place
to go to, not this list.

-- Bert


>
> I also tried search.r-project.org and tried to search there also, but no luck.
>
>> help("%%") GIVES ME
>
> Error in file(out, "wt") : cannot open the connection
>
> In addition: Warning message:
>
> In file(out, "wt") :
>
> cannot open file 'C:\DOCUME~1\LOCALS~1\Temp\RtmpoCnAxB\Rtxt52325f7': No such file or directory
>
>
> Regards
>
> Vincy
>
>
> --- On Wed, 7/13/11, ONKELINX, Thierry <Thierry.ONKELINX at inbo.be> wrote:
>
> From: ONKELINX, Thierry <Thierry.ONKELINX at inbo.be>
> Subject: RE: [R] Meaning of "%%"
> To: "Vincy Pyne" <vincy_pyne at yahoo.ca>, "r-help at r-project.org" <r-help at r-project.org>
> Received: Wednesday, July 13, 2011, 10:13 AM
>
> help("%%")
>
> ----------------------------------------------------------------------------
> ir. Thierry Onkelinx
> Instituut voor natuur- en bosonderzoek
> team Biometrie & Kwaliteitszorg
> Gaverstraat 4
> 9500 Geraardsbergen
> Belgium
>
> Research Institute for Nature and Forest
> team Biometrics & Quality Assurance
> Gaverstraat 4
> 9500 Geraardsbergen
> Belgium
>
> tel. + 32 54/436 185
> Thierry.Onkelinx at inbo.be
> www.inbo.be
>
> To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of.
> ~ Sir Ronald Aylmer Fisher
>
> The plural of anecdote is not data.
> ~ Roger Brinner
>
> The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data.
> ~ John Tukey
>
>
>> -----Oorspronkelijk bericht-----
>> Van: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
>> Namens Vincy Pyne
>> Verzonden: woensdag 13 juli 2011 12:00
>> Aan: r-help at r-project.org
>> Onderwerp: [R] Meaning of "%%"
>>
>> Dear r helpers
>>
>> This may be very elementary question but I couldn't figure out what does the
>> operator %% do?
>>
>> E.g.
>>
>> p <- 100
>> q <- 200
>>
>> p%%q
>> [1] 100
>>
>> q%%p
>> [1] 0
>>
>> Please guide.
>>
>> Vincy
>>
>>     [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
>        [[alternative HTML version deleted]]
>
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>



-- 
"Men by nature long to get on to the ultimate truths, and will often
be impatient with elementary studies or fight shy of them. If it were
possible to reach the ultimate truths without the elementary studies
usually prefixed to them, these would not be preparatory studies but
superfluous diversions."

-- Maimonides (1135-1204)

Bert Gunter
Genentech Nonclinical Biostatistics
467-7374



More information about the R-help mailing list