> I?ve written a script to run several multivariate statistical analysis > automatically. > As one result a biplot and screeplot is produced. > Now I?d like to display the name of the inputdatset as part of the title of > these graphics and I do not want to enter it each time I run the script. > How can I extract the name of a dataset? > An (shortened) extraction from the script: > > >Test1 <- function(pri, sec, Pca, Ca, Dca){ > >#pri - primary Parameters (biological Dataset (abundances)) > >#sec ? secondary Parameters > >#Pca, Ca, Dca ? Default=F, If set to TRUE these Methods are active > ?several mathematical Operations? > >biplot(pri, pc.biplot=T, main=paste(?PCA - ?, ???)?. > > Instead of the ??? I? d like to have a variable. > For example if > Test1(dataset.typ5, sec.typ5, Pca=TRUE) > then the title of the plots should be > ?PCA ? dataset.typ5?
This demonstrates the basic idea: dfr1 <- data.frame(x=1:10, y=runif(10)) dfr2 <- data.frame(x=11:20, y=runif(10)) library(lattice) myplot <- function(dfr) { xyplot(y~x, data=dfr, main=as.character(substitute(dfr))) } myplot(dfr1) myplot(dfr2) Regards, Richie. Mathematical Sciences Unit HSL ------------------------------------------------------------------------ ATTENTION: This message contains privileged and confidential inform...{{dropped:20}} ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.