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

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