Hello,

I have some problems with sapply. I wanted to do the following:

s <- sapply(filelist, function(x) {
                if(file.exists(x))
                {
                        ...
                        return( list(density(file$V1)$x, density(file$V1)$y))
                }
                else
                {
                        print(paste("plotDensity ERROR - File does not exist: 
",x,sep=""))
                        return( NULL)
                }
        })

        if(is.null( - ??? - ))
        {
                print("no plot")
        }

That means, I try to read every file and to get some data from it. It 
may happen, that the file does not exist and then I don't want to plot 
anything. As return, I get a list and I have quite a lot of problems to 
access its content... (I did not really understand how this works, I 
guess...)
Could anybody give me a hint?

Thank you!
Antje

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to