[Rd] extending the colClasses argument in read.table

2011-11-21 Thread Romain François

Hello,

We've released the int64 package to CRAN a few days ago. The package 
provides S4 classes "int64" and "uint64" that represent signed and 
unsigned 64 bit integer vectors.


One further development of the package is to facilitate reading 64 bit 
integer data from csv, etc ... files.


I have this function that wraps a call to read.csv to:
- read the "int64" and "uint64" columns as "character"
- converts them afterwards to the appropriate type


read.csv.int64 <- function (file, ...){
dots <- list( file, ... )
if( "colClasses" %in% names(dots) ){
colClasses <- dots[["colClasses"]]
idx.int64 <- colClasses == "int64"
idx.uint64 <- colClasses == "uint64"

colClasses[ idx.int64 | idx.uint64 ] <- "character"
dots[["colClasses" ]] <- colClasses

df <- do.call( "read.csv", dots )
if( any( idx.int64 ) ){
df[ idx.int64 ] <- lapply( df[ idx.int64 ], as.int64 )
}
if( any( idx.uint64 ) ){
df[ idx.uint64 ] <- lapply( df[ idx.uint64 ], as.uint64 )
}
df


} else {
read.csv( file, ... )
}
}

I was wondering if it would make sense to extend the colClasses argument 
so that other package can provide drivers, so that we could let the 
users just use read.csv, read.table, etc ...


Before I start digging into the internals of read.table, I wanted to 
have opinions about whether this would be a good idea, etc ...


Best Regards,

Romain

--
Romain Francois
Professional R Enthusiast
http://romainfrancois.blog.free.fr

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


[Rd] Efficient development of NAMESPACEd packages.

2011-11-21 Thread Vitalie Spinu
Dear R-devel,

How are the package authors supposed to develop their own NAMESPACEd
packages efficiently? And what are the directions R is taking in order to
facilitate the development cycle?

This questions are in the context of the recent thread on ESS-help
(http://thread.gmane.org/gmane.emacs.ess.general/5528/focus=5575) which
triggered the development of new ess-developer mode. In lay words, when
ess-developer mode is on, the evaluation of the code chunks is
"redirected" into the namespace:pkg and package:pkg, i.e. functions,
classes and methods are assigned in package namespace and package
environment, in the spirit of insertSource and assignInNamespace.

How does the above approach fit with the direction R is taking, in the
light of recent restrictions on "assignInNamespace" and the fact that R
does not have an unlockEnvironmnet function to unlock the package
namespace? Particularly are there any plans to restrict the use of
"unlockBinding" and "assign" functions?

Thanks,
Vitalie.

PS:
>From the NEWS file:

• assignInNamespace() has further restrictions on use apart from at
top-level, as its help page has warned.  Expect it to be disabled from
programmatic use in the future.

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


[Rd] Patched R build available today is missing some info (data and release number)

2011-11-21 Thread Joris Meys
Hi all,

The R version 2.14.0 Pacthed build from today, including patches up to
2011-11-20, is showing the following when started up :

R version 2.14.0 Patched (2006-00-00 r0)
...
Isn't something missing here, like a correct date and a release
number? On the page
http://cran.r-project.org/bin/windows/base/rpatched.html the release
number is r0 as well.

Cheers
Joris

-- 
Joris Meys
Statistical consultant

Ghent University
Faculty of Bioscience Engineering
Department of Mathematical Modelling, Statistics and Bio-Informatics

tel : +32 9 264 59 87
joris.m...@ugent.be
---
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php

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


Re: [Rd] Patched R build available today is missing some info (data and release number)

2011-11-21 Thread Uwe Ligges



On 21.11.2011 14:25, Joris Meys wrote:

Hi all,

The R version 2.14.0 Pacthed build from today, including patches up to
2011-11-20, is showing the following when started up :

R version 2.14.0 Patched (2006-00-00 r0)
...
Isn't something missing here, like a correct date and a release
number? On the page
http://cran.r-project.org/bin/windows/base/rpatched.html the release
number is r0 as well.

Cheers
Joris




Duncan Murdoch wrote yesterday he fixed this. So please just wait until 
the new binary is propagated to the master / mirrors.


Uwe Ligges

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


Re: [Rd] testing on platforms, was Fortran error

2011-11-21 Thread John C Nash
I think the poster is interested in being able to try the build/check on a Mac 
in the
fashion that Winbuilder does. That is, rather than have CRAN do all the 
platform checks,
is there a way to submit a package to be tested for just one platform?

It may be useful to have such a facility so package builders can test before 
submission,
and from my own experience I believe would help to render packages more 
platform neutral.

I suspect that all the pieces are in place to do this, but perhaps a nice front 
end is
needed. Is that something for a Google Summer of Code task?

Best,

JN

On 11/21/2011 06:00 AM, r-devel-requ...@r-project.org wrote:
> What does 'submit a test mean'?  Any test you write can check the 
> value of Sys.info()["sysname"]: it is "Darwin" on Mac OS X.
> Or R.version$platform, which will be something like 
> i386-apple-darwin9.8.0.

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


Re: [Rd] Patched R build available today is missing some info (data and release number)

2011-11-21 Thread Duncan Murdoch

On 21/11/2011 8:39 AM, Uwe Ligges wrote:


On 21.11.2011 14:25, Joris Meys wrote:
>  Hi all,
>
>  The R version 2.14.0 Pacthed build from today, including patches up to
>  2011-11-20, is showing the following when started up :
>
>  R version 2.14.0 Patched (2006-00-00 r0)
>  ...
>  Isn't something missing here, like a correct date and a release
>  number? On the page
>  http://cran.r-project.org/bin/windows/base/rpatched.html the release
>  number is r0 as well.
>
>  Cheers
>  Joris
>


Duncan Murdoch wrote yesterday he fixed this. So please just wait until
the new binary is propagated to the master / mirrors.


Yesterday's fix wasn't sufficient, but I think today's is.

Duncan Murdoch

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


[Rd] a^b when a is large and b < 1 (64bit R on windows 7)

2011-11-21 Thread Martyn Byng
Hi,

I'm getting some strange behaviour when trying to use the power operator
(a^b) when a is large and b is less than one:

big <- .Machine$double.xmax
big
big^0.5
sqrt(big)

> big <- 1.797693134862315708384e+308
> big^0.5
[1] Inf
> sqrt(big)
[1] 1.340781e+154


I'm guessing that this behaviour is not expected, or am I missing
something about ^?

Cheers

Martyn



> sessionInfo()
R version 2.14.0 (2011-10-31)
Platform: x86_64-pc-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United Kingdom.1252
[2] LC_CTYPE=English_United Kingdom.1252
[3] LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.1252

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


The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. Th...{{dropped:4}}

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


Re: [Rd] a^b when a is large and b < 1 (64bit R on windows 7)

2011-11-21 Thread Joris Meys
I can reproduce on the latest patched build, but this is specific for
the 64bit version of R. On a 32bit it works as expected:

> big <- 1.797693134862315708385e+308
> sqrt(big)
[1] 1.340781e+154
> big^0.5
[1] 1.340781e+154

The 64bit part might have something to do with it, and now move out of
the way for people that actually know what they're talking about...

Cheers
Joris


On Mon, Nov 21, 2011 at 3:41 PM, Martyn Byng  wrote:
> Hi,
>
> I'm getting some strange behaviour when trying to use the power operator
> (a^b) when a is large and b is less than one:
>
> big <- .Machine$double.xmax
> big
> big^0.5
> sqrt(big)
>
>> big <- 1.797693134862315708384e+308
>> big^0.5
> [1] Inf
>> sqrt(big)
> [1] 1.340781e+154
>
>
> I'm guessing that this behaviour is not expected, or am I missing
> something about ^?
>
> Cheers
>
> Martyn
>
>
>
>> sessionInfo()
> R version 2.14.0 (2011-10-31)
> Platform: x86_64-pc-mingw32/x64 (64-bit)
>
> locale:
> [1] LC_COLLATE=English_United Kingdom.1252
> [2] LC_CTYPE=English_United Kingdom.1252
> [3] LC_MONETARY=English_United Kingdom.1252
> [4] LC_NUMERIC=C
> [5] LC_TIME=English_United Kingdom.1252
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> 
> The Numerical Algorithms Group Ltd is a company registered in England
> and Wales with company number 1249803. The registered office is:
> Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.
>
> This e-mail has been scanned for all viruses by Star. Th...{{dropped:4}}
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



-- 
Joris Meys
Statistical consultant

Ghent University
Faculty of Bioscience Engineering
Department of Mathematical Modelling, Statistics and Bio-Informatics

tel : +32 9 264 59 87
joris.m...@ugent.be
---
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php

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


Re: [Rd] a^b when a is large and b < 1 (64bit R on windows 7)

2011-11-21 Thread Brian G. Peterson
On Mon, 2011-11-21 at 14:41 +, Martyn Byng wrote:
> I'm getting some strange behaviour when trying to use the power
> operator
> (a^b) when a is large and b is less than one:
> 
> big <- .Machine$double.xmax
> big
> big^0.5
> sqrt(big)
> 
> > big <- 1.797693134862315708384e+308
> > big^0.5
> [1] Inf
> > sqrt(big)
> [1] 1.340781e+154
> 
> 
> I'm guessing that this behaviour is not expected, or am I missing
> something about ^? 

On a recent Ubuntu 64bit install with R2.14.0 from the repositories, I
get:

> big <- .Machine$double.xmax
> big
[1] 1.797693e+308
> big^0.5
[1] 1.340781e+154
> sqrt(big)
[1] 1.340781e+154

so it does seem to be specific either to your environment.

-- 
Brian G. Peterson
http://braverock.com/brian/
Ph: 773-459-4973
IM: bgpbraverock

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


Re: [Rd] a^b when a is large and b < 1 (64bit R on windows 7)

2011-11-21 Thread Joris Meys
Should have specified I only checked on Windows. So: On Windows 7
64bit, the R-32bit works fine, the R-64bit gives the behaviour Martyn
reported.

Cheers
Joris

On Mon, Nov 21, 2011 at 3:58 PM, Brian G. Peterson  wrote:
> On Mon, 2011-11-21 at 14:41 +, Martyn Byng wrote:
>> I'm getting some strange behaviour when trying to use the power
>> operator
>> (a^b) when a is large and b is less than one:
>>
>> big <- .Machine$double.xmax
>> big
>> big^0.5
>> sqrt(big)
>>
>> > big <- 1.797693134862315708384e+308
>> > big^0.5
>> [1] Inf
>> > sqrt(big)
>> [1] 1.340781e+154
>>
>>
>> I'm guessing that this behaviour is not expected, or am I missing
>> something about ^?
>
> On a recent Ubuntu 64bit install with R2.14.0 from the repositories, I
> get:
>
>> big <- .Machine$double.xmax
>> big
> [1] 1.797693e+308
>> big^0.5
> [1] 1.340781e+154
>> sqrt(big)
> [1] 1.340781e+154
>
> so it does seem to be specific either to your environment.
>
> --
> Brian G. Peterson
> http://braverock.com/brian/
> Ph: 773-459-4973
> IM: bgpbraverock
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



-- 
Joris Meys
Statistical consultant

Ghent University
Faculty of Bioscience Engineering
Department of Mathematical Modelling, Statistics and Bio-Informatics

tel : +32 9 264 59 87
joris.m...@ugent.be
---
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php

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


Re: [Rd] extending the colClasses argument in read.table

2011-11-21 Thread Gabor Grothendieck
2011/11/21 Romain François :
> Hello,
>
> We've released the int64 package to CRAN a few days ago. The package
> provides S4 classes "int64" and "uint64" that represent signed and unsigned
> 64 bit integer vectors.
>
> One further development of the package is to facilitate reading 64 bit
> integer data from csv, etc ... files.
>
> I have this function that wraps a call to read.csv to:
> - read the "int64" and "uint64" columns as "character"
> - converts them afterwards to the appropriate type
>

Try this:

> library(int64)
> Lines <- "A\n12\n"
>
> setAs("character", "int64", function(from) as.int64(from))
>
> DF <- read.csv(textConnection(Lines), colClasses = "int64")
>
> str(DF)
'data.frame':   1 obs. of  1 variable:
 $ A:Formal class 'int64' [package "int64"] with 2 slots
  .. ..@ .Data:List of 1
  .. .. ..$ : int  0 12
  .. ..@ NAMES: NULL

To convince ourselves that its translating from character to int64:

> setAs("character", "int64", function(from) {print(class(from)); 
> as.int64(from)})
> DF <- read.csv(textConnection(Lines), colClasses = "int64")
[1] "character"


-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com

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


Re: [Rd] testing on platforms, was Fortran error

2011-11-21 Thread Simon Urbanek
John,

On Nov 21, 2011, at 8:17 AM, John C Nash wrote:

> I think the poster is interested in being able to try the build/check on a 
> Mac in the
> fashion that Winbuilder does. That is, rather than have CRAN do all the 
> platform checks,
> is there a way to submit a package to be tested for just one platform?
> 
> It may be useful to have such a facility so package builders can test before 
> submission,
> and from my own experience I believe would help to render packages more 
> platform neutral.
> 

It has been discussed and there was a tentative plan (which involves getting a 
dedicated machine for this and R-forge builds), but nothing happened so far.


> I suspect that all the pieces are in place to do this, but perhaps a nice 
> front end is
> needed. Is that something for a Google Summer of Code task?
> 

Software infrastructure is not a problem. For example I have full 
multi-platform submission system in place for my RForge.net (since I'm building 
Linux, OS X and Windows).

Personally, my view is that developers should be using the existing 
package-based build systems (like R-forge or RForge.net). I am paranoid and 
thus reluctant to perform builds on my own systems for packages that have no 
source provenance (i.e. if I don't have an accountable registered user) - for 
security reasons.

Cheers,
Simon



> Best,
> 
> JN
> 
> On 11/21/2011 06:00 AM, r-devel-requ...@r-project.org wrote:
>> What does 'submit a test mean'?  Any test you write can check the 
>> value of Sys.info()["sysname"]: it is "Darwin" on Mac OS X.
>> Or R.version$platform, which will be something like 
>> i386-apple-darwin9.8.0.
> 
> __
> 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] Fortran runtime error with package cts on CRAN/Mac

2011-11-21 Thread Zhu Wang
Thanks Prof Ripley.  Here is what I meant for "submit a test". I can build and 
check R source packages for Windows at http://win-builder.r-project.org/, but I 
am not aware of a link for Mac. I thought this can be useful for those without 
access to Mac machines. 
 
Regards,
 
Zhu Wang

>>> Prof Brian Ripley  11/21/2011 2:49 AM >>>
Well, as Writing R Extensions says, packages should do no Fortran I/O 
at all.  So please pass the binary value to your code from R.

You cannot expect to write out extreme values without some 
representation error, and adjacent values cannot be read in again.

In any case, these values are essentially the same for all R 
platforms, being mandated by IEC60559.

On Sun, 20 Nov 2011, Zhu Wang wrote:

> Hello,
>
> As the author of package cts, I hope somebody on this list can kindly help 
> (perhaps off-list)
> to resolve the build/check issue with package cts for Mac. The error occurred 
> on Mac machines only:
> http://cran.r-project.org/web/checks/check_results_cts.html.
>
> Here is the error message:
>
> At line 10 of file machine.f
> Fortran runtime error: Range error during floating point read
>
> The source file machine.f is to read machine dependent parameters stored in 
> machine.txt, which was saved from R function .Machine. For convenience, the 
> source file machine.f is listed below, along with machine.txt from a non Mac 
> system (the last line NA was added for a test version of cts).
>
> CCC READ MACHINE INFORMATION SAVED WITH R CODE
>  SUBROUTINE MACHINE(EPS, BASE, T, EMIN, RMIN)
>  DOUBLE PRECISION EPS, RMIN
>  INTEGER BASE, T, EMIN
>  OPEN(UNIT=3,FILE='machine.txt',STATUS='OLD')
>  READ(3,*)EPS
>  READ(3,*)BASE
>  READ(3,*)T
>  READ(3,*)EMIN
>  READ(3,*)RMIN
>  CLOSE(UNIT=3)
>  RETURN
>  END
>
> machine.txt:
>
> 1.11022302462516e-16
> 2
> 53
> -1022
> 2.2250738585072e-308
> NA
>
> Another question is whether there is a way to submit a test to just 
> one platform. I know this can be done for Windows, but I'm not sure 
> for Mac.

What does 'submit a test mean'?  Any test you write can check the 
value of Sys.info()["sysname"]: it is "Darwin" on Mac OS X.
Or R.version$platform, which will be something like 
i386-apple-darwin9.8.0.

>
> Thanks in advance.
>
> Zhu Wang
>
> Department of Research
> Connecticut Children's Medical Center
> Hartford, CT 06106
>
>
>

-- 
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


Re: [Rd] extending the colClasses argument in read.table

2011-11-21 Thread romain
Thanks gabor, 

I will implement this and publish an updated package later. 

Cheers, 

Romain



Le 21 nov. 2011 à 16:31, Gabor Grothendieck  a écrit :

> 2011/11/21 Romain François :
>> Hello,
>> 
>> We've released the int64 package to CRAN a few days ago. The package
>> provides S4 classes "int64" and "uint64" that represent signed and unsigned
>> 64 bit integer vectors.
>> 
>> One further development of the package is to facilitate reading 64 bit
>> integer data from csv, etc ... files.
>> 
>> I have this function that wraps a call to read.csv to:
>> - read the "int64" and "uint64" columns as "character"
>> - converts them afterwards to the appropriate type
>> 
> 
> Try this:
> 
>> library(int64)
>> Lines <- "A\n12\n"
>> 
>> setAs("character", "int64", function(from) as.int64(from))
>> 
>> DF <- read.csv(textConnection(Lines), colClasses = "int64")
>> 
>> str(DF)
> 'data.frame':   1 obs. of  1 variable:
> $ A:Formal class 'int64' [package "int64"] with 2 slots
>  .. ..@ .Data:List of 1
>  .. .. ..$ : int  0 12
>  .. ..@ NAMES: NULL
> 
> To convince ourselves that its translating from character to int64:
> 
>> setAs("character", "int64", function(from) {print(class(from)); 
>> as.int64(from)})
>> DF <- read.csv(textConnection(Lines), colClasses = "int64")
> [1] "character"
> 
> 
> -- 
> Statistics & Software Consulting
> GKX Group, GKX Associates Inc.
> tel: 1-877-GKX-GROUP
> email: ggrothendieck at gmail.com

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


Re: [Rd] Suggested improvement for src/library/base/man/qraux.Rd

2011-11-21 Thread Tim Hesterberg
Here is a modified version of qraux.Rd, an edited version of
R-2.14.0/src/library/base/man/qraux.Rd

This gives some details and an example for the case of pivoting.
In this case, it is not true that X = QR; rather X[, pivot] = QR.
It may save some other people bugs and time to have this information.

Tim Hesterberg

--
% File src/library/base/man/qraux.Rd
% Part of the R package, http://www.R-project.org
% Copyright 1995-2007 R Core Development Team
% Distributed under GPL 2 or later

\name{QR.Auxiliaries}
\title{Reconstruct the Q, R, or X Matrices from a QR Object}
\usage{
qr.X(qr, complete = FALSE, ncol =)
qr.Q(qr, complete = FALSE, Dvec =)
qr.R(qr, complete = FALSE)
}
\alias{qr.X}
\alias{qr.Q}
\alias{qr.R}
\arguments{
 \item{qr}{object representing a QR decomposition.  This will
   typically have come from a previous call to \code{\link{qr}} or
   \code{\link{lsfit}}.}
 \item{complete}{logical expression of length 1.  Indicates whether an
   arbitrary  orthogonal completion of the \eqn{\bold{Q}} or
   \eqn{\bold{X}} matrices is to be made, or whether the \eqn{\bold{R}}
   matrix is to be completed  by binding zero-value rows beneath the
   square upper triangle.}
 \item{ncol}{integer in the range \code{1:nrow(qr$qr)}.  The number
   of columns to be in the reconstructed \eqn{\bold{X}}.  The default
   when \code{complete} is \code{FALSE} is the first
   \code{min(ncol(X), nrow(X))} columns of the original \eqn{\bold{X}}
   from which the qr object was constructed.  The default when
   \code{complete} is \code{TRUE} is a square matrix with the original
   \eqn{\bold{X}} in the first \code{ncol(X)} columns and an arbitrary
   orthogonal completion (unitary completion in the complex case) in
   the remaining columns.}
 \item{Dvec}{vector (not matrix) of diagonal values.  Each column of
   the returned \eqn{\bold{Q}} will be multiplied by the corresponding
   diagonal value.  Defaults to all \code{1}s.}
}
\description{
 Returns the original matrix from which the object was constructed or
 the components of the decomposition.
}
\value{
 \code{qr.X} returns \eqn{\bold{X}}, the original matrix from
 which the qr object was constructed, provided \code{ncol(X) <= nrow(X)}.
 If \code{complete} is \code{TRUE} or the argument \code{ncol} is greater
than
 \code{ncol(X)}, additional columns from an arbitrary orthogonal
 (unitary) completion of \code{X} are returned.

 \code{qr.Q} returns part or all of \bold{Q}, the order-nrow(X)
 orthogonal (unitary) transformation represented by \code{qr}.  If
 \code{complete} is \code{TRUE}, \bold{Q} has \code{nrow(X)} columns.
 If \code{complete} is \code{FALSE}, \bold{Q} has \code{ncol(X)}
 columns.  When \code{Dvec} is specified, each column of \bold{Q} is
 multiplied by the corresponding value in \code{Dvec}.

 \code{qr.R} returns \bold{R}.  This may be pivoted, e.g. if
 \code{a <- qr(x)} then \code{x[, a$pivot]} = \bold{QR}.
 The number of rows of \bold{R} is
 either \code{nrow(X)} or \code{ncol(X)} (and may depend on whether
 \code{complete} is \code{TRUE} or \code{FALSE}.
}
\seealso{
 \code{\link{qr}},
 \code{\link{qr.qy}}.
}
\examples{
p <- ncol(x <- LifeCycleSavings[,-1]) # not the 'sr'
qrstr <- qr(x)   # dim(x) == c(n,p)
qrstr $ rank # = 4 = p
Q <- qr.Q(qrstr) # dim(Q) == dim(x)
R <- qr.R(qrstr) # dim(R) == ncol(x)
X <- qr.X(qrstr) # X == x
range(X - as.matrix(x))# ~ < 6e-12
## X == Q \%*\% R if there has been no pivoting, as here.
Q \%*\% R

# example of pivoting
x <- cbind(int=1,
  b1=rep(1:0, each=3), b2=rep(0:1, each=3),
  c1=rep(c(1,0,0), 2), c2=rep(c(0,1,0), 2), c3=rep(c(0,0,1),2))
# singular, columns "b2" and "c3" are "extra"
a <- qr(x)
qr.R(a) # columns are int b1 c1 c2 b2 c3
a$pivot
all.equal(x, qr.Q(a) \%*\% qr.R(a))# no
all.equal(x[, a$pivot], qr.Q(a) \%*\% qr.R(a)) # yes
}
\keyword{algebra}
\keyword{array}

[[alternative HTML version deleted]]

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


[Rd] links to package vignettes on CRAN after R 2.14.0

2011-11-21 Thread Yihui Xie
Hi,

I noticed the links to my package vignettes on CRAN were gone after I
started using ./vignettes instead of ./inst/doc, as suggested by the
R-exts manual in R 2.14.0. For example,

http://cran.r-project.org/web/packages/formatR/index.html
http://cran.r-project.org/web/packages/Rd2roxygen/index.html

I have put %\VignetteIndexEntry in the Rnw file, but I do not
understand why CRAN does not create the link in the package webpage
any more. In the past, my vignettes were under ./inst/doc, and the
links appeared as expected.

Thanks!

Regards,
Yihui
--
Yihui Xie 
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA

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


Re: [Rd] a^b when a is large and b < 1 (64bit R on windows 7)

2011-11-21 Thread Bryan W. Lewis
Although it does not solve the issue, the INF result is due to the
MinGW gcc math library on 64-bit Windows that R links to. One can
easily see this by compiling just machar.c and checking pow and sqrt
on xmax.

Note that on any platform the results are likely to be quite different
between pow and sqrt for edge case numerical examples.

For example, on a 32-bit Ubuntu box with R-2.14.0, I get:
x = .Machine$double.xmax
y = sqrt(x)
z = x^0.5
y-z
[1] 1.488566e+138


There is also a long discussion about this here:

http://sourceforge.net/mailarchive/forum.php?forum_name=mingw-users&max_rows=25&style=nested&viewmonth=201104


--Bryan


On Mon, Nov 21, 2011 at 10:03 AM, Joris Meys  wrote:
> Should have specified I only checked on Windows. So: On Windows 7
> 64bit, the R-32bit works fine, the R-64bit gives the behaviour Martyn
> reported.
>
> Cheers
> Joris
>
> On Mon, Nov 21, 2011 at 3:58 PM, Brian G. Peterson  
> wrote:
>> On Mon, 2011-11-21 at 14:41 +, Martyn Byng wrote:
>>> I'm getting some strange behaviour when trying to use the power
>>> operator
>>> (a^b) when a is large and b is less than one:
>>>
>>> big <- .Machine$double.xmax
>>> big
>>> big^0.5
>>> sqrt(big)
>>>
>>> > big <- 1.797693134862315708384e+308
>>> > big^0.5
>>> [1] Inf
>>> > sqrt(big)
>>> [1] 1.340781e+154
>>>
>>>
>>> I'm guessing that this behaviour is not expected, or am I missing
>>> something about ^?
>>
>> On a recent Ubuntu 64bit install with R2.14.0 from the repositories, I
>> get:
>>
>>> big <- .Machine$double.xmax
>>> big
>> [1] 1.797693e+308
>>> big^0.5
>> [1] 1.340781e+154
>>> sqrt(big)
>> [1] 1.340781e+154
>>
>> so it does seem to be specific either to your environment.
>>
>> --
>> Brian G. Peterson
>> http://braverock.com/brian/
>> Ph: 773-459-4973
>> IM: bgpbraverock
>>
>> __
>> R-devel@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
>
>
>
> --
> Joris Meys
> Statistical consultant
>
> Ghent University
> Faculty of Bioscience Engineering
> Department of Mathematical Modelling, Statistics and Bio-Informatics
>
> tel : +32 9 264 59 87
> joris.m...@ugent.be
> ---
> Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php
>
> __
> 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] links to package vignettes on CRAN after R 2.14.0

2011-11-21 Thread Kurt Hornik
> Yihui Xie writes:

> Hi,
> I noticed the links to my package vignettes on CRAN were gone after I
> started using ./vignettes instead of ./inst/doc, as suggested by the
> R-exts manual in R 2.14.0. For example,

> http://cran.r-project.org/web/packages/formatR/index.html
> http://cran.r-project.org/web/packages/Rd2roxygen/index.html

> I have put %\VignetteIndexEntry in the Rnw file, but I do not
> understand why CRAN does not create the link in the package webpage
> any more. In the past, my vignettes were under ./inst/doc, and the
> links appeared as expected.

Should be fixed now.

-k

> Thanks!

> Regards,
> Yihui
> --
> Yihui Xie 
> Phone: 515-294-2465 Web: http://yihui.name
> Department of Statistics, Iowa State University
> 2215 Snedecor Hall, Ames, IA

> __
> 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