But, your lapply is:
lapply(x$clipno, function(c){
clipname <- x$clipname
out[[clipname]] <- rnorm(5)
})
So, you don't use 'c' argument.
On 27/03/2008, Paul Lemmens <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Sorry yes, I forgot to give comment about th
Hi,
Sorry yes, I forgot to give comment about the lapply().
> > foo <- function(x) {
> > out <- list()
> > lapply(x$clipno, function(c) {
> > clipname <- x$clipname
> > # stuff
> >
> > out[[clipname]] <- rnorm(5)
> > })
> > return(out)
> > }
> >
So x is a dataframe with th
HI,
I don't understand why you're using lapply.
Please provide a example of your 'x' data.frame
str(x)
On 27/03/2008, Paul Lemmens <[EMAIL PROTECTED]> wrote:
> Hi Henrique,
>
>
> On Thu, Mar 27, 2008 at 2:52 PM, Henrique Dallazuanna <[EMAIL PROTECTED]>
> wrote:
> > Try this:
> >
> > foo <
Hi Henrique,
On Thu, Mar 27, 2008 at 2:52 PM, Henrique Dallazuanna <[EMAIL PROTECTED]> wrote:
> Try this:
>
> foo <- function(x)
> {
> clipname <- "LK"
> out <- list()
> out[[clipname]] <- rnorm(5)
> return(out)
> }
That easy ... Hadn't thought of it. But now I have a refinement in foo()
f
Try this:
foo <- function(x)
{
clipname <- "LK"
out <- list()
out[[clipname]] <- rnorm(5)
return(out)
}
On 27/03/2008, Paul Lemmens <[EMAIL PROTECTED]> wrote:
> Dear all,
>
> I have a piece of code along the lines of
>
> f <- function(x) {
> clipname <- "LK" # but is in real determined based
Dear all,
I have a piece of code along the lines of
f <- function(x) {
clipname <- "LK" # but is in real determined based on info in data.frame x
# other manipulations
return( list(clipname=list()))
}
My intention is to do
out <- f(dat)
and then (in this example) having/getting
out$LK
6 matches
Mail list logo