Re: [Rd] No error when assigning values to an "empty" vector/matrix/array

2014-10-24 Thread Hervé Pagès

Hi Henrik,

On 10/23/2014 08:10 PM, Henrik Bengtsson wrote:

Assigning one or more values to a vector/matrix/array x for which
length(x) == 0 gives no error, e.g.


x <- integer(0)
x[] <- 1:2



x <- matrix(nrow=0, ncol=1)
x[] <- 1:2
x[,1] <- 1:2



x <- array(dim=c(0,1,1))
x[] <- 1:2
x[,1,1] <- 1:2


whereas


x <- integer(1)
x[] <- 1:2

Warning message:
In x[] <- 1:2 :
   number of items to replace is not a multiple of replacement length

x <- matrix(nrow=1, ncol=1)
x[] <- 1:2

Warning message:
In x[] <- 1:2 :
   number of items to replace is not a multiple of replacement length

x[,1] <- 1:2

Error in x[, 1] <- 1:2 :
   number of items to replace is not a multiple of replacement length

x <- array(dim=c(1,1,1))
x[] <- 1:2

Warning message:
In x[] <- 1:2 :
   number of items to replace is not a multiple of replacement length

x[,1,1] <- 1:2

Error in x[, 1, 1] <- 1:2 :
   number of items to replace is not a multiple of replacement length

Is this intended by design or is it a bug that should be reported?


Since [<- supports truncating of the right value, why an exception
should be made when the left vector has length 0?

Also note that these warnings or errors are complaining that the number
of items to replace (left length) is not a multiple of replacement
length (right length). This suggests that when the left length is a
multiple of the right length, everything is fine.
And this is actually the case when the left length is 0. Because
0 is a multiple of anything. So in that case, the right value is
truncated to length 0 and no warning is issued. Makes sense to me.

Cheers,
H.



/Henrik

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



--
Hervé Pagès

Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M1-B514
P.O. Box 19024
Seattle, WA 98109-1024

E-mail: hpa...@fhcrc.org
Phone:  (206) 667-5791
Fax:(206) 667-1319

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


Re: [Rd] No error when assigning values to an "empty" vector/matrix/array

2014-10-24 Thread Henrik Bengtsson
On Oct 24, 2014 1:59 AM, "Hervé Pagès"  wrote:
>
> Hi Henrik,
>
>
> On 10/23/2014 08:10 PM, Henrik Bengtsson wrote:
>>
>> Assigning one or more values to a vector/matrix/array x for which
>> length(x) == 0 gives no error, e.g.
>>
>>> x <- integer(0)
>>> x[] <- 1:2
>>
>>
>>> x <- matrix(nrow=0, ncol=1)
>>> x[] <- 1:2
>>> x[,1] <- 1:2
>>
>>
>>> x <- array(dim=c(0,1,1))
>>> x[] <- 1:2
>>> x[,1,1] <- 1:2
>>
>>
>> whereas
>>
>>> x <- integer(1)
>>> x[] <- 1:2
>>
>> Warning message:
>> In x[] <- 1:2 :
>>number of items to replace is not a multiple of replacement length
>>>
>>> x <- matrix(nrow=1, ncol=1)
>>> x[] <- 1:2
>>
>> Warning message:
>> In x[] <- 1:2 :
>>number of items to replace is not a multiple of replacement length
>>>
>>> x[,1] <- 1:2
>>
>> Error in x[, 1] <- 1:2 :
>>number of items to replace is not a multiple of replacement length
>>>
>>> x <- array(dim=c(1,1,1))
>>> x[] <- 1:2
>>
>> Warning message:
>> In x[] <- 1:2 :
>>number of items to replace is not a multiple of replacement length
>>>
>>> x[,1,1] <- 1:2
>>
>> Error in x[, 1, 1] <- 1:2 :
>>number of items to replace is not a multiple of replacement length
>>
>> Is this intended by design or is it a bug that should be reported?
>
>
> Since [<- supports truncating of the right value, why an exception
> should be made when the left vector has length 0?
>
> Also note that these warnings or errors are complaining that the number
> of items to replace (left length) is not a multiple of replacement
> length (right length). This suggests that when the left length is a
> multiple of the right length, everything is fine.
> And this is actually the case when the left length is 0. Because
> 0 is a multiple of anything. So in that case, the right value is
> truncated to length 0 and no warning is issued. Makes sense to me.

Thanks Hervé, you gave the perfect explanation/rationale for this being
consistent.

Henrik

PS. The background to my question was that I had a function that populated
a zero-row matrix column by column with values. These values were in turn
generated by another function that incorrectly read all values available in
for when indeed requestion zero (treating NULL ["read all"] and integer(0)
["read none"] equally). An implementation error that indeed gave the
correct value in the end, although in an extremely inefficient way.

>
> Cheers,
> H.
>
>>
>> /Henrik
>>
>> __
>> R-devel@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>
> --
> Hervé Pagès
>
> Program in Computational Biology
> Division of Public Health Sciences
> Fred Hutchinson Cancer Research Center
> 1100 Fairview Ave. N, M1-B514
> P.O. Box 19024
> Seattle, WA 98109-1024
>
> E-mail: hpa...@fhcrc.org
> Phone:  (206) 667-5791
> Fax:(206) 667-1319

[[alternative HTML version deleted]]

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


[Rd] package checking apparently ok but R-forge version does not build

2014-10-24 Thread Enrico Bibbona
Dear r developers,
I'm writing a set of new functions for an existing R package on R-forge
(called COGARCH).
I wrote the new R code (but still no documentation), and updated the
NAMESPACE file.
I installed it from my local repository and everything seems to work.
I checked the local repository and the check did not produces errors, but 2
warnings and 2 notes (I attach the log) one of which just tell that there
is no documentation and the other were already present in previous versions.
However on R-forge the package is in building stutus and actually it does
not build.
Any suggestion? Does everything depend on the missing documentation?
The best Enrico

-- 
Enrico Bibbona
Dipartimento di Matematica
Università di Torino
https://sites.google.com/site/enricobibbona/

[[alternative HTML version deleted]]

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


Re: [Rd] No error when assigning values to an "empty" vector/matrix/array

2014-10-24 Thread S Ellison
> > Also note that these warnings or errors are complaining that the
> > number of items to replace (left length) is not a multiple of
> > replacement length (right length). This suggests that when the left
> > length is a multiple of the right length, everything is fine.
> > And this is actually the case when the left length is 0. Because
> > 0 is a multiple of anything. So in that case, the right value is
> > truncated to length 0 and no warning is issued. Makes sense to me.
> 
> Thanks Hervé, you gave the perfect explanation/rationale for this being
> consistent.

This explains why a check for exact multiple of replacement length does not 
trigger a warning, but surely that is not sensible in the length 0 case. In all 
other cases, this check warns when there will be truncation of the replacement, 
and that seems to me the sensible intent of the check. A silent truncation to 
nothing is surely not the intended behaviour.
I can't help feeling that the 'check for multiple of length' was a neat 
portmanteau check for several possible problems when recycling is allowed, but 
that the possibility of assigning to a length 0 object was not considered.

I'd suggest logging it as an issue to for R-core to at least look at and either 
to fix or to at least warn of in documentation.

S Ellison




***
This email and any attachments are confidential. Any use, copying or
disclosure other than by the intended recipient is unauthorised. If 
you have received this message in error, please notify the sender 
immediately via +44(0)20 8943 7000 or notify postmas...@lgcgroup.com 
and delete this message and any copies from your computer and network. 
LGC Limited. Registered in England 2991879. 
Registered office: Queens Road, Teddington, Middlesex, TW11 0LY, UK
__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] package checking apparently ok but R-forge version does not build

2014-10-24 Thread S Ellison
> However on R-forge the package is in building stutus and actually it does not
> build.
> Any suggestion? Does everything depend on the missing documentation?
The advice I'd expect is to make sure there are neither errors no warnings, as 
CRAN guardians are (rightly) reluctant to tolerate either. And a package 
without documentation is unlikely to help anyone else much anyway - even the 
author, in six months time - so that really should be there.

A secondary issue might be a difference in R version; are you running your r 
cmd check with the R version currently used by R forge? The checks change over 
time and with R version.

Finally, have you checked the log on R forge to see whether the check is 
returning the same warnings/errors that you see locally?

S Ellison



***
This email and any attachments are confidential. Any use, copying or
disclosure other than by the intended recipient is unauthorised. If 
you have received this message in error, please notify the sender 
immediately via +44(0)20 8943 7000 or notify postmas...@lgcgroup.com 
and delete this message and any copies from your computer and network. 
LGC Limited. Registered in England 2991879. 
Registered office: Queens Road, Teddington, Middlesex, TW11 0LY, UK
__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Error: Line starting 'Package: tools ...' is malformed!

2014-10-24 Thread Mike Beddo
I'm building R-3.1.1 (64 bit) from source on AIX 7.1. It was going well until I 
hit this:

xlc_r -q64 -Wl,-brtl -Wl,-G -Wl,-bexpall -Wl,-bnoentry -lc 
-L/opt/freeware/lib64 -L/opt/freeware/lib 
-Wl,-blibpath:/opt/freeware/lib64:/opt/freeware/lib:/usr/lib:/lib 
-Wl,-bmaxdata:0x8000 -o tools.so text.o init.o Rmd5.o md5.o signals.o 
install.o getfmts.o http.o gramLatex.o gramRd.o -lm
make[6]: Entering directory `/home/meb/source/R-3.1.1/src/library/tools/src'
mkdir -p -- ../../../../library/tools/libs
make[6]: Leaving directory `/home/meb/source/R-3.1.1/src/library/tools/src'
make[5]: Leaving directory `/home/meb/source/R-3.1.1/src/library/tools/src'
make[4]: Leaving directory `/home/meb/source/R-3.1.1/src/library/tools'
Error: Line starting 'Package: tools ...' is malformed!
Execution halted
make[3]: *** [all] Error 1
make[3]: Leaving directory `/home/meb/source/R-3.1.1/src/library/tools'
make[2]: *** [R] Error 1
make[2]: Leaving directory `/home/meb/source/R-3.1.1/src/library'
make[1]: *** [R] Error 1
make[1]: Leaving directory `/home/meb/source/R-3.1.1/src'
make: *** [R] Error 1
$ oslevel
7.1.0.0

Can someone help?

Thanks,

Mike

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


Re: [Rd] No error when assigning values to an "empty" vector/matrix/array

2014-10-24 Thread Hervé Pagès

Hi,

On 10/24/2014 06:58 AM, S Ellison wrote:

Also note that these warnings or errors are complaining that the
number of items to replace (left length) is not a multiple of
replacement length (right length). This suggests that when the left
length is a multiple of the right length, everything is fine.
And this is actually the case when the left length is 0. Because
0 is a multiple of anything. So in that case, the right value is
truncated to length 0 and no warning is issued. Makes sense to me.


Thanks Hervé, you gave the perfect explanation/rationale for this being
consistent.


This explains why a check for exact multiple of replacement length does not 
trigger a warning, but surely that is not sensible in the length 0 case. In all 
other cases, this check warns when there will be truncation of the replacement, 
and that seems to me the sensible intent of the check. A silent truncation to 
nothing is surely not the intended behaviour.


Yes truncation should not be silent. But truncation to length zero
should not be seen as a special case either. What would be more
sensible is that [<- recognizes the 2 distinct situations that
deserve a warning:
  1. Truncation (i.e. when left length is < right length).
  2. Left length is > right length AND left length is not a multiple
 of right length.
Then the warning we get should be clear about which situation was
detected. So we would get a sensible warning all the time, even
when left length is 0.

H.


I can't help feeling that the 'check for multiple of length' was a neat 
portmanteau check for several possible problems when recycling is allowed, but 
that the possibility of assigning to a length 0 object was not considered.

I'd suggest logging it as an issue to for R-core to at least look at and either 
to fix or to at least warn of in documentation.

S Ellison




***
This email and any attachments are confidential. Any u...{{dropped:26}}


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


[Rd] AIX build R-3.1.1 Matrix package fails

2014-10-24 Thread Mike Beddo
Problems building the recommended packages from R-3.1.1 source:

** building package indices
Loading required package: Matrix
Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object 
'/home/meb/source/R-3.1.1/library/Matrix/libs/Matrix.so':
  rtld: 0712-001 Symbol dtrsv_ was referenced
  from module /home/meb/source/R-3.1.1/library/Matrix/libs/Matrix.so(), but 
a runtime definition
  of the symbol was not found.
rtld: 0712-001 Symbol dgemv_ was referenced
  from module /home/meb/source/R-3.1.1/library/Matrix/libs/Matrix.so(), but 
a runtime definition
  of the symbol was not found.
rtld: 0712-001 Symbol dtrsm_ was referenced
  from module /home/meb/source/R-3.1.1/library/Matrix/libs/Matrix.so(), but 
a runtime definition
  of the symbol was not found.
rtld: 0712-001 Symbol dgemm_ was referenced
  from module /home/meb/source/R-3.1.1/library/Matrix/libs/Matrix.so(), but 
a runtime definition
  of the symbol was not found.
rtld: 0712-001 Symbol ztrsv_ was referenced
  from module /home/meb/source/R-3.1.1/library/Matrix/libs/Matrix.so(), but 
a runtime definition
  of the symbol was not found.
rtld: 0712
Error : require(Matrix) is not TRUE
ERROR: installing package indices failed
* removing '/home/meb/source/R-3.1.1/library/Matrix'
make[2]: *** [Matrix.ts] Error 1
make[2]: Leaving directory `/home/meb/source/R-3.1.1/src/library/Recommended'
make[1]: *** [recommended-packages] Error 2
make[1]: Leaving directory `/home/meb/source/R-3.1.1/src/library/Recommended'
make: *** [stamp-recommended] Error 2

- Mike

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