[EMAIL PROTECTED] writes: > Hello, > Splus contains the function intbin(x,l). > > This function allows to make a conversion from an integer x to a binary of > length l. > > for example > > intbin(3,2) returns 11 > > intbin(3,3) returns 011 > > Do you know how to do it in R ?
How about this? intbin <- function(x, n) if(n) paste(intbin(x%/%2, n-1), x%%2, sep="") else if (x) stop("Insufficient field width") -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html