Re: [R] help please: put output into dataframe

2011-03-18 Thread Dennis Murphy
Hi: Is this what you're after? fout - function(x) { lim - median(x) + c(-2, 2) * mad(x) x[x lim[1] | x lim[2]] } apply(datafr1, 2, fout) $var1 [1] 17.5462078 18.4548214 0.7083442 1.9207578 -1.2296787 17.4948240 [7] 19.5702558 1.6181150 20.9791652 -1.3542099 1.8215087

Re: [R] help please: put output into dataframe

2011-03-18 Thread Ram H. Sharma
Hi Dennis and R-users Thank you for more help. I am pretty close, but challenge still remain is forcing the output with different length to output dataframe. x - data.frame(apply(datafr1, 2, fout)) Error in data.frame(var1 = c(-0.70777998321315, 0.418602152926712, 2.08356737154810, :

Re: [R] help please: put output into dataframe

2011-03-18 Thread jim holtman
I think it was suggested that you save your output to a 'list' and then you will have it in a format that can accept variable numbers of items in each element and it is also in a form that you can easily process it to create whatever other output you might need. On Fri, Mar 18, 2011 at 7:24 AM,

Re: [R] help please: put output into dataframe

2011-03-18 Thread Ram H. Sharma
Thanks, Jim for the idea. I tried with save as list. I can not write to a table with write.table, I could not find a function that is write.list or equivalent. Even if it is list I think it would be difficult to post-processing than as table. outx- as.list(apply(datafr1, 2, fout)) write.table

Re: [R] help please: put output into dataframe

2011-03-18 Thread David Winsemius
On Mar 18, 2011, at 10:53 AM, Ram H. Sharma wrote: Thanks, Jim for the idea. I tried with save as list. I can not write to a table with write.table, I could not find a function that is write.list or equivalent. Even if it is list I think it would be difficult to post-processing than as

Re: [R] help please: put output into dataframe

2011-03-18 Thread jim holtman
The easiest thing is to use 'save' so that you write the object out as binary. If you don't need 'text', then save/load is the way to operate with the data. On Fri, Mar 18, 2011 at 10:53 AM, Ram H. Sharma sharma.ra...@gmail.com wrote: Thanks, Jim for the idea. I tried with save as list. I can

Re: [R] help please: put output into dataframe

2011-03-18 Thread Ram H. Sharma
I wish has simpler solution, apprently simple problem ! thanks for help. On Fri, Mar 18, 2011 at 10:04 AM, jim holtman jholt...@gmail.com wrote: I think it was suggested that you save your output to a 'list' and then you will have it in a format that can accept variable numbers of items in

[R] help please: put output into dataframe

2011-03-17 Thread Ram H. Sharma
Dear R community members I have been struggling on this simple question, but never get appropriate solution. So please help. # my data, though I have a large number of variables var1 - rnorm(500, 10,4) var2 - rnorm(500, 20, 8) var3 - rnorm(500, 30, 18) var4 - rnorm(500, 40, 20) datafr1 -