[R] how to use sapply code

From: Roslina Zakaria <zroslina_at_yahoo.com>
Date: Wed, 16 Jun 2010 20:17:32 -0700 (PDT)


I have this code here and try to use sapply code.  But I got error message that I don't really understand to correct.

bt   <- c(24.96874, 19.67861, 23.51001, 19.86868); round(bt,2) alp  <- c(2.724234, 3.914649, 3.229146, 3.120719); round(alp,2)

bt_alp <- data.frame(bt,alp)

sapply(bt_alp, function(bt,alp) ((bt_m/bt)^alp), bt_m = min(bt))

> sapply(bt_alp, function(bt,alp) ((bt_m/bt)^alp), bt_m = min(bt))
Error in FUN(X[[1L]], ...) : unused argument(s) (bt_m = 19.67861)

Thank you for any help given.

	[[alternative HTML version deleted]]


R-help_at_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. Received on Thu 17 Jun 2010 - 03:21:24 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 17 Jun 2010 - 09:10:32 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive