[R] printing a variable name in a for loop

2006-09-26 Thread Suzi Fei
Hello, How do you print a variable name in a for loop? I'm trying to construct a csv file that looks like this: Hello, variable1, value_of_variable1, World, Hello, variable2, value_of_variable2, World, Hello, variable3, value_of_variable3, World, Using this: f

[R] lapply, plot and additional arguments

2006-09-26 Thread Petr Pikal
Dear all Hopefully somebody will know the answer. I have some list x <- data.frame(a = 1:9, beta = exp(-4:4), logic = rep(c(TRUE,FALSE), c(5,4))) x.l <- split(x, x$logic) plot(x.l$a, x.l$beta) and I want to plot lines color coded according to logic variable lapply(x.l, function(x, ...) lines(

[R] warning message in nlm

2006-09-26 Thread singyee ling
Dear R-users, I am trying to find the MLEs for a loglikelihood function (loglikcs39) and tried using both optim and nlm. fredcs39<-function(b1,b2,x){return(exp(b1+b2*x))} loglikcs39<-function(theta,len){ sum(mcs39[1:len]*fredcs39(theta[1],theta[2],c(8:(7+len))) - pcs39[1:len] * log(fredcs39(theta

<    1   2