On Sat, Jul 19, 2008 at 12:42 PM, stephen sefick <[EMAIL PROTECTED]> wrote: > I can fix the par settings. I am new to function writing. I would like to > use the na.method in the > d<- (x-y) > > how? > > I don't know what a driver is sorry for my ignorance
1. As stated in the prior post its code and data that calls your function. With only your function if someone wants to answer your question they have to come up with their own data and then write it out and then write out the call simply to verify what it does. You could do that work for us and also clarify precisely what it is that should be returned by calculating it by hand, if feasible. Reproducible as requested at the bottom of every message to r-help means that we can copy the code from your post and just paste it into our running R session and see the result without having to come up with more code ourselves or having to manipulate it in any way. 2. Regarding na.method see ?switch and try this: d <- switch(na.method, all.obs = ..., ... ) 3. Regarding par try this: on.exit(par(op)) op <- par(...whatever...) 4. Regarding match.arg follow the first example in the examples section of ?match.arg . Note that the choices are best placed in the formal parameter list, not in the match.arg function. > > On Sat, Jul 19, 2008 at 12:36 PM, Gabor Grothendieck > <[EMAIL PROTECTED]> wrote: >> >> See ?paste and the collapse argument, in particular: >> >> plot(d, main = paste(paste(colnames(x), collapse = " "), >> paste(colnames(y), collapse = " "), sep = " - ")) >> >> Also your function sets na.method but never uses it and leaves the par >> settings >> changed afterwards. See ?par. It could also benefit from the use of >> ?match.arg >> >> Also please include drivers that call the posted function so one can >> run them in >> a reproducible manner. >> >> >> On Sat, Jul 19, 2008 at 12:04 PM, stephen sefick <[EMAIL PROTECTED]> >> wrote: >> > #this is my little function that I would like to use the column names of >> > the >> > x and y arguments in the function. I would like it to read >> > # site1-site2 how would I do this >> > diff.temp <- function(x, y ,use="pairwise.complete.obs") >> > { >> > na.method <- pmatch(use, c("all.obs", "complete.obs", >> > "pairwise.complete.obs")) >> > par(mfrow=c(2,1)) >> > d <- (x-y) >> > plot(d, main="paste(colnames(x))-paste(colnames(y))") >> > plot(density(na.omit(coredata(d)))) >> > } >> > >> > -- >> > Let's not spend our time and resources thinking about things that are so >> > little or so large that all they really do for us is puff us up and make >> > us >> > feel like gods. We are mammals, and have not exhausted the annoying >> > little >> > problems of being mammals. >> > >> > -K. Mullis >> > >> > [[alternative HTML version deleted]] >> > >> > ______________________________________________ >> > 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. >> > > > > > -- > Let's not spend our time and resources thinking about things that are so > little or so large that all they really do for us is puff us up and make us > feel like gods. We are mammals, and have not exhausted the annoying little > problems of being mammals. > > -K. Mullis ______________________________________________ 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.