Hi, do you know, a method to convert an decimal value (integer) to the corresponding hexadecimal value ? thinks for help. Romain -- Lorrilli?re Romain UMR 8079 Laboratoire Ecologie, Syst?matique et Evolution B?t. 362 Universit? Paris-Sud 91405 Orsay cedex France tel : 01 69 15 56 85 fax : 01 69 15 56 96 mobile : 06 81 70 90 70 email : romain.lorrilliere at ese.u-psud.fr ______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Romain Lorrilli?re UMR 8079 Laboratoire Ecologie, Syst?matique et Evolution B?t. 362 Universit? Paris-Sud 91405 Orsay cedex France tel : 01 69 15 56 85 fax : 01 69 15 56 96 mobile : 06 81 70 90 70 email : romain.lorrilliere at ese.u-psud.fr
use sprintf> sprintf("%x",123)[1] "7b">On 9/30/06, Romain Lorrilliere <romain.lorrilliere at ese.u-psud.fr> wrote:> Hi, > > do you know, a method to convert an decimal value (integer) to the > corresponding hexadecimal value ? > > thinks for help. > > Romain > > -- > > Lorrilli?re Romain > > > > UMR 8079 Laboratoire Ecologie, Syst?matique et Evolution > > B?t. 362 > > Universit? Paris-Sud > > 91405 Orsay cedex > > France > > > > tel : 01 69 15 56 85 > > fax : 01 69 15 56 96 > > mobile : 06 81 70 90 70 > > > > email : romain.lorrilliere at ese.u-psud.fr > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html > > > > > -- > > Romain Lorrilli?re > > > > UMR 8079 Laboratoire Ecologie, Syst?matique et Evolution > > B?t. 362 > > Universit? Paris-Sud > > 91405 Orsay cedex > > France > > > > tel : 01 69 15 56 85 > > fax : 01 69 15 56 96 > > mobile : 06 81 70 90 70 > > > > email : romain.lorrilliere at ese.u-psud.fr > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve?
Try: sprintf("%x", 109) On 9/30/06, Romain Lorrilliere <romain.lorrilliere at ese.u-psud.fr> wrote:> Hi, > > do you know, a method to convert an decimal value (integer) to the > corresponding hexadecimal value ? > > thinks for help. > > Romain > > -- > > Lorrilli?re Romain > > > > UMR 8079 Laboratoire Ecologie, Syst?matique et Evolution > > B?t. 362 > > Universit? Paris-Sud > > 91405 Orsay cedex > > France > > > > tel : 01 69 15 56 85 > > fax : 01 69 15 56 96 > > mobile : 06 81 70 90 70 > > > > email : romain.lorrilliere at ese.u-psud.fr > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html > > > > > -- > > Romain Lorrilli?re > > > > UMR 8079 Laboratoire Ecologie, Syst?matique et Evolution > > B?t. 362 > > Universit? Paris-Sud > > 91405 Orsay cedex > > France > > > > tel : 01 69 15 56 85 > > fax : 01 69 15 56 96 > > mobile : 06 81 70 90 70 > > > > email : romain.lorrilliere at ese.u-psud.fr > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >
?sprintf ex : > sprintf('%X',10) [1] "A" hih
how about learning to use help.search? (In may you already asked a similiar question...) help.search("hexadecimal") which would lead you to format.hexmode ?format.hexmode Romain Lorrilliere schrieb:> Hi, > > do you know, a method to convert an decimal value (integer) to the > corresponding hexadecimal value ? > > thinks for help. > > Romain > >
"Romain Lorrilliere" <romain.lorrilliere at ese.u-psud.fr> wrote in message news:451E7762.8000307 at ese.u-psud.fr... Hi, do you know, a method to convert an decimal value (integer) to the corresponding hexadecimal value ? Starting in R 2.1.0, sprintf can be used:> x <- c(0, 65535, 65536, 305419896, 2^31-1) > y <- sprintf("0x%X", x) > y[1] "0x0" "0xFFFF" "0x10000" "0x12345678" "0x7FFFFFFF"> as.numeric(y)[1] 0 65535 65536 305419896 2147483647 efg Earl F. Glynn Scientific Programmer Stowers Institute for Medical Research
Hi, I found that when writing a matrix with row names and column names to an Excel file, the Excel file when opened has column names shifted towards left resulting disalignment. Here is an exmaple x<-matrix(1:20,nrow=4,dimnames=list(paste('r',1:4,sep=''),paste('c',1:5,sep=''))) write.table(x,"xx.xls",sep='\t') If you open the xx.xls file, you will understand what I meant. Is there anyway to solve the disalignment? Thanks
Romain Lorrilliere wrote:> Hi, > > do you know, a method to convert an decimal value (integer) to the > corresponding hexadecimal value ? > > thinks for help. > > Romain > >You mean "representation", not "value"; the value doesn't change. One method is sprintf with the "%x" formatting code. -Dan -- Dan Gunter. voice:510-495-2504 fax:510-486-6363 dsd.lbl.gov/~dang
Romain Lorrilliere wrote:>Hi, > >do you know, a method to convert an decimal value (integer) to the >corresponding hexadecimal value ? > >thinks for help. > >Romain > > >The fBasics package has two hidden functions: > .dec.to.hex(145678) [1] "02390E" > .hex.to.dec("02390E") [1] 145678 DW **