The sapply function is refusing to return a result for what seem to
me to be mysterious reasons.  Here is a toy example:
set.seed(111)
X    <- list(x=runif(20),y=runif(20))
rvec <- seq(0.01,0.15,length=42)
foo  <- function(x,X,cc) {
	mean((X$x)^x + (X$y)^cc)
}
bar  <- function(x,a,b){a+b*x}
try.b <- sapply(rvec,bar,a=1,b=2)     # This runs without a problem and
                                      # gives a + b*rvec as expected.
try.f <- sapply(rvec,foo,X=X,cc=1/3)  # This falls over.
The error message is:
Error in get(x, envir, mode, inherits) : variable "rvec" was not found
How can ``rvec'' not be found?  Is this one of the
``improvements''
induced by the new namespace sorcery?
Version information:
> version
         _                   
platform sparc-sun-solaris2.9
arch     sparc               
os       solaris2.9          
system   sparc, solaris2.9   
status                       
major    1                   
minor    7.0                 
year     2003                
month    04                  
day      16                  
language R
					cheers,
						Rolf Turner
						rolf at math.unb.ca
Rolf Turner <rolf at math.unb.ca> writes:> try.f <- sapply(rvec,foo,X=X,cc=1/3) # This falls over. > > The error message is: > > Error in get(x, envir, mode, inherits) : variable "rvec" was not found > > How can ``rvec'' not be found? Is this one of the ``improvements'' > induced by the new namespace sorcery?No. Take a look at args(sapply). Hint: There is no *function* called rvec. -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
Hello all,
I would appreciate a lot your help - thank you...
I have a problem with printing a jpeg pic of bwplots. I would like to
have a background color "#E6E6E6" and all lines in graph color
"#8c0200".
#########################################
power.ch <- matrix(rnorm(90, 0,1), 30,3)
alpha.ch <- c(".010", ".050", ".100")
jpeg(file="help.please.jpg", width=300, height=300, pointsize=36,
     quality=95, bg="#E6E6E6")
print.trellis(bwplot((power.ch)~matrix(rep(alpha.ch, rep(30,3)),30,3, byrow=F),
		 box.ratio=1,cex=2,
                 horizontal=F, cex.axis=2, cex.lab=2,
                 xlab="", ylab="",
col.bg="#E6E6E6", fill ="#8c0200",
                scales=list(x=list(cex=3), y=list(cex=3))))
dev.off()
##########################################
Could you please let me know how to change the background and how to
change the blue outline of the boxplots into me specified color?
Thank you a lot.
Martina Pavlicova
--------------------------------------------------------------------------
Department of Statistics             Office Phone: (614) 292-1567
1958 Neil Avenue, 304E Cockins Hall  FAX: (614) 292-2096
The Ohio State University            E-mail: pavlicov at stat.ohio-state.edu
Columbus, OH 43210-1247              www.stat.ohio-state.edu/~pavlicov