FAQ
I suggest adding a 'pivot' argument to qr.R, to obtain columns in the
same order as the original x, so that
a <- qr(x)
qr.Q(a) %*% qr.R(a, pivot=TRUE)
returns x.

--------------------------------------------------
# File src/library/base/R/qr.R

qr.R <- function(qr, complete = FALSE, pivot = FALSE)
{
# Args:
# qr: a QR decomposition, produced by qr()
# complete: logical, if TRUE then return all columns
# pivot: logical, if TRUE then columns of the result are permuted to
# be in the same order as the original x.
if (!is.qr(qr))
stop("argument is not a QR decomposition")
R <- qr$qr
if (!complete)
R <- R[seq.int(min(dim(R))), , drop = FALSE]
R[row(R) > col(R)] <- 0
if(pivot)
R <- R[, order(qr$pivot)]
R
}


--------------------------------------------------
% File src/library/base/man/qraux.Rd

qr.R(qr, complete = FALSE, pivot = FALSE)

\item{pivot}{logical expression of length 1. If \code{TRUE},
then columns of the result are permuted to be in the same order
as the original \code{x}.}

zapsmall(qr.R(a)) # columns are int b1 c1 c2 b2 c3
zapsmall(qr.R(a, pivot = TRUE)) # columns are int b1 b2 c1 c2 c3

Search Discussions

  • Peter dalgaard at Sep 7, 2012 at 6:42 pm

    On Sep 7, 2012, at 17:16 , Tim Hesterberg wrote:

    I suggest adding a 'pivot' argument to qr.R, to obtain columns in the
    same order as the original x, so that
    a <- qr(x)
    qr.Q(a) %*% qr.R(a, pivot=TRUE)
    returns x.
    That would come spiraling down in flames the first time someone tried to use backsolve on it, wouldn't it? I mean, a major point of QR is that R is triangular; doesn't make much sense to permute the columns without retaining the pivoting permutation.

    --
    Peter Dalgaard, Professor,
    Center for Statistics, Copenhagen Business School
    Solbjerg Plads 3, 2000 Frederiksberg, Denmark
    Phone: (+45)38153501
    Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com
  • Warnes, Gregory at Sep 11, 2012 at 2:02 pm
    On 9/7/12 2:42 PM, "peter dalgaard" wrote:
    On Sep 7, 2012, at 17:16 , Tim Hesterberg wrote:

    I suggest adding a 'pivot' argument to qr.R, to obtain columns in the
    same order as the original x, so that
    a <- qr(x)
    qr.Q(a) %*% qr.R(a, pivot=TRUE)
    returns x.
    That would come spiraling down in flames the first time someone tried to
    use backsolve on it, wouldn't it? I mean, a major point of QR is that R
    is triangular; doesn't make much sense to permute the columns without
    retaining the pivoting permutation.
    As I understand Tim's proposal, the pivot argument defaults to FALSE, so
    the new behavior would only be activated at the user's request.

    -Greg

    --
    Gregory Warnes, Ph.D.
    Sr. Expert Modeler
    Modeling and Simulation
    CA Phone: +1 617 871-8498
    gregory.warnes at novartis.com
  • Peter dalgaard at Sep 11, 2012 at 4:03 pm
    On Sep 11, 2012, at 16:02 , Warnes, Gregory wrote:
    On 9/7/12 2:42 PM, "peter dalgaard" wrote:

    On Sep 7, 2012, at 17:16 , Tim Hesterberg wrote:

    I suggest adding a 'pivot' argument to qr.R, to obtain columns in the
    same order as the original x, so that
    a <- qr(x)
    qr.Q(a) %*% qr.R(a, pivot=TRUE)
    returns x.
    That would come spiraling down in flames the first time someone tried to
    use backsolve on it, wouldn't it? I mean, a major point of QR is that R
    is triangular; doesn't make much sense to permute the columns without
    retaining the pivoting permutation.
    As I understand Tim's proposal, the pivot argument defaults to FALSE, so
    the new behavior would only be activated at the user's request.
    Sure. I'm just saying that I see little use for the un-pivoted qr.R because, generically, the first thing you want to do with qr.R is to invert it, which is easier when it is triangular.

    --
    Peter Dalgaard, Professor
    Center for Statistics, Copenhagen Business School
    Solbjerg Plads 3, 2000 Frederiksberg, Denmark
    Phone: (+45)38153501
    Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com
  • Tim Hesterberg at Sep 12, 2012 at 5:23 am

    On Sep 11, 2012, at 16:02 , Warnes, Gregory wrote:
    On 9/7/12 2:42 PM, "peter dalgaard" wrote:

    On Sep 7, 2012, at 17:16 , Tim Hesterberg wrote:

    I suggest adding a 'pivot' argument to qr.R, to obtain columns in the
    same order as the original x, so that
    a <- qr(x)
    qr.Q(a) %*% qr.R(a, pivot=TRUE)
    returns x.
    That would come spiraling down in flames the first time someone tried to
    use backsolve on it, wouldn't it? I mean, a major point of QR is that R
    is triangular; doesn't make much sense to permute the columns without
    retaining the pivoting permutation.
    As I understand Tim's proposal, the pivot argument defaults to FALSE, so
    the new behavior would only be activated at the user's request.
    Sure. I'm just saying that I see little use for the un-pivoted qr.R because, generically, the first thing you want to do with qr.R is to invert it, which is easier when it is triangular.
    Greg Warnes is correct, I propose keeping the default FALSE, for backward
    compatibility.

    My use for the pivoted R is in computing a covariance matrix, using
    R <- qr.R(QR, pivot = TRUE)
    Rinv <- ginverse(R)
    covTerm <- Rinv %*% t(Rinv)

    But I see that lm() and glm() use chol2inv, that may be preferable.
  • S Ellison at Oct 1, 2012 at 11:38 am
    I have a package on CRAN and now have a modest update that's passing build checks on R-forge.


    Is there a mechanism on R-forge for updating an existing CRAN package, analogous to the 'submit to cran' link on the R-forge package page, or should I just follow the instructions at http://cran.r-project.org/web/packages/policies.html for FTP upload?


    S Ellison




    *******************************************************************
    This email and any attachments are confidential. Any use...{{dropped:8}}
  • Duncan Murdoch at Oct 1, 2012 at 11:47 am

    On 12-10-01 7:38 AM, S Ellison wrote:
    I have a package on CRAN and now have a modest update that's passing build checks on R-forge.

    Is there a mechanism on R-forge for updating an existing CRAN package, analogous to the 'submit to cran' link on the R-forge package page, or should I just follow the instructions at http://cran.r-project.org/web/packages/policies.html for FTP upload?

    If there were a "Submit to CRAN" button, that would be the method. But
    I think that button has gone away, so the description on that page is
    the way to go.


    Duncan Murdoch
  • Spencer Graves at Oct 1, 2012 at 3:09 pm

    On 10/1/2012 4:47 AM, Duncan Murdoch wrote:
    On 12-10-01 7:38 AM, S Ellison wrote:
    I have a package on CRAN and now have a modest update that's passing
    build checks on R-forge.

    Is there a mechanism on R-forge for updating an existing CRAN
    package, analogous to the 'submit to cran' link on the R-forge
    package page, or should I just follow the instructions at
    http://cran.r-project.org/web/packages/policies.html for FTP upload?
    If there were a "Submit to CRAN" button, that would be the method.
    But I think that button has gone away, so the description on that page
    is the way to go.



    The "Submit to CRAN" button on that page is hidden by default but
    is exposed by clicking on the "Show/Hide extra info" button right below
    where it gives "Build Status" and "R install command". (I had trouble
    finding the "Submit to CRAN" button for a while after it became hidden.
    You need "Build status: Current". Also, at least the for last
    submissions I made, the CRAN maintainers did NOT accept updates if there
    were Warnings or Notes in the "Package Checks"; these warnings are also
    hidden until you click "Show/Hide extra info".)




    Spencer
    Duncan Murdoch

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



    --
    Spencer Graves, PE, PhD
    President and Chief Technology Officer
    Structure Inspection and Monitoring, Inc.
    751 Emerson Ct.
    San Jos?, CA 95126
    ph: 408-655-4567
    web: www.structuremonitoring.com
  • Paul Gilbert at Oct 1, 2012 at 4:30 pm
    Yes, the button is still there if you are logged in and unhide it. (You
    probably also need the appropriate developer permission.) Beware that
    R-forge needs to indicate the package build status is current, but also,
    if you have just made svn updates it may falsely indicate current. Check
    the revision number is accurate, or wait a couple of days, or submit "by
    hand".


    If you do submit by ftp to incoming, beware that the CRAN policy now
    requires that your email state that you have read and agree with the
    CRAN policies. (Probably everyone else noticed that, but there is no
    need for others to generate extra work for CRAN maintainers, like I have
    just done.)


    Paul

    On 12-10-01 11:09 AM, Spencer Graves wrote:
    On 10/1/2012 4:47 AM, Duncan Murdoch wrote:
    On 12-10-01 7:38 AM, S Ellison wrote:
    I have a package on CRAN and now have a modest update that's passing
    build checks on R-forge.

    Is there a mechanism on R-forge for updating an existing CRAN
    package, analogous to the 'submit to cran' link on the R-forge
    package page, or should I just follow the instructions at
    http://cran.r-project.org/web/packages/policies.html for FTP upload?
    If there were a "Submit to CRAN" button, that would be the method. But
    I think that button has gone away, so the description on that page is
    the way to go.

    The "Submit to CRAN" button on that page is hidden by default but
    is exposed by clicking on the "Show/Hide extra info" button right below
    where it gives "Build Status" and "R install command". (I had trouble
    finding the "Submit to CRAN" button for a while after it became hidden.
    You need "Build status: Current". Also, at least the for last
    submissions I made, the CRAN maintainers did NOT accept updates if there
    were Warnings or Notes in the "Package Checks"; these warnings are also
    hidden until you click "Show/Hide extra info".)


    Spencer
    Duncan Murdoch

    ______________________________________________
    R-devel at r-project.org mailing list
    https://stat.ethz.ch/mailman/listinfo/r-devel
  • Spencer Graves at Oct 1, 2012 at 5:27 pm

    On 10/1/2012 9:30 AM, Paul Gilbert wrote:
    Yes, the button is still there if you are logged in and unhide it.
    (You probably also need the appropriate developer permission.) Beware
    that R-forge needs to indicate the package build status is current,
    but also, if you have just made svn updates it may falsely indicate
    current. Check the revision number is accurate, or wait a couple of
    days, or submit "by hand".

    If you do submit by ftp to incoming, beware that the CRAN policy now
    requires that your email state that you have read and agree with the
    CRAN policies. (Probably everyone else noticed that, but there is no
    need for others to generate extra work for CRAN maintainers, like I
    have just done.)



    ... and like I did also.




    I still think it would be good to look for grant money or to
    encourage donations by at least offering to provide an invoice to those
    (like Jim Ramsay) who have grant money and can pay an invoice but can't
    make contributions! If done in the right way, more money could make
    life easier for the current CRAN maintainers, thereby giving them more
    time to develop new statistical algorithms, because they would no longer
    need as much time to maintain a database that is growing not quite
    exponentially.




    Spencer

    Paul
    On 12-10-01 11:09 AM, Spencer Graves wrote:
    On 10/1/2012 4:47 AM, Duncan Murdoch wrote:
    On 12-10-01 7:38 AM, S Ellison wrote:
    I have a package on CRAN and now have a modest update that's passing
    build checks on R-forge.

    Is there a mechanism on R-forge for updating an existing CRAN
    package, analogous to the 'submit to cran' link on the R-forge
    package page, or should I just follow the instructions at
    http://cran.r-project.org/web/packages/policies.html for FTP upload?
    If there were a "Submit to CRAN" button, that would be the method. But
    I think that button has gone away, so the description on that page is
    the way to go.

    The "Submit to CRAN" button on that page is hidden by default but
    is exposed by clicking on the "Show/Hide extra info" button right below
    where it gives "Build Status" and "R install command". (I had trouble
    finding the "Submit to CRAN" button for a while after it became hidden.
    You need "Build status: Current". Also, at least the for last
    submissions I made, the CRAN maintainers did NOT accept updates if there
    were Warnings or Notes in the "Package Checks"; these warnings are also
    hidden until you click "Show/Hide extra info".)


    Spencer
    Duncan Murdoch

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

    --
    Spencer Graves, PE, PhD
    President and Chief Technology Officer
    Structure Inspection and Monitoring, Inc.
    751 Emerson Ct.
    San Jos?, CA 95126
    ph: 408-655-4567
    web: www.structuremonitoring.com
  • Dirk Eddelbuettel at Oct 1, 2012 at 11:55 am

    On 1 October 2012 at 12:38, S Ellison wrote:
    I have a package on CRAN and now have a modest update that's passing build checks on R-forge.

    Is there a mechanism on R-forge for updating an existing CRAN package, analogous to the 'submit to cran' link on the R-forge package page, or should I just follow the instructions at http://cran.r-project.org/web/packages/policies.html for FTP upload?

    I prefer to do this 'by hand' but my understanding is that 'submit to cran'
    is equivalent to 'push this current version to CRAN' --- and not to 'make one
    initial upload' as you seem to read it. So I say go for it.


    Quite a few people seem to push from R-Forge if I read another field in
    the DESCRIPTION file (once on CRAN) correctly.


    Dirk


    --
    Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
  • S Ellison at Oct 3, 2012 at 4:20 pm

    Is there a mechanism on R-forge for updating an existing
    CRAN package, analogous to the 'submit to cran' link on the
    R-forge package page, ....
    I prefer to do this 'by hand' but my understanding is that 'submit to cran'
    is equivalent to 'push this current version to CRAN' --- and
    not to 'make one initial upload' as you seem to read it. So
    I say go for it.

    I had; it was when it failed that I posted the question.


    However, you've encouraged me to try again and that helped; the second attempt indicates that I had misunderstood the error message. It wasnt indicating a clash with an existing package name but a clash with an existing version number. Probable explanation: I have failed to update my DESCRIPTION file.


    Apologies for wasting folks' time. Again.


    S Ellison




    *******************************************************************
    This email and any attachments are confidential. Any use...{{dropped:8}}

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupr-devel @
categoriesr
postedSep 7, '12 at 3:16p
activeOct 3, '12 at 4:20p
posts12
users8
websiter-project.org
irc#r

People

Translate

site design / logo © 2022 Grokbase