Bug 15330 - Wishlist - Add termplot option to plot vs transformed x (code supplied)
Summary: Wishlist - Add termplot option to plot vs transformed x (code supplied)
Status: CLOSED DUPLICATE of bug 15329
Alias: None
Product: R
Classification: Unclassified
Component: I/O (show other bugs)
Version: R 3.0.0
Hardware: All All
: P5 enhancement
Assignee: R-core
URL:
Depends on:
Blocks:
 
Reported: 2013-06-01 09:46 UTC by John Maindonald
Modified: 2013-06-01 12:58 UTC (History)
1 user (show)

See Also:


Attachments
Code, incorporating patches (7.84 KB, application/octet-stream)
2013-06-01 09:46 UTC, John Maindonald
Details
Proposed patch (1.70 KB, patch)
2013-06-01 09:49 UTC, John Maindonald
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John Maindonald 2013-06-01 09:46:47 UTC
Created attachment 1450 [details]
Code, incorporating patches

In a command such as the following
  library(DAAG)
  nihills.lm2 <- lm(log(time) ~ log(dist) + poly(climb,2), data=nihills)
it is often preferable to show log(dist) or poly(time, 2) on the x-axis,
rather than, respectively, dist or time.  Deviations from the fitted curve 
are best judged when the curve is transformed to appear as a line.

The changes required for this are small:

1) Add an argument linearize (or ?), by default FALSE

2) Add, near the beginning, the line:

  if(length(linearize)==1)linearize <- rep(linearize, n.tms)

3) In two places, replace 
                xx <- carrier(cn[[i]])
by
                if(!linearize[i])xx <- carrier(cn[[i]]) else {
                    if(length(cn[[i]])==1)
                        xx <- eval(cn[[i]], data, enclos=pf) else
                    xx <- tms[,i]
                    xlabs[i] <- deparse(cn[[i]])
                }

I attach (i) a patch file
            (ii) code that incorporates the changes
Comment 1 John Maindonald 2013-06-01 09:49:07 UTC
Created attachment 1451 [details]
Proposed patch
Comment 2 Duncan Murdoch 2013-06-01 12:58:19 UTC

*** This bug has been marked as a duplicate of bug 15329 ***