Hi All, I am currently preparing some form of slideshow introducing R and its capabilities for some colleagues. The thing will be about 30 mins, and I'd like to have some "pretty pictures" and some "amazing facts" (I'm trying to sell, obviously :)). Can I ask if it's possible to easily retrieve a gross figure of the number of functions in R considering the "base" install and all the libraries available? Apart from graphics and lattice, are there any more packages producing eye catching graphics (possibly with a survival analysis/epidemiological bend)? Cheers, Federico Calboli -- Federico C. F. Calboli Department of Epidemiology and Public Health Imperial College, St Mary's Campus Norfolk Place, London W2 1PG Tel +44 (0)20 7594 1602 Fax (+44) 020 7594 3193 f.calboli [.a.t] imperial.ac.uk f.calboli [.a.t] gmail.com
On 6/24/2005 10:38 AM, Federico Calboli wrote:> Hi All, > > I am currently preparing some form of slideshow introducing R and its > capabilities for some colleagues. The thing will be about 30 mins, and > I'd like to have some "pretty pictures" and some "amazing facts" (I'm > trying to sell, obviously :)). > > Can I ask if it's possible to easily retrieve a gross figure of the > number of functions in R considering the "base" install and all the > libraries available?I think it depends on what you mean by "all the libraries". If you mean all the contributed packages on CRAN, then one way to get something along those lines is to look at the index.txt file in R_HOME/doc/html/search. It lists one entry per help topic in whatever packages you have installed. Help topics often document more than one function, and sometimes document data or other non-functions, so this isn't exactly what you were asking for. If you really want the number of functions, you could do the following. > sapply(library()$results[,1], library, character.only=TRUE) This attaches all installed packages. > apropos('.*', mode='function') This gives the list of all functions on the search list. I get 3011 in R-patched with the base and recommended packages. I can't do it in a copy that has most of CRAN and Bioconductor loaded, because after attaching about 190 packages, library() dies with an error "Maximal number of DLLs reached.." At that point it's finding around 9600 functions. (The number of topics in index.txt was 14768.) Duncan Murdoch
?demo may give you some ideas. -----Original Message----- From: r-help-bounces at stat.math.ethz.ch [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Federico Calboli Sent: June 24, 2005 10:39 AM To: r-help Subject: [R] R demos Hi All, I am currently preparing some form of slideshow introducing R and its capabilities for some colleagues. The thing will be about 30 mins, and I'd like to have some "pretty pictures" and some "amazing facts" (I'm trying to sell, obviously :)). Can I ask if it's possible to easily retrieve a gross figure of the number of functions in R considering the "base" install and all the libraries available? Apart from graphics and lattice, are there any more packages producing eye catching graphics (possibly with a survival analysis/epidemiological bend)? Cheers, Federico Calboli -- Federico C. F. Calboli Department of Epidemiology and Public Health Imperial College, St Mary's Campus Norfolk Place, London W2 1PG Tel +44 (0)20 7594 1602 Fax (+44) 020 7594 3193 f.calboli [.a.t] imperial.ac.uk f.calboli [.a.t] gmail.com ______________________________________________ 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
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 version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major 2 minor 1.0 year 2005 month 04 day 18 language R
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 foundFor some reason you do not have the datasets package attached.> find(Indometh)[1] "package:datasets"> find(volcano)[1] "package:datasets"
Federico Calboli wrote:> Hi All, > > I am currently preparing some form of slideshow introducing R and its > capabilities for some colleagues. The thing will be about 30 mins, and > I'd like to have some "pretty pictures" and some "amazing facts" (I'm > trying to sell, obviously :)). > > Can I ask if it's possible to easily retrieve a gross figure of the > number of functions in R considering the "base" install and all the > libraries available? > > Apart from graphics and lattice, are there any more packages producing > eye catching graphics (possibly with a survival analysis/epidemiological > bend)?For survival analysis/epi graphics examples you might look at http://biostat.mc.vanderbilt.edu/twiki/pub/Main/BioMod/notes.pdf, Chapters 10 and 19. Also see the Alzola-Harrell book's chapter on the Design package at http://biostat.mc.vanderbilt.edu/twiki/pub/Main/RS/sintro.pdf Frank> > Cheers, > > Federico Calboli >-- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University
On Fri, 24 Jun 2005, Jim Brennan wrote:> 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.?see the rw-FAQ.> 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 > >-- 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
> From: Jim Brennan > > 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.?Absolutely. If you use Rgui, right-click on the Rgui icon and click on "Properties". In the "target" field, add "--vanilla" (or any command line argument to R). If the command is quoted, make sure you add the option outside the quotes. Andy> 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 > > ______________________________________________ > 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 > > >
On 6/24/05, Federico Calboli <f.calboli at imperial.ac.uk> wrote:> Hi All, > > I am currently preparing some form of slideshow introducing R and its > capabilities for some colleagues. The thing will be about 30 mins, and > I'd like to have some "pretty pictures" and some "amazing facts" (I'm > trying to sell, obviously :)). > > Can I ask if it's possible to easily retrieve a gross figure of the > number of functions in R considering the "base" install and all the > libraries available? > > Apart from graphics and lattice, are there any more packages producing > eye catching graphics (possibly with a survival analysis/epidemiological > bend)? > > Cheers, > > Federico Calboli > > -- > Federico C. F. Calboli > Department of Epidemiology and Public Health > ImpeHere are a few sources: - links to R graphics demos: http://fawn.unibw-hamburg.de/cgi-bin/Rwiki.pl?GraphGallery - R command giving number of CRAN packages (excludes BioC & other repositories): nrow(CRAN.packages()) - graph of r-help activity: http://dir.gmane.org/gmane.comp.lang.r.general - data for another measure of this: https://stat.ethz.ch/pipermail/r-help/2004-April/048385.html
Federico Calboli wrote:>Hi All, > >I am currently preparing some form of slideshow introducing R and its >capabilities for some colleagues. The thing will be about 30 mins, and >I'd like to have some "pretty pictures" and some "amazing facts" (I'm >trying to sell, obviously :)). > >Can I ask if it's possible to easily retrieve a gross figure of the >number of functions in R considering the "base" install and all the >libraries available? > >Apart from graphics and lattice, are there any more packages producing >eye catching graphics (possibly with a survival analysis/epidemiological >bend)? > >Cheers, > >Federico Calboli > > >In the package relax you find the function slider(). The help page of slider shows a nice application: R.veil.in.the.wind() Here are the definitions of slider and R.veil.in.the.wind: # definition of slider slider<-function (sl.functions, sl.names, sl.mins, sl.maxs, sl.deltas, sl.defaults, but.functions, but.names, no, set.no.value, obj.name, obj.value, reset.function, title) { if (!missing(no)) return(as.numeric(tclvalue(get(paste("slider", no, sep = ""), env = slider.env)))) if (!missing(set.no.value)) { try(eval(parse(text = paste("tclvalue(slider", set.no.value[1], ")<-", set.no.value[2], sep = "")), env = slider.env)) return(set.no.value[2]) } if (!exists("slider.env")) slider.env <<- new.env() if (!missing(obj.name)) { if (!missing(obj.value)) assign(obj.name, obj.value, env = slider.env) else obj.value <- get(obj.name, env = slider.env) return(obj.value) } if (missing(title)) title <- "slider control widget" require(tcltk) nt <- tktoplevel() tkwm.title(nt, title) tkwm.geometry(nt, "+0+0") if (missing(sl.names)) sl.names <- NULL if (missing(sl.functions)) sl.functions <- function(...) { } for (i in seq(sl.names)) { eval(parse(text = paste("assign('slider", i, "',tclVar(sl.defaults[i]),env=slider.env)", sep = ""))) tkpack(fr <- tkframe(nt)) lab <- tklabel(fr, text = sl.names[i], width = "25") sc <- tkscale(fr, from = sl.mins[i], to = sl.maxs[i], showvalue = T, resolution = sl.deltas[i], orient = "horiz") tkpack(lab, sc, side = "right") assign("sc", sc, env = slider.env) eval(parse(text = paste("tkconfigure(sc,variable=slider", i, ")", sep = "")), env = slider.env) sl.fun <- if (length(sl.functions) > 1) sl.functions[[i]] else sl.functions if (!is.function(sl.fun)) sl.fun <- eval(parse(text = paste("function(...){", sl.fun, "}"))) tkconfigure(sc, command = sl.fun) } assign("slider.values.old", sl.defaults, env = slider.env) tkpack(f.but <- tkframe(nt), fill = "x") tkpack(tkbutton(f.but, text = "Exit", command = function() tkdestroy(nt)), side = "right") if (missing(reset.function)) reset.function <- function(...) print("relax") if (!is.function(reset.function)) reset.function <- eval(parse(text = paste("function(...){", reset.function, "}"))) tkpack(tkbutton(f.but, text = "Reset", command = function() { for (i in seq(sl.names)) eval(parse(text = paste("tclvalue(slider", i, ")<-", sl.defaults[i], sep = "")), env = slider.env) reset.function() }), side = "right") if (missing(but.names)) but.names <- NULL for (i in seq(but.names)) { but.fun <- if (length(but.functions) > 1) but.functions[[i]] else but.functions if (!is.function(but.fun)) but.fun <- eval(parse(text = paste("function(...){", but.fun, "}"))) tkpack(tkbutton(f.but, text = but.names[i], command = but.fun), side = "left") } invisible(nt) } # definition of R.veil.in.the.wind R.veil.in.the.wind<-function(){ # Mark Hempelmann / Peter Wolf par(bg="blue4", col="white", col.main="white", col.sub="white", font.sub=2, fg="white") # set colors and fonts samp <- function(N,D) N*(1/4+D)/(1/4+D*N) z<-outer(seq(1, 800, by=10), seq(.0025, 0.2, .0025)^2/1.96^2, samp) # create 3d matrix h<-100 z[10:70,20:25]<-z[10:70,20:25]+h; z[65:70,26:45]<-z[65:70,26:45]+h z[64:45,43:48]<-z[64:45,43:48]+h; z[44:39,26:45]<-z[44:39,26:45]+h x<-26:59; y<-11:38; zz<-outer(x,y,"+"); zz<-zz*(65<zz)*(zz<73) cz<-10+col(zz)[zz>0];rz<-25+row(zz)[zz>0]; z[cbind(cz,rz)]<-z[cbind(cz,rz)]+h refresh.code<-function(...){ theta<-slider(no=1); phi<-slider(no=2) persp(x=seq(1,800,by=10),y=seq(.0025,0.2,.0025),z=z,theta=theta,phi=phi, scale=T, shade=.9, box=F, ltheta = 45, lphi = 45, col="aquamarine", border="NA",ticktype="detailed") } slider(refresh.code, c("theta", "phi"), c(0, 0),c(360, 360),c(.2, .2),c(85, 270) ) } # now let's test it! R.veil.in.the.wind()