Re: [Rd] Weird issue when iterating through dates

2015-08-12 Thread Luca Cerone
Following up on this, should I report a bug? can you drive me through
the process?

Cheers,
Luca

On Thu, Aug 6, 2015 at 4:55 PM, William Dunlap  wrote:
>>> Just a quick question: what's the difference between  `[.Date` and
>>> `[[.Date`?
>>> Is it supposed to be the method for accessing the value right?
>>
>>For Dates and atomic vectors in general they are the same, but ...
>
> Even for atomic vectors with names they are not quite the same
> > c(One=1, Two=2)[[2]]
> [1] 2
> > c(One=1, Two=2)[2]
> Two
>   2
> (and [[ will only return 1 item, unlike [).
>
>
> Bill Dunlap
> TIBCO Software
> wdunlap tibco.com
>
> On Thu, Aug 6, 2015 at 5:36 AM, Gábor Csárdi  wrote:
>>
>> On Thu, Aug 6, 2015 at 6:30 AM, Luca Cerone  wrote:
>> [...]
>> > Just a quick question: what's the difference between  `[.Date` and
>> > `[[.Date`?
>> > Is it supposed to be the method for accessing the value right?
>>
>> For Dates and atomic vectors in general they are the same, but in
>> general they are two different operators that behave differently on
>> some data types. E.g. on lists [ selects a sub-list and [[ selects a
>> single element.
>>
>> Gabor
>>
>> [...]
>>
>> __
>> R-devel@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Weird issue when iterating through dates

2015-08-12 Thread Gábor Csárdi
I am not sure if this is a bug or not.

Gabor

On Wed, Aug 12, 2015 at 11:51 AM, Luca Cerone  wrote:
> Following up on this, should I report a bug? can you drive me through
> the process?
>
> Cheers,
> Luca
>
> On Thu, Aug 6, 2015 at 4:55 PM, William Dunlap  wrote:
 Just a quick question: what's the difference between  `[.Date` and
 `[[.Date`?
 Is it supposed to be the method for accessing the value right?
>>>
>>>For Dates and atomic vectors in general they are the same, but ...
>>
>> Even for atomic vectors with names they are not quite the same
>> > c(One=1, Two=2)[[2]]
>> [1] 2
>> > c(One=1, Two=2)[2]
>> Two
>>   2
>> (and [[ will only return 1 item, unlike [).
>>
>>
>> Bill Dunlap
>> TIBCO Software
>> wdunlap tibco.com
>>
>> On Thu, Aug 6, 2015 at 5:36 AM, Gábor Csárdi  wrote:
>>>
>>> On Thu, Aug 6, 2015 at 6:30 AM, Luca Cerone  wrote:
>>> [...]
>>> > Just a quick question: what's the difference between  `[.Date` and
>>> > `[[.Date`?
>>> > Is it supposed to be the method for accessing the value right?
>>>
>>> For Dates and atomic vectors in general they are the same, but in
>>> general they are two different operators that behave differently on
>>> some data types. E.g. on lists [ selects a sub-list and [[ selects a
>>> single element.
>>>
>>> Gabor
>>>
>>> [...]
>>>
>>> __
>>> R-devel@r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>>

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Weird issue when iterating through dates

2015-08-12 Thread Joshua Ulrich
On Wed, Aug 12, 2015 at 10:55 AM, Gábor Csárdi  wrote:
> I am not sure if this is a bug or not.
>
I would argue that this isn't a bug, not even in the documentation of
"for" (even though it might be clearer).  ?"for" says that `seq` is
"[A]n expression evaluating to a vector (including a list and an
expression) or to a pairlist or 'NULL'".  Date objects aren't strictly
vectors, so they're treated as integer/numeric.

This answer on StackOverflow said that "for" does not copy any of the
iterators attributes (including class), which causes this behavior.
http://stackoverflow.com/a/23278464/271616

To respond to the original question regarding why the code below,
"prints the dates as a string".  Quite simply, you convert seq(d1,d2,
by=1) to character, so it's no longer a Date.  The fact that
Sys.Date() and as.character(Sys.Date()) both *print* the same thing
does not mean they are the same.

for ( dt in as.character(seq(d1,d2, by=1)) ) {
  print(dt)
}

Best,
Josh

> Gabor
>
> On Wed, Aug 12, 2015 at 11:51 AM, Luca Cerone  wrote:
>> Following up on this, should I report a bug? can you drive me through
>> the process?
>>
>> Cheers,
>> Luca
>>
>> On Thu, Aug 6, 2015 at 4:55 PM, William Dunlap  wrote:
> Just a quick question: what's the difference between  `[.Date` and
> `[[.Date`?
> Is it supposed to be the method for accessing the value right?

For Dates and atomic vectors in general they are the same, but ...
>>>
>>> Even for atomic vectors with names they are not quite the same
>>> > c(One=1, Two=2)[[2]]
>>> [1] 2
>>> > c(One=1, Two=2)[2]
>>> Two
>>>   2
>>> (and [[ will only return 1 item, unlike [).
>>>
>>>
>>> Bill Dunlap
>>> TIBCO Software
>>> wdunlap tibco.com
>>>
>>> On Thu, Aug 6, 2015 at 5:36 AM, Gábor Csárdi  wrote:

 On Thu, Aug 6, 2015 at 6:30 AM, Luca Cerone  wrote:
 [...]
 > Just a quick question: what's the difference between  `[.Date` and
 > `[[.Date`?
 > Is it supposed to be the method for accessing the value right?

 For Dates and atomic vectors in general they are the same, but in
 general they are two different operators that behave differently on
 some data types. E.g. on lists [ selects a sub-list and [[ selects a
 single element.

 Gabor

 [...]

 __
 R-devel@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-devel
>>>
>>>
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] download.file() on ftp URL fails in windows with default download method

2015-08-12 Thread David Smith
We were also able to reproduce the issue on Windows Server 2012. If there's 
anything we can do to help please let me know; Elliot Waingold (CC'd here) can 
provide access to the VM we used for testing if that's of any help.

# David Smith

-- 
David M Smith 
R Community Lead, Revolution Analytics (a Microsoft company)  
Tel: +1 (312) 9205766 (Chicago IL, USA)
Twitter: @revodavid | Blog:  http://blog.revolutionanalytics.com
We are hiring engineers for Revolution R and Azure Machine Learning.

-Original Message-
From: R-devel [mailto:r-devel-boun...@r-project.org] On Behalf Of Dan Tenenbaum
Sent: Tuesday, August 11, 2015 09:51
To: Uwe Ligges 
Cc: R-devel@r-project.org
Subject: Re: [Rd] download.file() on ftp URL fails in windows with default 
download method



- Original Message -
> From: "Dan Tenenbaum" 
> To: "Uwe Ligges" 
> Cc: "R-devel@r-project.org" 
> Sent: Saturday, August 8, 2015 4:02:54 PM
> Subject: Re: [Rd] download.file() on ftp URL fails in windows with 
> default download method
> 
> 
> 
> - Original Message -
> > From: "Uwe Ligges" 
> > To: "Dan Tenenbaum" , 
> > "R-devel@r-project.org" 
> > Sent: Saturday, August 8, 2015 3:57:34 PM
> > Subject: Re: [Rd] download.file() on ftp URL fails in windows with 
> > default download method
> > 
> > 
> > 
> > On 08.08.2015 01:11, Dan Tenenbaum wrote:
> > > Hi,
> > >
> > >> url <-
> > >> "ftp://ftp.ncbi.nlm.nih.gov/genomes/ASSEMBLY_REPORTS/All/GCF_01405.13.assembly.txt";
> > >> download.file(url, tempfile())
> > > trying URL
> > > 'ftp://ftp.ncbi.nlm.nih.gov/genomes/ASSEMBLY_REPORTS/All/GCF_01405.13.assembly.txt'
> > > Error in download.file(url, tempfile()) :
> > >cannot open URL
> > >
> > > 'ftp://ftp.ncbi.nlm.nih.gov/genomes/ASSEMBLY_REPORTS/All/GCF_01405.13.assembly.txt'
> > > In addition: Warning message:
> > > In download.file(url, tempfile()) : InternetOpenUrl failed: ''
> > >
> > > If I set method="curl" it works fine. This was on R-3.2.2-beta
> > > (sessionInfo() below) but I got the same results in R-3.2.1 and 
> > > R-devel.
> > >
> > > This does not happen on Windows Server 2008 but it happens on 
> > > Windows Server 2012.
> > 
> > 
> > Thanks for letting us know. The kot recent machine I checked with is 
> > Windows Server 2008 R2 and I have not got problems on those. Can 
> > someone else rerpoduce this on Windows Server 2012?
> > 
> 
> If you like I can give you temporary access (via remote desktop) to a 
> machine in the Amazon cloud.
> You can also download a Vagrant box here:
> 
> https://na01.safelinks.protection.outlook.com/?url=https%3a%2f%2fatlas
> .hashicorp.com%2fboxes%2fsearch%3futf8%3d%25E2%259C%2593%26sort%3d%26p
> rovider%3d%26q%3dwindows%2bserver%2b2012&data=01%7c01%7cdavidsmi%40mic
> rosoft.com%7ce6746faa79b6426c81a508d2a26d3d35%7c72f988bf86f141af91ab2d
> 7cd011db47%7c1&sdata=Z5pE32RJ7wEs4UBfRxXSDEqG6ESxFSFmHdFCU78kuaA%3d
> 

Just wanted to check in about this to see whether anyone else has been able to 
reproduce this, or if Uwe has, or if anyone needs help setting up a test 
environment either in the cloud or by using a VM (like with Vagrant). I would 
be more than happy to help. I can set up a temporary instance in the cloud that 
interested parties could access at no cost.

This issue looks like a showstopper for Bioconductor; we are in the process of 
moving our build system, and we were upgrading from Windows Server 2008 to 
Windows Server 2012 in the process, but this issue is going to affect a lot of 
packages if it is not resolved.

What I can say is that it does not seem like a firewall issue, as the download 
works fine if I specify method="curl"  (or libcurl) or paste the url into a 
browser, and I get the same results whether Windows Firewall is on or off.

My naive guess is that the InternetOpenUrl API has changed in between Windows 
Server 2008 and Windows Server 2012.

The offending call to this API seems to be at 
src/modules/internet/internet.c:#908 (in the R-3.2 branch; I did try R-devel as 
of r68987 and it still has this problem).

I am really hoping something can be done about this before the release of 
R-3.2.2.

Thanks!
Dan



> Dan
> 
> 
> 
> > Best,
> > Uwe Ligges
> > 
> > >
> > > Dan
> > >
> > >> sessionInfo()
> > > R version 3.2.2 beta (2015-08-05 r68859)
> > > Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 
> > > Server 2012 x64 (build 9200)
> > >
> > > locale:
> > > [1] LC_COLLATE=English_United States.1252 [2] 
> > > LC_CTYPE=English_United States.1252 [3] LC_MONETARY=English_United 
> > > States.1252 [4] LC_NUMERIC=C [5] LC_TIME=English_United 
> > > States.1252
> > >
> > > attached base packages:
> > > [1] stats graphics  grDevices utils datasets  methods
> > >   base
> > >
> > > __
> > > R-devel@r-project.org mailing list 
> > > https://na01.safelinks.protection.outlook.com/?url=https%3a%2f%2fs
> > > tat.ethz.ch%2fmailman%2flistinfo%2fr-devel&data=01%7c01%7cdavidsmi
> > > %40m

[Rd] enableJIT in Rprofile leads to 'not a proper evaluation environment' on startup

2015-08-12 Thread Sam Steingold
A commenter on SO suggested that I copy my question to R-devel
http://stackoverflow.com/q/31972325/850781

I have had

--8<---cut here---start->8---
library(compiler)
compiler::enableJIT(3)
--8<---cut here---end--->8---

in ~/.Rprofile for years; now that I upgraded to 3.2.1 I get this on startup:

--8<---cut here---start->8---
Error in frameTypes(env) : not a proper evaluation environment
Calls:  ->  -> makeCenv -> structure -> frameTypes
> q()
Warning message:
restarting interrupted promise evaluation 
--8<---cut here---end--->8---

I don't see anything relevant in NEWS.

Replacing 3 with 2 in compiler::enableJIT(3) removes the error.
However, I would prefer my loops to be compiled too.

Suggestions?


-- 
Sam Steingold (http://sds.podval.org/) on darwin Ns 10.3.1348
http://www.childpsy.net/ http://dhimmi.org http://www.memritv.org
http://jihadwatch.org http://camera.org http://www.dhimmitude.org
He who laughs last thinks slowest.

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] download.file() on ftp URL fails in windows with default download method

2015-08-12 Thread Dan Tenenbaum
Hi David,

- Original Message -
> From: "David Smith" 
> To: "Dan Tenenbaum" , "Uwe Ligges" 
> , "Elliot Waingold"
> 
> Cc: "R-devel@r-project.org" 
> Sent: Wednesday, August 12, 2015 12:42:39 PM
> Subject: RE: [Rd] download.file() on ftp URL fails in windows with default 
> download method
> 
> We were also able to reproduce the issue on Windows Server 2012. If
> there's anything we can do to help please let me know; Elliot
> Waingold (CC'd here) can provide access to the VM we used for
> testing if that's of any help.
> 

Thanks!

I have just been looking at this issue with Martin Morgan. We found that if we 
"or" the additional flag INTERNET_FLAG_PASSIVE on line 1012 of 
src/modules/internet/internet.c (R-3.2 branch, last changed in r68393)
that the ftp connection works.

Further investigation reveals that in a passive ftp connection, certain ports 
on the client need to be open.
This machine is in the Amazon cloud so it was easy to open the ports. But we 
still have a problem and I believe it's that the wrong IP address is being sent 
to the server (on an AWS machine, the machine thinks of itself as having one IP 
address, but that is a private address that is valid inside AWS only). 

Here's a curl command line that gets around this by sending the correct address 
(or hostname):

curl --ftp-port myhostname.com 
ftp://ftp.ncbi.nlm.nih.gov/genomes/ASSEMBLY_REPORTS/All/GCF_01405.13.assembly.txt

Curl normally uses passive mode which is why it works, but the --ftp-port 
switch tells it to use active mode with the specified ip address or hostname.

So I'm not sure where we go from here. One easy fix is just to add the 
INTERNET_FLAG_PASSIVE flag as described above. Another would be to first check 
if active mode works, and if not, use passive mode. 

Dan


> # David Smith
> 
> --
> David M Smith 
> R Community Lead, Revolution Analytics (a Microsoft company)
> Tel: +1 (312) 9205766 (Chicago IL, USA)
> Twitter: @revodavid | Blog:  http://blog.revolutionanalytics.com
> We are hiring engineers for Revolution R and Azure Machine Learning.
> 
> -Original Message-
> From: R-devel [mailto:r-devel-boun...@r-project.org] On Behalf Of Dan
> Tenenbaum
> Sent: Tuesday, August 11, 2015 09:51
> To: Uwe Ligges 
> Cc: R-devel@r-project.org
> Subject: Re: [Rd] download.file() on ftp URL fails in windows with
> default download method
> 
> 
> 
> - Original Message -
> > From: "Dan Tenenbaum" 
> > To: "Uwe Ligges" 
> > Cc: "R-devel@r-project.org" 
> > Sent: Saturday, August 8, 2015 4:02:54 PM
> > Subject: Re: [Rd] download.file() on ftp URL fails in windows with
> > default download method
> > 
> > 
> > 
> > - Original Message -
> > > From: "Uwe Ligges" 
> > > To: "Dan Tenenbaum" ,
> > > "R-devel@r-project.org" 
> > > Sent: Saturday, August 8, 2015 3:57:34 PM
> > > Subject: Re: [Rd] download.file() on ftp URL fails in windows
> > > with
> > > default download method
> > > 
> > > 
> > > 
> > > On 08.08.2015 01:11, Dan Tenenbaum wrote:
> > > > Hi,
> > > >
> > > >> url <-
> > > >> "ftp://ftp.ncbi.nlm.nih.gov/genomes/ASSEMBLY_REPORTS/All/GCF_01405.13.assembly.txt";
> > > >> download.file(url, tempfile())
> > > > trying URL
> > > > 'ftp://ftp.ncbi.nlm.nih.gov/genomes/ASSEMBLY_REPORTS/All/GCF_01405.13.assembly.txt'
> > > > Error in download.file(url, tempfile()) :
> > > >cannot open URL
> > > >
> > > > 'ftp://ftp.ncbi.nlm.nih.gov/genomes/ASSEMBLY_REPORTS/All/GCF_01405.13.assembly.txt'
> > > > In addition: Warning message:
> > > > In download.file(url, tempfile()) : InternetOpenUrl failed: ''
> > > >
> > > > If I set method="curl" it works fine. This was on R-3.2.2-beta
> > > > (sessionInfo() below) but I got the same results in R-3.2.1 and
> > > > R-devel.
> > > >
> > > > This does not happen on Windows Server 2008 but it happens on
> > > > Windows Server 2012.
> > > 
> > > 
> > > Thanks for letting us know. The kot recent machine I checked with
> > > is
> > > Windows Server 2008 R2 and I have not got problems on those. Can
> > > someone else rerpoduce this on Windows Server 2012?
> > > 
> > 
> > If you like I can give you temporary access (via remote desktop) to
> > a
> > machine in the Amazon cloud.
> > You can also download a Vagrant box here:
> > 
> > https://na01.safelinks.protection.outlook.com/?url=https%3a%2f%2fatlas
> > .hashicorp.com%2fboxes%2fsearch%3futf8%3d%25E2%259C%2593%26sort%3d%26p
> > rovider%3d%26q%3dwindows%2bserver%2b2012&data=01%7c01%7cdavidsmi%40mic
> > rosoft.com%7ce6746faa79b6426c81a508d2a26d3d35%7c72f988bf86f141af91ab2d
> > 7cd011db47%7c1&sdata=Z5pE32RJ7wEs4UBfRxXSDEqG6ESxFSFmHdFCU78kuaA%3d
> > 
> 
> Just wanted to check in about this to see whether anyone else has
> been able to reproduce this, or if Uwe has, or if anyone needs help
> setting up a test environment either in the cloud or by using a VM
> (like with Vagrant). I would be more than happy to help. I can set
> up a temporary instance in the cloud that interested parties could
> access at n