[R] R demos
Jim Brennan
jfbrennan at rogers.com
Fri Jun 24 18:47:46 CEST 2005
OK, actually this is a textbook example of why it should be done as you said
as I just add on the packages I want in Rprofile.site and that way don't
screw up the default by cutting and pasting into Rprofile.
So I have restored Rprofile to default and added Rprofile.site as follows to
etc directory.
local({
old <- getOption("defaultPackages")
options(defaultPackages = c(old, "MASS","gtools","gregmisc"))
})
I think this is what you meant!
As for running R --vanilla I don't know how to do that.
Is it possible with a windows version.?
Anyway it is working and thanks for the help.
-----Original Message-----
From: Prof Brian Ripley [mailto:ripley at stats.ox.ac.uk]
Sent: June 24, 2005 12:22 PM
To: Jim Brennan
Cc: 'Douglas Bates'; 'r-help'
Subject: Re: [R] R demos
On Fri, 24 Jun 2005, Jim Brennan wrote:
> Thanks!
> I realized the datasets were not available, but not that they were in a
> separate package. I have never had to load this package in previous
versions
> and assumed they were part of one of the default main packages.
They are! datasets *is* `one of the default main packages'.
> An easy fix was to adjust my default packages in the Rprofile file to
> include "datasets"
> This is for those who don't know a file in the etc directory.
Not really: you should be using Rprofile.site: see ?Startup.
> options(defaultPackages=c("utils" ,"datasets", "graphics" ,"stats",
> "methods", "MASS", "gtools"))
>
> Not sure how this happened as I never had to do this before.
The default is actually
c("datasets", "utils", "grDevices", "graphics", "stats", "methods")
so you have changed it. What happens if you start R --vanilla? That might
help track down what you did.
>
> -----Original Message-----
> From: Douglas Bates [mailto:dmbates at gmail.com]
> Sent: June 24, 2005 11:25 AM
> To: Jim Brennan
> Cc: r-help
> Subject: Re: [R] R demos
>
> On 6/24/05, Jim Brennan <jfbrennan at rogers.com> wrote:
>> I have noticed that some data sets seem not to be available to me when I
> am
>> running some of the examples or demos since I have changed versions. For
>> example:
>> demo(persp)
>>
>>
>> demo(persp)
>> ---- ~~~~~
>>
>> Type <Return> to start :
>>
>> R>if (dev.cur() <= 1) get(getOption("device"))()
>>
>> R>is.dev.interactive <- .Device %in% c("X11", "GTK",
>> "gnome", "quartz", "windows", "JavaGD")
>>
>> R>op <- par(ask = is.dev.interactive)
>>
>> R>x <- seq(-10, 10, length = 50)
>>
>> R>y <- x
>>
>> R>rotsinc <- function(x, y) {
>> sinc <- function(x) {
>> y <- sin(x)/x
>> y[is.na(y)] <- 1
>> y
>> }
>> 10 * sinc(sqrt(x^2 + y^2))
>> }
>>
>> R>sinc.exp <- expression(z == Sinc(sqrt(x^2 + y^2)))
>>
>> R>z <- outer(x, y, rotsinc)
>>
>> R>par(bg = "white")
>>
>> R>persp(x, y, z, theta = 30, phi = 30, expand = 0.5,
>> col = "lightblue")
>> Waiting to confirm page change...
>>
>> R>title(sub = ".")
>>
>> R>title(main = sinc.exp)
>>
>> R>persp(x, y, z, theta = 30, phi = 30, expand = 0.5,
>> col = "lightblue", ltheta = 120, shade = 0.75, ticktype = "detailed",
>> xlab = "X", ylab = "Y", zlab = "Z")
>> Waiting to confirm page change...
>>
>> R>title(sub = ".")
>>
>> R>title(main = sinc.exp)
>>
>> R>z <- 2 * volcano
>> Error in eval.with.vis(expr, envir, enclos) :
>> Object "volcano" not found
>>
>> So most of this demo works but volcano is not found.
>> Any ideas what may be going wrong.
>> Also for example
>> R>?reshape
>> R>summary(Indometh)
>> Error in summary(Indometh) : Object "Indometh" not found
>
> For some reason you do not have the datasets package attached.
>
>> find(Indometh)
> [1] "package:datasets"
>> find(volcano)
> [1] "package:datasets"
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
>
--
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