I'm trying to do a modulus operator in R-1.2.2 on Windows -- specific version: R : Copyright 2001, The R Development Core Team Version 1.2.2 Patched (2001-03-22) Here's what the R language manual says: "R contains a number of operators. They are listed in the table below. [snip] % Modulus, binary" Here's what happens on the R console:> records <- 100000 > modulus <- 1000 > records % modulusError: syntax error> records / modulus[1] 100>I haven't tried this on Linux yet, so I don't know if it's Windows-specific. I did try coercing the values to integer with "as.integer" and it didn't help. Am I leaving something out?? -- M. Edward (Ed) Borasky, Chief Scientist, Borasky Research http://www.borasky-research.net http://www.aracnet.com/~znmeb mailto:znmeb at borasky-research.com mailto:znmeb at aracnet.com If there's nothing to astrology, how come so many famous men were born on holidays? -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Sat, 28 Apr 2001, M. Edward Borasky wrote:> I'm trying to do a modulus operator in R-1.2.2 on Windows -- specific > version: > > R : Copyright 2001, The R Development Core Team > Version 1.2.2 Patched (2001-03-22) > > Here's what the R language manual says: > > "R contains a number of operators. They are listed in the table below. > > [snip] > > % Modulus, binary"It is %%, not %. Don't know why R-lang thinks otherwise .... It is also missing %/% (integer division). ?Arithmetic is correct. -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
"M. Edward Borasky" <znmeb at aracnet.com> writes:> "R contains a number of operators. They are listed in the table below. > > [snip] > > % Modulus, binary" > > Here's what happens on the R console: > > > records <- 100000 > > modulus <- 1000 > > records % modulus > Error: syntax error > > records / modulus > [1] 100 > > > > I haven't tried this on Linux yet, so I don't know if it's Windows-specific. > I did try coercing the values to integer with "as.integer" and it didn't > help. Am I leaving something out??Yes, another % symbol:> records <- 100000 > modulus <- 1000 > records %% modulus[1] 0 ...which you'd obviously be excused for not knowing about. Looks like we have a typo in the R-language manual. (We also have a curious anomaly:> quote("%"(records, modulus))records % modulus which indicates that the deparser does think % is a binary operator. However, the tokenizer is not going to let you enter an unmatched % because of the special operators %*%, %o%, %/%, etc. The "%" function does not exist either. Perhaps this is a relic and R in its infancy actually allowed x % y ?) -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._