[R] Hex Decimal Convert

Edwin Sendjaja edwin7 at gmx.net
Mon Apr 7 12:15:10 CEST 2008


Dear John,

Am Montag, 7. April 2008 01:43:07 schrieb John Fox:
> Dear Edwin,
>
> On Mon, 7 Apr 2008 01:14:35 +0100
>
>  Edwin Sendjaja <edwin7 at gmx.net> wrote:
> > Dear John,
> >
> > Thank you.
> >
> > Is there any possibility to get original stored number printed.
>
> R is a programming language, so you could in principle read an input
> line as character data, break it into its components, and output each
> component in whatever format you wished. That would require some work.
> There might be a simpler approach, but I'm not aware of it.
>

Do you have any guide with similar example?(links or website)?because i can 
imagine what you mean. I have also the same idea. But I dont know how to do 
it.

> > Because i have another coloum like:
> >
> > Protocol
> > "TCP"
>
> The previous example that you send consisted entirely of numeric data
> and had only one line. Assuming that there are several lines, you could
> read the data into a data frame via read.table() and exercise some
> control over how each column is read. See ?read.table. You could then
> deal separately with the columns.
>
> > This is gonna cause probleme (as you notice before).
>
> I'm afraid that I didn't notice since there was no character data in
> your previous example.
>

I meant, you told me before that the whole vector will be printed in hex. 


> > I dont really understand what you mean with a list. i am new with R.
>
> It's probably unreasonable to expect to be able to use a programming
> language without reading something about it. One place to start is with
> the introductory manual distributed with R, which discusses lists in
> Section 6.1. Alternatively, you could read one of a number of books on
> R; many are listed at <http://www.r-project.org/doc/bib/R-books.html>.
>
> Regards,
>  John
>
> > Thanks,
> >
> > Edwin
> >
> > Am Sonntag, 6. April 2008 21:38:19 schrieb John Fox:
> > > Dear Edwin,
> > >
> > > There's a distinction between the way in which a number is stored
> > > internally and the way in which it's printed. R is reading the hex
> > > numbers correctly but is printing them in decimal. You can assign
> >
> > the
> >
> > > class "hexmode" to the vector containing the data and then it will
> > >
> > > print in hex:
> > > > data <- c(6565, 0x47780439, 0x00000000, 0x00000000, 0)
> > > > data
> > >
> > > [1]       6565 1199047737          0          0          0
> > >
> > > > class(data) <- "hexmode"
> > > > data
> > >
> > > [1] "000019a5" "47780439" "00000000" "00000000" "00000000"
> > >
> > > Notice that the whole vector is printed in hex. If you don't want
> >
> > that,
> >
> > > then you could put the data into a list with some members of class
> > > "hexmode" and others not.
> > >
> > > I hope this helps,
> > >  John
> > >
> > >
> > >
> > > On Sun, 6 Apr 2008 20:52:20 +0100
> > >
> > >  Edwin Sendjaja <edwin7 at gmx.net> wrote:
> > > > Hello,
> > > >
> > > > I have a data with hexdecimal. But GNU R convert it to strange
> > > > number. How can
> > > > I get that hexdecimal showing in the R-table?
>
> ---------------------------------------------------------------------------
>
> > >--------------
> > >
> > > > My Data-Table:
> > > >           Sender_ID     Receiver_ID   Other_ID
> > > > 6565  0x47780439   0x00000000   0x00000000   0
>
> ---------------------------------------------------------------------------
>
> > >-------------
> > >
> > > > R-Table:
> > > >
> > > > 6565 1199047737           0      0       0
> > > >
> > > >
> > > >
> > > >
> > > > Kind Regards,
> > > >
> > > > Edwin
> > > >
> > > > ______________________________________________
> > > > R-help at r-project.org 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.
> >
> > > --------------------------------
> > > John Fox, Professor
> > > Department of Sociology
> > > McMaster University
> > > Hamilton, Ontario, Canada
> > > http://socserv.mcmaster.ca/jfox/
> > >
> > > ______________________________________________
> > > R-help at r-project.org 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.
> >
> > ______________________________________________
> > R-help at r-project.org 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.
>
> --------------------------------
> John Fox, Professor
> Department of Sociology
> McMaster University
> Hamilton, Ontario, Canada
> http://socserv.mcmaster.ca/jfox/



More information about the R-help mailing list