[R] optimize

Nick gayeski nick at wildfishconservancy.org
Wed Oct 1 20:20:35 CEST 2014


Page 53 of Robert and Casella's "Use R" book, Introduction to Monte Carlo
Methods with R,  has the following code:

 

optimize(f=function(x){dbeta(x,2.7,6.3)},

+ interval=c(0,1) ,max=T)$objective

 

This should return 

[1] 2.669744

 

I run R from R Studio. When I enter this code I receive the following error
message: Error in f(arg, ...) : unused argument (max = TRUE)

 

Can someone help me understand why I get this error?

 

Thanks.

 

NickG


	[[alternative HTML version deleted]]



More information about the R-help mailing list