Re: [Rd] How to build a list with missing values? What is missing, anyway?

2012-10-05 Thread Bert Gunter
Why not just use the list constructor:

theList <- setNames(vector("list",3),letters[1:3])

## The list components are empty = NULL, not NA)

This also doesn't seem to be an R-devel topic.

-- Bert

On Wed, Oct 3, 2012 at 11:21 PM, Josh O'Brien  wrote:
>
>>Say I have argnames <- c("a", "b", "c").
> >From that I want to construct the equivalent of alist(a=, b=, c=).
>
> Here's a one liner that'll do that for you:
>
> argnames <- letters[1:3]
> setNames(rep(list(bquote()), length(argnames)), argnames)
>
> - Josh
>
>
>
> --
> View this message in context: 
> http://r.789695.n4.nabble.com/How-to-build-a-list-with-missing-values-What-is-missing-anyway-tp4644957p4644965.html
> Sent from the R devel mailing list archive at Nabble.com.
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

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


Re: [Rd] How to build a list with missing values? What is missing, anyway?

2012-10-05 Thread Bert Gunter
The R Language definition manual explains all of this. Read it.

-- Bert

On Thu, Oct 4, 2012 at 3:53 PM, Peter Meilstrup
 wrote:
> On Wed, Oct 3, 2012 at 11:21 PM, Josh O'Brien  wrote:
>>
>>>Say I have argnames <- c("a", "b", "c").
>> >From that I want to construct the equivalent of alist(a=, b=, c=).
>>
>> Here's a one liner that'll do that for you:
>>
>> argnames <- letters[1:3]
>> setNames(rep(list(bquote()), length(argnames)), argnames)
>
> Thanks.
>
> Just so I have my mental model correct, I'm gathering that missing/``
> is a symbol that the interpreter has a special rule for -- evaluating
> it raises an error, as opposed to objects that evaluate to themselves
> or variable names that evaluate to objects.
>
> Does the same sort of thing explain the behavior of `...`? When the
> interpreter comes across `...` in the arguments during evaluation of a
> call, it trips a special argument-interpolating behavior?
>
> Peter
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

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


Re: [Rd] How to build a list with missing values? What is missing, anyway?

2012-10-05 Thread Bert Gunter
On Thu, Oct 4, 2012 at 6:31 PM, Peter Meilstrup
 wrote:
> On Thu, Oct 4, 2012 at 6:12 PM, Bert Gunter  wrote:
>> The R Language definition manual explains all of this. Read it.
>
> I always reread that before I post to this list.
>
> The only relevant mention of "missing" in the R Language Definition
> that I could find were in section 4.1.2 on page 25, and that section

Page 15, "NA handling" seems "relevant, " as does ?NA (at the command
prompt in R).
See also 2.5 in the Introduction to R tutorial.

> did not answer anything about "missing" as a special symbol (e.g. that
> my be put in a formal argument list.)
>
> There is another mention of `...` in section 4.3.2 and it does not

See section 2.1.9 of the Language Definition manual and 10.4 of Intro to R.

> explain some things, such as under what circumstances one would get a
> "`...` used in incorrect context" error.

How could it possibly know that?

-- Bert

>
> Peter
>
>>>
>>> Thanks.
>>>
>>> Just so I have my mental model correct, I'm gathering that missing/``
>>> is a symbol that the interpreter has a special rule for -- evaluating
>>> it raises an error, as opposed to objects that evaluate to themselves
>>> or variable names that evaluate to objects.
>>>
>>> Does the same sort of thing explain the behavior of `...`? When the
>>> interpreter comes across `...` in the arguments during evaluation of a
>>> call, it trips a special argument-interpolating behavior?
>>>
>>> Peter
>>>
>>> __
>>> R-devel@r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>>
>>
>> --
>>
>> Bert Gunter
>> Genentech Nonclinical Biostatistics
>>
>> Internal Contact Info:
>> Phone: 467-7374
>> Website:
>> http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

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


Re: [Rd] identical() fails to compare isS4() to TRUE

2012-10-05 Thread Martin Morgan

On 10/04/2012 05:56 PM, Martin Morgan wrote:

On 10/04/2012 04:05 PM, Duncan Murdoch wrote:

On 12-10-04 5:50 PM, Martin Morgan wrote:

On 10/04/2012 02:23 PM, Duncan Murdoch wrote:

On 12-10-04 4:57 PM, Martin Morgan wrote:


   > setClass("A", "integer")
   > isS4(new("A"))
[1] TRUE
   > identical(isS4(new("A")), TRUE)
[1] FALSE

   > sessionInfo()
R Under development (unstable) (2012-10-04 r60876)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
[1] LC_CTYPE=en_US.UTF-8   LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=C LC_NAME=C
[9] LC_ADDRESS=C   LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base



I can confirm this in R-devel, but it doesn't happen in R-patched.  In R-devel,
isS4 is returning a vector marked as LGLSXP, but containing the value 16, not
the usual 1 for TRUE.

  > .Internal(inspect(isS4(new("A"
@4bfbed8 10 LGLSXP g0c1 [] (len=1, tl=0) 16

I'm not going to have time to track this down and fix it.


The bit is set at src/include/Rinternals.h:278

   39103jmc #define IS_S4_OBJECT(x) ((x)->sxpinfo.gp & S4_OBJECT_MASK)

but it's identical that has changed; it looks as though there are other similar
operations in that header and probably elsewhere.


In R-patched, it returned the value 1 for TRUE, so I'm not sure identical() has
changed.


R version 2.15.1 Patched (2012-09-24 r60798) has

 > isS4
function (object)
.Call("R_isS4Object", object, PACKAGE = "base")

with objects.c:1531

SEXP R_isS4Object(SEXP object)
{
 /* wanted: return isS4(object) ? mkTrue() : mkFalse(); */
 return IS_S4_OBJECT(object) ? mkTrue() : mkFalse(); ;
}

where R-devel has

 > isS4
function (object)  .Primitive("isS4")

with coerce.c:1843

 case 51:/* isS4 */
 LOGICAL(ans)[0] = IS_S4_OBJECT(CAR(args));
 break;

made in r60395


and fixed in r60877, thanks. Martin



Martin



Duncan Murdoch



Martin



Duncan Murdoch











--
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M1 B861
Phone: (206) 667-2793

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


[Rd] Problems with install.packages when Ncpus > 1

2012-10-05 Thread Winston Chang
I have a Ubuntu Linux 12.04.1 machine running R 2.15.1. I'm trying to
run tests building packages, so install.packages() is trying to
install about about 1000 packages from source. I'm running into some
strange issues that seem related to using values for Ncpus other than 1.

When I use Ncpus=32, about 260 of the packages fail to install. When I
tried again with Ncpus=2, more of them get installed, and there were
only 234 failed packages. I tried it again with Ncpus=1, after which
there were only 142 failed packages. (I think these remaining failed
packages are due to missing external dependencies, like RODBC, Java,
and various development libraries, so these aren't a concern at the
moment.)

In the code for install.packages, I see that if Ncpus>1, it passes the
Ncpus to make, as in 'make -k -j 32'. Is it possible that these
packages are failing because of this option to make?

Has anyone else run into this issue before?

Thanks!
-Winston

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


Re: [Rd] Problems with install.packages when Ncpus > 1

2012-10-05 Thread Prof Brian Ripley

On 06/10/2012 05:42, Winston Chang wrote:

I have a Ubuntu Linux 12.04.1 machine running R 2.15.1. I'm trying to
run tests building packages, so install.packages() is trying to
install about about 1000 packages from source. I'm running into some
strange issues that seem related to using values for Ncpus other than 1.

When I use Ncpus=32, about 260 of the packages fail to install. When I
tried again with Ncpus=2, more of them get installed, and there were
only 234 failed packages. I tried it again with Ncpus=1, after which
there were only 142 failed packages. (I think these remaining failed
packages are due to missing external dependencies, like RODBC, Java,
and various development libraries, so these aren't a concern at the
moment.)

In the code for install.packages, I see that if Ncpus>1, it passes the
Ncpus to make, as in 'make -k -j 32'. Is it possible that these
packages are failing because of this option to make?


It is perfectly correct option: please do your homework before posting 
as the posting guide asked of you.


Has anyone else run into this issue before?


Yes.  It is due to missing dependencies between packages.   I find this 
works well on CRAN *provided* that the BioC repositories are also 
selected so that dependencies can be traced via BioC dependencies. 
However, BioC does have a fair few missing dependencies in its packages 
(run R CMD check over BioC to see them).


Take a look at the logs of the failed packages.  One I see frequently is 
that ddgraph fails because it depends indirectly on RBGL which takes a 
long time to install and is still being done.




Thanks!
-Winston



--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

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