Re: [R] Outputing dataframe or vector from within a user defined function

2006-05-17 Thread Farrel Buchinsky
No, simply access the components you want to get and put then into a data.frame. Let's make a nonsense lm() example that is reproducible for me: result - lapply(1:10, function(i){ x - rnorm(10) y - rnorm(10) lm(y~x) }) result Now you want to get the coefficients by

Re: [R] Outputing dataframe or vector from within a user defined function

2006-05-05 Thread Uwe Ligges
Farrel Buchinsky wrote: Uwe Ligges [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Simply speaking, the last value of a function is returned. You can also explicitly call return(). You have to assign the value to a new variable when you call the function. Example: I read your

Re: [R] Outputing dataframe or vector from within a user defined function

2006-05-05 Thread Farrel Buchinsky
Uwe Ligges [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] $statistic Chi-squared test 1.923077 $parameter DF 1 $exact [1] TRUE $p.value Chi-squared test12 0.16551790.26684570.2668457 $method [1]

Re: [R] Outputing dataframe or vector from within a user defined function

2006-05-04 Thread Farrel Buchinsky
Uwe Ligges [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Simply speaking, the last value of a function is returned. You can also explicitly call return(). You have to assign the value to a new variable when you call the function. Example: I read your explanation and I half get it.

[R] Outputing dataframe or vector from within a user defined function

2005-12-20 Thread Andrew Cox
Hi, I have written a user defined function that carries out a monte carlo simulation and outputs various stats. I would like to access and store the simulation data (a two column local variable) from outside the function I have written. How can I output the data from the function as new

Re: [R] Outputing dataframe or vector from within a user defined function

2005-12-20 Thread Uwe Ligges
Andrew Cox wrote: Hi, I have written a user defined function that carries out a monte carlo simulation and outputs various stats. I would like to access and store the simulation data (a two column local variable) from outside the function I have written. How can I output the data from the

Re: [R] Outputing dataframe or vector from within a user defined function

2005-12-20 Thread Petr Pikal
(GMT) From: Andrew Cox [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Subject:[R] Outputing dataframe or vector from within a user defined function Hi, I have written a user defined function that carries out a monte carlo simulation

[R] Outputing dataframe or vector from within a user defined function

2005-12-19 Thread Andrew Cox
Hi, I have written a user defined function that carries out a monte carlo simulation and outputs various stats. I would like to access and store the simulation data (a two column local variable) from outside the function I have written. How can I output the data from the function as new variable,