Re: [R] Problems when Apply a script to a list

2010-08-27 Thread Joris Meys
Where exactly did you put the sink() statement? I tried it with a 1000 dataframes and I have no problem whatsoever. Cheers Joris On Fri, Aug 27, 2010 at 6:56 AM, ev...@aueb.gr wrote: Joris, thank you very much for your help. It is very helpful for me. I still have a problem with sink stack

[R] Problems when Apply a script to a list

2010-08-26 Thread Evgenia
Dear users, ***I have a function f to simulate data from a model (example below used only to show my problems) f-function(n,mean1){ a-matrix(rnorm(n, mean1 , sd = 1),ncol=5) b-matrix(runif(n),ncol=5) data-rbind(a,b) out-data out} *I want to simulate 1000 datasets (here only 5) so

Re: [R] Problems when Apply a script to a list

2010-08-26 Thread Joris Meys
Answers below. On Thu, Aug 26, 2010 at 11:20 AM, Evgenia ev...@aueb.gr wrote: Dear users, ***I have a function f to simulate data from a model (example below used only to show my problems) f-function(n,mean1){ a-matrix(rnorm(n, mean1 , sd = 1),ncol=5) b-matrix(runif(n),ncol=5)

[R] Problems with apply

2010-05-31 Thread Luis Felipe Parra
Hello I am tryin to use the apply functions with two data frames I've got and I am getting the following error message Error en HistRio$SecSte : $ operator is invalid for atomic vectors I don't understand why. when I use the apply I am doing: PromP - function(HistRio,AnaQuim){ xx - c(0,0,0)

Re: [R] Problems with apply

2010-05-31 Thread Ivan Calandra
Hi, Here is what ?apply says: Returns a vector or array or list of values obtained by applying a function to margins of an array. So apply() works on arrays, not on dataframes! Maybe lapply() would do what you're looking for (don't have time to look more into it) And you don't do exactly the

Re: [R] Problems with apply

2010-05-31 Thread Joris Meys
Ivan is -partly- right. However, in the details it says as well that : If X is not an array but has a dimension attribute, apply attempts to coerce it to an array via as.matrix if it is two-dimensional (e.g., data frames) or via as.array. The main problem is the fact that what goes into the PromP