Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 360123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T12:27:31+00:00 2026-05-12T12:27:31+00:00

This is a very basic question – but apparently google is not very good

  • 0

This is a very basic question – but apparently google is not very good at searching for strings like “%+%”. So my question is – what and when is “%+%” and similar used. I guess its a kind of merge?.

EDIT: Ok – I believe my question is answered. %X% is binary operator of some kind. So now I think I will google around for knowledge about how/when to use these. My question was partly inspired by yesterday’s question – but only after I saw this post on the “learning R” blog. The passage that gave rise to my question was this:
In order to do this, a new dataframe with the annual totals will be created and later merged with the existing dataset (variable names in both dataframes should be identical for this to work). Then we just change the dataframe the plot is based on.

## add total immigration figures to the plot
total <- cast(df.m, Period ~ ., sum)
total <- rename(total, c("(all)" = "value"))
total$Region <- "Total"
df.m.t <- rbind(total, df.m)
c1 <- c %+% df.m.t
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T12:27:32+00:00Added an answer on May 12, 2026 at 12:27 pm

    The ultimate reason is that if you do both general-purpose programming and numerical computations, it is useful to have a large complement of binary operators available. For example, if you store numbers in two-dimensional arrays, you may want to multiply the arrays elementwise, or you may want to compute the matrix product of two arrays. In Matlab these two operators are .* and *; in R they are * and %*%. Python has resisted attempts to add new operators, and so numpy differentiates between the two kinds of product by having two classes: the array class is multiplied elementwise, the matrix class is multiplied in the linear-algebra sense.

    Another example from Python is that for lists, plus means concatenation: [1,2,3]+[4,5] == [1,2,3,4,5]. But for numpy arrays, plus means elementwise addition: array([1,2]) + array([4,5]) == array([5,7]). If your code needs to do both, you have to convert between classes or use function notation, which can lead to cumbersome-looking code, especially where mathematics is involved.

    So it would sometimes be convenient to have more operators available for use, and you might not know in advance what sorts of operators a particular application calls for. Therefore, the implementors of R have chosen to treat as operators anything named like %foo%, and several examples exist: %in% is set membership, %x% is Kronecker product, %o% is outer product. For an example of a language that has taken this to the extreme, see Fortress (section 16 of the specification starts with the rules for operator names).

    In the blog post you mentioned, the author is using the ggplot2 graphing package, which defines %+% to mean some kind of combination of two plot elements. Really it seems to add a method to the bare + (which is a generic function so you can define what it means for user-defined objects), but it also defines %+% so that you can use the ggplot2 meaning of + (whatever it is) for other objects. If you install ggplot2, type require(ggplot2) and ?`%+%` to see the documentation of that operator, and methods(`+`) to see that a new definition has been added to +.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 216k
  • Answers 216k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Use str_split: $array = str_split($string, 6); May 12, 2026 at 11:05 pm
  • Editorial Team
    Editorial Team added an answer There seem to be no simple way. The best I… May 12, 2026 at 11:05 pm
  • Editorial Team
    Editorial Team added an answer Here is a version that will modify an existing string… May 12, 2026 at 11:05 pm

Related Questions

This is a very basic question. I'm just on my mission to learn ASP.NET
This is a very basic question, I'm just not that good with Java. I
This is a very basic question. I feel kind of silly asking about it
This is a very basic question - but apparently google is not very good
This is a very basic question - but I haven't been able to find

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.