[R] help with legacy R code
Prof Brian Ripley
ripley at stats.ox.ac.uk
Thu Nov 10 13:17:14 CET 2005
1) There is no 'R 2.0'. What version did you mean?
2) We cannot reproduce your script (no data files), and JPEGs are not
allowed on R-help: see http://www.r-project.org/mail.html. (PNGs are,
though).
3) You have given us no indication of what the problems are nor in which
lines.
Please give us more usable information.
On Wed, 9 Nov 2005, David Zhao wrote:
> Could somebody help me disect this legacy R script I inherited at work, I
> have two questions:
> 1. I've tried to upgrade our R version from 1.6.2 (yeah, I know), to R 2.0,
> but some of the lines in this script are not compatible with R 2.0, could
> someone help me figure out where the problem is?
> 2. the jpeg generated (attached) seems to be off on some of the data, is
> there a better way of doing this.
> library(MASS)
> jpeg(filename = "diswrong.jpg", width = 800, height = 600, pointsize = 12,
> quality = 75, bg = "white")
>
> myfunc <- function(x, mean, sd, nfalse, ntotal, shape, rate) {
> (nfalse*dgamma(x,shape,rate)+(ntotal-nfalse)*dnorm(x,mean,sd))/ntotal
> }
>
> wrong <- scan("wrongrawdata.txt", list(x=0))
...
--
Brian D. Ripley, ripley at 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, UK Fax: +44 1865 272595
More information about the R-help
mailing list