Package gamlss used inside foreach() and %dopar% fails to find an object

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Package gamlss used inside foreach() and %dopar% fails to find an object

Nik Tuzov

Hello Mikis:

Thanks a lot, it worked. Could you tell me what the problem was?

Regards,
Nik


----- Original Message -----
From: [hidden email]
To: "r-help"
Sent: Sunday, March 11, 2018 6:00:02 AM
Subject: R-help Digest, Vol 181, Issue 11

Send R-help mailing list submissions to
        [hidden email]

To subscribe or unsubscribe via the World Wide Web, visit
        https://stat.ethz.ch/mailman/listinfo/r-help
or, via email, send a message with subject or body 'help' to
        [hidden email]

You can reach the person managing the list at
        [hidden email]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of R-help digest..."


Today's Topics:

   1. . Package gamlss used inside foreach() and %dopar% fails to
      find an object (Nik Tuzov) (Dimitrios Stasinopoulos)
   2. error message from sqldf (Ding, Yuan Chun)
   3. Re: error message from sqldf
      (=?iso-8859-1?Q?Jos=E9_Mar=EDa?= Mateos)

----------------------------------------------------------------------

Message: 1
Date: Sat, 10 Mar 2018 13:34:59 +0000
From: Dimitrios Stasinopoulos <[hidden email]>
To: [hidden email]
Cc: Nik ntuzov.com>
Subject: [R] . Package gamlss used inside foreach() and %dopar% fails
        to find an object (Nik Tuzov)
Message-ID:
        <[hidden email]>
Content-Type: text/plain; charset="utf-8"

Dear Nik

Try the following code


loo_predict.mu <- function(model.obj, input.data) {
  yhat <- foreach(i = 1 : nrow(input.data), .packages="gamlss", .combine = rbind) %dopar% {
    updated.model.obj <- update(model.obj, data = input.data[-i, ])
    predict(updated.model.obj, what = "mu", data = input.data[-i, ],
            newdata = input.data[i,], type = "response")
  }
  return(data.frame(result = yhat[, 1], row.names = NULL))
}

par.run <- loo_predict.mu(model3, input.processed.cut)

The predict command in this case also need the old data.

Thanks
Mikis



Prof Dimitrios Mikis Stasinopoulos
[hidden email]




        [[alternative HTML version deleted]]




------------------------------

Message: 2
Date: Sat, 10 Mar 2018 21:30:42 +0000
From: "Ding, Yuan Chun" <[hidden email]>
To: "[hidden email]"
Subject: [R] error message from sqldf
Message-ID:
        coh.org>
Content-Type: text/plain; charset="utf-8"

Dear R users,

I got the following error message from running sqldf code in R.   do you know how to fix it?  I read the sqldf package instruction and did not find a solution.

Thank you,

Ding

chr10 <- sqldf("select * from manifest where CHR==10")

UCN3cpg <-  sqldf("select * from chr10 where MAPINFO between 5405573 and 5407594),
overwrite = TRUE")
Error: Table chr10 exists in database, and both overwrite and append are FALSE


>





---------------------------------------------------------------------
-SECURITY/CONFIDENTIALITY WARNING-
This message (and any attachments) are intended solely f...{{dropped:22}}




------------------------------

Message: 3
Date: Sat, 10 Mar 2018 16:53:35 -0500
From: =?iso-8859-1?Q?Jos=E9_Mar=EDa?= Mateos <[hidden email]>
To: [hidden email]
Subject: Re: [R] error message from sqldf
Message-ID: <20180310215335.GD5049@equipaje>
Content-Type: text/plain; charset="iso-8859-1"

On Sat, Mar 10, 2018 at 09:30:42PM +0000, Ding, Yuan Chun wrote:
> chr10 <- sqldf("select * from manifest where CHR==10")
>
> UCN3cpg <-  sqldf("select * from chr10 where MAPINFO between 5405573 and 5407594),
> overwrite = TRUE")
> Error: Table chr10 exists in database, and both overwrite and append are FALSE

Could it be that `chr10` already exists when you try to run your code.
What about rewriting it as:

chr10 <- sqldf("select * from manifest where CHR==10", overwrite = TRUE)

Also, it seems to me that the second line is not closing the quotes
properly. Shouldn't this be correct instead?

UCN3cpg <-  sqldf("select * from chr10 where MAPINFO between 5405573 and 5407594",
                  overwrite = TRUE)

Cheers,

--
José María (Chema) Mateos
https://rinzewind.org/blog-es || https://rinzewind.org/blog-en




------------------------------

Subject: Digest Footer

_______________________________________________
[hidden email] 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.


------------------------------

End of R-help Digest, Vol 181, Issue 11

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.