Reputation: 43
Is there a way to use percent operators in R with the double colon notation?
For example:
foreach::%dopar%
foreach::"%dopar%"
Upvotes: 2
Views: 194
Reputation: 9582
Even though quotes work in the double colon case, when referring to an operator like this, you should enclose the operator in single back ticks:
foreach::`%dopar%`
This lets you refer to name anywhere that is not a legal identifier (a legal identifier starts with a letter and is made up of only letters and numbers and underscores).
`%%`(6, 4) # Calling the mod operator in a weird way
`strange %^*&` <- 2 # Defining a weird variable
`strange %^*&` + `strange %^*&` # Using the weird variable
Upvotes: 2