Re: [R] IP address

2010-09-16 Thread RICHARD M. HEIBERGER
Is this a Windows system behind a firewall? Can you reach the CRAN mirrors directly from Internet Explorer? If yes to both, then you need to use setInternet2(TRUE) before doing the package installations from the RConsole menu. See the Windows FAQ and the ?setInternet2 for more details. On Thu,

Re: [R] IP address

2010-09-16 Thread Peter Dalgaard
On 09/16/2010 04:42 PM, Ben Bolker wrote: > Jorge Nieves moorecap.com> writes: > >> >> >> Hi, >> >> We have some tight controls in our systems and I am having difficulty >> downloading/upgrading R packages. The IT department will configure our >> system to let me download packages from two or th

Re: [R] IP address

2010-09-16 Thread Ben Bolker
Jorge Nieves moorecap.com> writes: > > > Hi, > > We have some tight controls in our systems and I am having difficulty > downloading/upgrading R packages. The IT department will configure our > system to let me download packages from two or three R depositories. > How do I find out what the I

[R] IP address

2010-09-16 Thread Jorge Nieves
Hi, We have some tight controls in our systems and I am having difficulty downloading/upgrading R packages. The IT department will configure our system to let me download packages from two or three R depositories. How do I find out what the IP address of the R depositories are so that I can sele

Re: [R] IP-Address

2009-06-19 Thread David Huffer
On Wednesday, June 17, 2009 3:33 PM, edwin wrote: > Sorry, David has just told my that it was a mistake in my > example (Thanks David). I had a wrong idea. The right idea is: > make a ip range, when the number increament without an gap (and > with maximum number: 255, see example down). > In

Re: [R] IP-Address

2009-06-17 Thread David Locke
Perhaps it would help to remember that dotted quad notation is shorthand for an integer value. If an IP address is a.b.c.d, you can also represent it as a*16777216 + b*65536 +c*256 +d. If you can convert IP addresses to and from integers then it should be trivially easy to find the bounds of the

Re: [R] IP-Address

2009-06-17 Thread edwin
Hi all, Sorry, David has just told my that it was a mistake in my example (Thanks David). I had a wrong idea. The right idea is: make a ip range, when the number increament without an gap (and with maximum number: 255, see example down). In case my initial example would be: > 162.131

Re: [R] IP-Address

2009-06-09 Thread edwin7
Hi Peter, I hope you could help. I am stuck with this. The last problem I have is: I have table like: id rank color status ip 138 29746 yellow yes 162.131.58.1 138 29746 yellow yes 162.131.58.2 138 29746 yellow yes 162.131.58.3 138 29746 yellow yes 162.131.58.4 138 29746 yellow yes 162.131.

Re: [R] IP-Address

2009-06-04 Thread edwin
Thank you Peter, This solved the problem. > edw...@web.de wrote: > > Hi, > > > > > > Unfortunately, they can't handle NA. Any suggestion? Some row for Ip > > don't have ip address. This cause an error/ wrong result. > > A quick fix could be to substitute "..." or "0.0.0.0" for the "NA" > entries

Re: [R] IP-Address

2009-06-04 Thread Gabor Grothendieck
Suggest you be more specific. The solution I posted does handle missing values sorting them to the beginning: > Lines <- "id rank color status ip + 138 29746 yellow no 162.131.58.26 + 138 29746 red yes 162.131.58.16 + 138 29746 blue yes 162.131.58.10 + 138 29746 red no 162.131.58.17 + 138 297

Re: [R] IP-Address

2009-06-04 Thread Peter Dalgaard
edw...@web.de wrote: > Hi, > > > Unfortunately, they can't handle NA. Any suggestion? Some row for Ip > don't have ip address. This cause an error/ wrong result. A quick fix could be to substitute "..." or "0.0.0.0" for the "NA" entries. (Use something like ipch <- as.character(df$ip) ipch[is.n

Re: [R] IP-Address

2009-06-04 Thread edwin7
Hi, Unfortunately, they can't handle NA. Any suggestion? Some row for Ip don't have ip address. This cause an error/ wrong result. Eddie > library(gsubfn) > library(gtools) > library(rbenchmark) > > n <- 1 > df <- data.frame( > a = rnorm(n), > b = rnorm(n), > c = rnorm(n), > ip = r

Re: [R] IP-Address

2009-06-01 Thread Henrik Bengtsson
Feel free to use my code however you want. If you put in a package I prefer an LGPL license, but not required. See R documentation on how to create a package. -H On Mon, Jun 1, 2009 at 9:00 AM, edwin wrote: > > Maybe you can make a package for something like this. (IP sort,etc). Like in > Perl

Re: [R] IP-Address

2009-06-01 Thread edwin
Maybe you can make a package for something like this. (IP sort,etc). Like in Perl, there is a module called Sort::Key::IPv4 I think, not only me has the same problem for sorting e.g IP? Eddie > Not really, just the old saying that any piece of code can be made > twice as fast (which often holds

Re: [R] IP-Address

2009-06-01 Thread edwin
wow =P Thank you guys. I will use the hb2 , because it is the fastest one. Eddie > wow! :) > > vQ > > Henrik Bengtsson wrote: > > library(gsubfn) > > library(gtools) > > library(rbenchmark) > > > > n <- 1 > > df <- data.frame( > > a = rnorm(n), > > b = rnorm(n), > > c = rnorm(n), > >

Re: [R] IP-Address

2009-05-31 Thread Henrik Bengtsson
Not really, just the old saying that any piece of code can be made twice as fast (which often holds true recursively). /Henrik On Sun, May 31, 2009 at 1:58 PM, Wacek Kusnierczyk wrote: > wow! :) > > vQ > > Henrik Bengtsson wrote: >> library(gsubfn) >> library(gtools) >> library(rbenchmark) >> >>

Re: [R] IP-Address

2009-05-31 Thread Wacek Kusnierczyk
wow! :) vQ Henrik Bengtsson wrote: > library(gsubfn) > library(gtools) > library(rbenchmark) > > n <- 1 > df <- data.frame( > a = rnorm(n), > b = rnorm(n), > c = rnorm(n), > ip = replicate(n, paste(sample(255, 4), collapse='.'), simplify=TRUE) > ) > > res <- benchmark(columns=c('test'

Re: [R] IP-Address

2009-05-31 Thread Henrik Bengtsson
library(gsubfn) library(gtools) library(rbenchmark) n <- 1 df <- data.frame( a = rnorm(n), b = rnorm(n), c = rnorm(n), ip = replicate(n, paste(sample(255, 4), collapse='.'), simplify=TRUE) ) res <- benchmark(columns=c('test', 'elapsed'), replications=10, order=NULL, peda = { con

Re: [R] IP-Address

2009-05-31 Thread Wacek Kusnierczyk
edwin Sendjaja wrote: > Hi VQ, > > Thank you. It works like charm. But I think Peter's code is faster. What is > the difference? > i think peter's code is more r-elegant, though less generic. here's a quick test, with not so surprising results. gsubfn is implemented in r, not c, and it is p

Re: [R] IP-Address

2009-05-30 Thread Gabor Grothendieck
Here is yet another way: library(gtools) DF[mixedorder(DF$ip), ] On Fri, May 29, 2009 at 12:51 AM, edwin Sendjaja wrote: > > Hi, > > Is there any way to sort a tabel with a colum with IP-address? > > table: > > id rank color status ip > 138 29746 yellow no 162.131.58.26 > 138 29746 red  yes  16

Re: [R] IP-Address

2009-05-30 Thread jim holtman
PM, edwin Sendjaja wrote: > > Hi VQ, > > Thank you. It works like charm. But I think Peter's code is faster. What is > the difference? > > > Eddie > > > > > > Date: Fri, 29 May 2009 11:44:15 +0200 > > From: waclaw.marcin.kusnierc...@idi.ntnu.no

Re: [R] IP-Address

2009-05-30 Thread edwin Sendjaja
Hi VQ, Thank you. It works like charm. But I think Peter's code is faster. What is the difference? Eddie > Date: Fri, 29 May 2009 11:44:15 +0200 > From: waclaw.marcin.kusnierc...@idi.ntnu.no > To: p.dalga...@biostat.ku.dk > CC: r-help@r-project.org > Subject

Re: [R] IP-Address

2009-05-30 Thread edwin Sendjaja
Hi Peter, This works as I expected. Thank you very much. Eddie > Date: Fri, 29 May 2009 11:15:37 +0200 > From: p.dalga...@biostat.ku.dk > To: all...@cybaea.com > CC: r-help@r-project.org > Subject: Re: [R] IP-Address > > Allan Engelhardt wrote: > >

Re: [R] IP-Address

2009-05-30 Thread edwin Sendjaja
9:59:40 +0100 > From: all...@cybaea.com > To: edwin_0...@msn.com > CC: r-help@r-project.org > Subject: Re: [R] IP-Address > > IP addresses are very (very!) difficult to parse and sort correctly > because there are all sorts of supported formats. Try to use something > l

Re: [R] IP-Address

2009-05-29 Thread Allan Engelhardt
Peter Dalgaard wrote: > Allan Engelhardt wrote: > >> [...] >> Getting rid of the conversions including the matrix(unlist) combo is >> left as an exercise (it's too hot here) >> > > Here's one way: > > con <- textConnection(as.character(a$ip)) > o <- do.call(order,read.table(con,sep=".")

Re: [R] IP-Address

2009-05-29 Thread Wacek Kusnierczyk
Peter Dalgaard wrote: > Allan Engelhardt wrote: > >> IP addresses are very (very!) difficult to parse and sort correctly >> because there are all sorts of supported formats. Try to use something >> like PostgreSQL instead: it is already implemented there. But if you >> are sure all your data i

Re: [R] IP-Address

2009-05-29 Thread Erich Neuwirth
normalizedip <- function(ipstring){ ipsepstring <- strsplit(ipstring,"\\.")[[1]] cat(sapply(ipsepstring,function(x) sprintf("%03i",as.numeric(x))),sep=".") } normalizedip("1.2.3.55") yields "001.002.003.055" and therefore should allow you to sort in correct order. edwin Sendjaja wrot

Re: [R] IP-Address

2009-05-29 Thread Peter Dalgaard
Allan Engelhardt wrote: > IP addresses are very (very!) difficult to parse and sort correctly > because there are all sorts of supported formats. Try to use something > like PostgreSQL instead: it is already implemented there. But if you > are sure all your data is of the n.n.n.n form, then somet

Re: [R] IP-Address

2009-05-29 Thread Allan Engelhardt
IP addresses are very (very!) difficult to parse and sort correctly because there are all sorts of supported formats. Try to use something like PostgreSQL instead: it is already implemented there. But if you are sure all your data is of the n.n.n.n form, then something along the lines of the

[R] IP-Address

2009-05-28 Thread edwin Sendjaja
Hi, Is there any way to sort a tabel with a colum with IP-address? table: id rank color status ip 138 29746 yellow no 162.131.58.26 138 29746 red yes 162.131.58.16 138 29746 blue yes 162.131.58.10 138 29746 red no 162.131.58.17 138 29746 yellow no 162.131.58.14 138 29746 red no 162.131.58.