Re: [R] 1 not equal to 1, and rep command

2011-09-12 Thread Daniel Nordlund
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of Benjamin Høyer > Sent: Monday, September 12, 2011 6:19 AM > To: r-help@r-project.org > Cc: t...@novozymes.com > Subject: [R] 1 not equal to 1, and rep c

Re: [R] 1 not equal to 1, and rep command

2011-09-12 Thread Sarah Goslee
Not so strange, in fact this is FAQ 7.31, and has to do (as you guess) with the way that computers store numbers. You need to do as you did, and use round() or floor() or similar to ensure that you get the results you expect. Sarah 2011/9/12 Benjamin Høyer : > Hi > > I need to use rep() to get a

[R] 1 not equal to 1, and rep command

2011-09-12 Thread Benjamin Høyer
Hi I need to use rep() to get a vector out, but I have spotted something very strange. See the reproducible example below. N <- 79 seg <- 5 segN <- N / seg # = 15.8 d1 <- seg - ( segN - floor(segN) ) * seg d1# = 1 rep(2, d1) # = numeric(0), strange - why doesn't