Skip to content
Back to formatted view

Raw Message

Message-ID: <CAAmySGONZwxMpqkENMafBEq-p7zKNFX++OYNTjgaPkmBDHFYKA@mail.gmail.com>
Date: 2012-11-01T07:41:50Z
From: R. Michael Weylandt
Subject: Strange compiling behaviour
In-Reply-To: <CAG1tYwLTF-xzLbYFn1FhrBx2_HQTtcnpQsN=3xEtGZDDY_pgRQ@mail.gmail.com>

On Wed, Oct 31, 2012 at 9:14 PM, Worik R <worikr at gmail.com> wrote:
> Compiling this little function gets me some strange behaviour
>
> .initDataDir <- function(){
>   if(file.exists(LOCATION)) {
>     if(as.logical(file.info(LOCATION)["isdir"]))return
>     stop(LOCATION, " exists but is not a directory")
>   }
>   Z <- dir.create(LOCATION)
>   if(!Z){
>     stop(geterrmessage())
> ##    stop("Juggel")
>   }
>   return(Z)
> }
>

Hi Worik,

I'm afraid I really can't follow your question. Could you come up with
a commented version of your function and explain what clearly what you
are seeing and what you would expect to see instead?

Some things to note

1) In your post, you are rather free using "geterrmessage" and
"geterrormessage" -- not the same.
2) In the function above there's a return() call in the wild.
3) You don't need to return errors thrown by stop. That happens automatically.
4) It looks like you don't have the appropriate write permissions in
the directory in question.

Michael