Re: [Rd] User Input

2015-07-12 Thread Thierry Onkelinx
If you use S4 objects then have a look at ?setValidity

Best regards,

Thierry
Op 11-jul.-2015 04:11 schreef "Glenn Schultz" :

> All,
>
> I have a package BondLab, all variables are passed to the models via Cusip
> objects.
>
> The only variables input by the user are
> settlement date,
> price or yield or spread.
>
> Further price may be passed as 100.125, 100-8 (1/8), or 100-2 (2/64) or
> 100-2+ (5/128).
>
> Once passed these variables must have a steady state (in decimal).  After
> reading the R documentation and Hadley's book I think the way to do this is
> via a class but I can quite get my head around how to do it.  A nominal
> model is:
>
> Analytics <- function(bondid = cusip, tradedate = trade.date, settledate =
> settle.date, price = 100.125){
> BondAnalytics <- BondAnalytics(tradedate = tradedate, settledate =
> settledate, price = price)
> New("BondAnalytics ...)
> }
>
> So, price is an input to a constructor function which calls other
> functions to create the class object BondAnalytics.  If price is an object
> with validity how do I make that part of the function?
>
> If I do make it class how does it function input inherit?  I read John
> Chamber's book but I am not sure... maybe it does not have to be a class
> but something else or is it something like the below:
>
> BondAnalytics <- function(bond.id = "character", tradedate = "character",
> settledate = "character", price = .Object){
> do stuff...}
>
> Advice appreciated,
> -glenn
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

[[alternative HTML version deleted]]

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


[Rd] Why no support for 3-digit HEX colours?

2015-07-12 Thread Dean Attali
When specifying an RGB colour in R, is there a strong reason not to accept
3-character HEX codes? In CSS and many other languages, a colour of "#ABC"
is automatically converted to "#AABBCC", and I was wondering if R could
support that as well, or if it was a conscious decision to not support it.


---
http://deanattali.com

[[alternative HTML version deleted]]

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


Re: [Rd] Why no support for 3-digit HEX colours?

2015-07-12 Thread Duncan Murdoch
On 12/07/2015 3:51 PM, Dean Attali wrote:
> When specifying an RGB colour in R, is there a strong reason not to accept
> 3-character HEX codes? In CSS and many other languages, a colour of "#ABC"
> is automatically converted to "#AABBCC", and I was wondering if R could
> support that as well, or if it was a conscious decision to not support it.

This is on the wish list.  See

https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=16426

Duncan Murdoch

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


Re: [Rd] Why no support for 3-digit HEX colours?

2015-07-12 Thread Dean Attali
And very recent as well, good to know, thanks!

---
http://deanattali.com

On 12 July 2015 at 13:32, Duncan Murdoch  wrote:

> On 12/07/2015 3:51 PM, Dean Attali wrote:
> > When specifying an RGB colour in R, is there a strong reason not to
> accept
> > 3-character HEX codes? In CSS and many other languages, a colour of
> "#ABC"
> > is automatically converted to "#AABBCC", and I was wondering if R could
> > support that as well, or if it was a conscious decision to not support
> it.
>
> This is on the wish list.  See
>
> https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=16426
>
> Duncan Murdoch
>
>

[[alternative HTML version deleted]]

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


[Rd] suggestion: better support for https CRAN mirrors

2015-07-12 Thread Arthur Vigil
Hello,
I see that https CRAN mirrors are starting to pop up, as per this post at 
https://support.rstudio.com/hc/en-us/articles/206827897-Secure-Package-Downloads-for-R

However, trying to use one of these mirrors without changing the default 
download.file.method option gives me errors

> Warning: unable to access index for repository 
> https://cran.rstudio.com/src/contrib
> Warning: unable to access index for repository 
> https://cran.rstudio.com/bin/macosx/mavericks/contrib/3.2

I don’t mind just choosing an http mirror but when prompted to select a mirror, 
there is no distinction made in the mirror listing between http and https 
mirrors. It would be nice if https mirrors were hidden when the current 
environment doesn’t support them. Alternatively, at least make a distinction 
between http and https in the mirror listing. They currently just look like 
duplicates. I think this is a pretty trivial change but would help a lot with 
usability.

As an example, when using install.packages:

> --- Please select a CRAN mirror for use in this session ---
> CRAN mirror 
> 
>   1: 0-Cloud2: 0-Cloud
>   3: Algeria4: Argentina (La Plata)   
>   5: Australia (Canberra)   6: Australia (Melbourne)  
>   7: Austria8: Austria
>   9: Belgium   10: Brazil (BA)
>  11: Brazil (PR)   12: Brazil (RJ)
>  13: Brazil (SP 1) 14: Brazil (SP 2)

In the listing above there are duplicate entries for 0-cloud and Austria 
pointing to http and https versions of the same mirror.
__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] suggestion: better support for https CRAN mirrors

2015-07-12 Thread Duncan Murdoch
On 12/07/2015 5:15 PM, Arthur Vigil wrote:
> Hello,
> I see that https CRAN mirrors are starting to pop up, as per this post at 
> https://support.rstudio.com/hc/en-us/articles/206827897-Secure-Package-Downloads-for-R
> 
> However, trying to use one of these mirrors without changing the default 
> download.file.method option gives me errors
> 
>> Warning: unable to access index for repository 
>> https://cran.rstudio.com/src/contrib
>> Warning: unable to access index for repository 
>> https://cran.rstudio.com/bin/macosx/mavericks/contrib/3.2
> 
> I don’t mind just choosing an http mirror but when prompted to select a 
> mirror, there is no distinction made in the mirror listing between http and 
> https mirrors. It would be nice if https mirrors were hidden when the current 
> environment doesn’t support them. Alternatively, at least make a distinction 
> between http and https in the mirror listing. They currently just look like 
> duplicates. I think this is a pretty trivial change but would help a lot with 
> usability.
> 
> As an example, when using install.packages:

If you update to R-patched, you'll see the difference.  With current
releases of R, you'll see some mirrors twice:  the first one is https,
the second is http.

The other issue you may have is that your system may be configured to
default to a method that doesn't support https.  Try
download.file("https://cran.rstudio.com";) and
readLines(url("https://cran.rstudio.com";)) to confirm that's not a
problem for you.

Duncan Murdoch

> 
>> --- Please select a CRAN mirror for use in this session ---
>> CRAN mirror 
>>
>>   1: 0-Cloud2: 0-Cloud
>>   3: Algeria4: Argentina (La Plata)   
>>   5: Australia (Canberra)   6: Australia (Melbourne)  
>>   7: Austria8: Austria
>>   9: Belgium   10: Brazil (BA)
>>  11: Brazil (PR)   12: Brazil (RJ)
>>  13: Brazil (SP 1) 14: Brazil (SP 2)
> 
> In the listing above there are duplicate entries for 0-cloud and Austria 
> pointing to http and https versions of the same mirror.
> __
> 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] suggestion: better support for https CRAN mirrors

2015-07-12 Thread Duncan Murdoch
On 12/07/2015 6:54 PM, Duncan Murdoch wrote:
> On 12/07/2015 5:15 PM, Arthur Vigil wrote:
>> Hello,
>> I see that https CRAN mirrors are starting to pop up, as per this post at 
>> https://support.rstudio.com/hc/en-us/articles/206827897-Secure-Package-Downloads-for-R
>>
>> However, trying to use one of these mirrors without changing the default 
>> download.file.method option gives me errors
>>
>>> Warning: unable to access index for repository 
>>> https://cran.rstudio.com/src/contrib
>>> Warning: unable to access index for repository 
>>> https://cran.rstudio.com/bin/macosx/mavericks/contrib/3.2
>>
>> I don’t mind just choosing an http mirror but when prompted to select a 
>> mirror, there is no distinction made in the mirror listing between http and 
>> https mirrors. It would be nice if https mirrors were hidden when the 
>> current environment doesn’t support them. Alternatively, at least make a 
>> distinction between http and https in the mirror listing. They currently 
>> just look like duplicates. I think this is a pretty trivial change but would 
>> help a lot with usability.
>>
>> As an example, when using install.packages:
> 
> If you update to R-patched, you'll see the difference.  With current
> releases of R, you'll see some mirrors twice:  the first one is https,
> the second is http.
> 
> The other issue you may have is that your system may be configured to
> default to a method that doesn't support https.  Try
> download.file("https://cran.rstudio.com";) and

Oops, you need to give a destination.  Try

download.file("https://cran.rstudio.com";, destfile = (f <- tempfile()))

> readLines(url("https://cran.rstudio.com";)) to confirm that's not a
> problem for you.
> 
> Duncan Murdoch
> 
>>
>>> --- Please select a CRAN mirror for use in this session ---
>>> CRAN mirror 
>>>
>>>   1: 0-Cloud2: 0-Cloud
>>>   3: Algeria4: Argentina (La Plata)   
>>>   5: Australia (Canberra)   6: Australia (Melbourne)  
>>>   7: Austria8: Austria
>>>   9: Belgium   10: Brazil (BA)
>>>  11: Brazil (PR)   12: Brazil (RJ)
>>>  13: Brazil (SP 1) 14: Brazil (SP 2)
>>
>> In the listing above there are duplicate entries for 0-cloud and Austria 
>> pointing to http and https versions of the same mirror.
>> __
>> 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