[R] Using sapply on a two argument function

Steven Worthington steven.worthington at gmail.com
Fri Feb 12 00:57:03 CET 2010


Thanks Peter,

your solution worked perfectly. It also helped me realize the mistake I made
in my own script - the 'k' function was returning values for 'y' between
1:10 rather than .1:1 - it should have looked like this:

k <- function(s) {
		n <- seq(.1, s/10, .1)
		m <- data.frame(seq(.1, s/10, .1))
		m <- sapply(n, foo)
		rownames(m) <- 1:w
		colnames(m) <- seq(.1, s/10, .1)
		return(m)
	} 

best,

Steve
-- 
View this message in context: http://n4.nabble.com/Using-sapply-on-a-two-argument-function-tp1477883p1477956.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list