Re: [R] Two geom_bar with counts to put in the same plot

2019-12-04 Thread Francesca
Hi, sorry for bothering again.
I was wondering how I can reshape the data, if in your code, 
I would like to have only two panels, where in the panel with Participation =0, 
I represent delta11_L of participation1==0
and delta2_L of participation2==0, and in the right panel, I want 
Participation=1, but representing together 
delta11_L of participation1==1, and delta2_L of participation2==1.

I get messed up with the joint melting of participation, which determines the 
facet, but then I cannot assign the proper fill to the density plots which 
depend on it, and on the other hand I would like to have in the same plot with 
mixed participation.

I hope it is clear. 
Nonetheless, the previous plot is useful to understand something I had not 
thought about.
Thanks again for your time.
F.
--

> Il giorno 4 dic 2019, alle ore 15:27, Francesca 
>  ha scritto:
> 
> Hi!
> It is not exactly what I wanted but more than I suspected I could get. Thanks 
> a lot, this is awesome!
> Francesca
> 
> On Wed, 4 Dec 2019 at 14:04, Rui Barradas  > wrote:
> Hello,
> 
> Please keep R-Help in the thread.
> 
> As for the question, the following divides by facets, participation1/2 
> with values 0/1. See if that's what you want.
> 
> 
> idv <- grep("part", names(DB)[-(3:4)], ignore.case = TRUE, value = TRUE)
> dblong <- reshape2::melt(DB[-(3:4)], id.vars = idv)
> dblong <- reshape2::melt(dblong, id.vars = c("variable", "value"))
> names(dblong) <- c("deltaVar", "delta", "participationVar", "participation")
> dblong <- dblong[complete.cases(dblong),]
> 
> ggplot(dblong, aes(x = delta, fill = deltaVar)) +
>geom_density(aes(alpha = 0.2)) +
>scale_alpha_continuous(guide = "none") +
>facet_wrap(participationVar ~ participation)
> 
> 
> Hope this helps,
> 
> Rui Barradas
> 
> Às 08:25 de 04/12/19, Francesca escreveu:
> > Dear  Rui
> > the code works and the final picture is aesthetical as I wanted(very 
> > beautiful indeed), but I probably did not explain that the two 
> > distributions that I want to overlap, must be different by participation 
> > 1 and participation 2, which are to dummy variables that identify :
> > Participation 1(equivalent to PARTICIPATIONNOPUN): 1 participants, 0 non 
> > participants, for the variable delta11_L
> > Participation 2(equivalent to PARTICIPATIONPUN): 1 participants, 0 non
> > participants, for the variable delta2_L
> > 
> > The density plots are four in the end rather than 2: I compare delta11_L 
> > for Participants1 vsnon participants and delta2_L for Participants 2 vs
> > non Participants 2,
> > I basically want to verify whether the population of Participants vs Non 
> > participants, change going from delta11_L to delta2_L
> > 
> > 
> > Sorry for being unclear.
> > Thanks for any help.
> > Francesca
> > 
> > On Wed, 4 Dec 2019 at 09:16, Rui Barradas  >  
> > >> wrote:
> > 
> > Hello,
> > 
> > Is it as simple as this? The code below does not separate the
> > participant1 and participant2, only the 'delta' variables.
> > 
> > 
> > idv <- grep("part", names(DB)[-(3:4)], ignore.case = TRUE, value = TRUE)
> > dblong <- reshape2::melt(DB[-(3:4)], id.vars = idv)
> > head(dblong)
> > 
> > ggplot(dblong, aes(x = value, fill = variable)) +
> > geom_density(aes(alpha = 0.2)) +
> > scale_alpha_continuous(guide = "none")
> > 
> > 
> > I will also repost the data, since you have posted a matrix and this
> > code needs a data.frame.
> > 
> > 
> > DB <-
> > structure(list(participation1 = c(1, 1, 1, 1, 1, 1, 1, 1, 1,
> > 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
> > 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
> > 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1,
> > 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
> > 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
> > 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
> > 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
> > 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, NA,
> > NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
> > NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
> > NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
> > NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), participation2 = c(1,
> > 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1,
> > 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1,
> > 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1,
> > 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1,
> > 1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 1,
> > 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1,
> > 0, 1, 

Re: [R] package MCMCpack

2019-12-04 Thread Prophet, William
That was it!! 😉😉😉
Thank you very much. 

Bill P.




-Original Message-
From: William Michels  
Sent: Wednesday, December 4, 2019 4:15 PM
To: Prophet, William 
Cc: Duncan Murdoch ; r-help@r-project.org
Subject: Re: [R] package MCMCpack

Sent by an external sender

--
You can try installing the mcmc package first:

https://cran.r-project.org/web/packages/mcmc/index.html
https://cran.r-project.org/src/contrib/Archive/mcmc/

I've used mcmc_0.9-5 with MCMCpack_1.4-3 under R version 3.3.3.

HTH, Bill.

W. Michels, Ph.D.


On Wed, Dec 4, 2019 at 2:52 PM Prophet, William  
wrote:
>
> Thank you for your reply. I have tried various versions and I get an error in 
> each case. In the case of MCMCpack_1.4-3 although the error may be related to 
> something specific in my configuration. In any case, I get the following 
> error when I try to install that version:
>
> > packageurl <- 
> > "https://cran.r-project.org/src/contrib/Archive/MCMCpack/MCMCpack_1.4-3.tar.gz";
> > install.packages(packageurl, repos=NULL, type="source")
> trying URL 
> 'https://cran.r-project.org/src/contrib/Archive/MCMCpack/MCMCpack_1.4-3.tar.gz'
> Content type 'application/x-gzip' length 688047 bytes (671 KB) 
> downloaded 671 KB
>
> ERROR: dependency 'mcmc' is not available for package 'MCMCpack'
> * removing 'C:/R/R-3.5.3/library/MCMCpack'
> In R CMD INSTALL
> Warning in install.packages :
>   installation of package 
> 'C:/Users/prophetw/AppData/Local/Temp/RtmpykZoRh/downloaded_packages/M
> CMCpack_1.4-3.tar.gz' had non-zero exit status
>
>
>
>
>
> -Original Message-
> From: William Michels 
> Sent: Wednesday, December 4, 2019 3:45 PM
> To: Prophet, William 
> Cc: Duncan Murdoch ; r-help@r-project.org
> Subject: Re: [R] package MCMCpack
>
> Sent by an external sender
>
> --
> Hi William,
>
> It's not clear to me why you need this particular older version of MCMCpack. 
> From the archive I find MCMCpack_1.2-4 dates back to 2012-06-14, and 
> MCMCpack_1.2-4.1 dates back to 2013-04-07:
>
> MCMCpack_1.2-4.1.tar.gz 2013-04-07 00:05 481K MCMCpack_1.2-4.tar.gz 
> 2012-06-14 12:36 482K
>
> Have you tried newer versions of MCMCpack? While the newest version of 
> MCMCpack (1.4-5) may require R (≥ 3.6), I have sessionInfo() logs 
> suggesting that MCMCpack_1.4-3 (2018-05-15 09:54 672K) ran just fine 
> under R version 3.3.3 (2017-03-06) -- "Another Canoe". In fact, an 
> archived version of the MCMCpack_1.4-3 DESCRIPTION_file indicates that
> MCMCpack_1.4-3 only requires  R (>= 2.10.0).
>
> Hope this helps,
>
> Bill.
>
> W. Michels, Ph.D.
>
>
>
>
>
> On Wed, Dec 4, 2019 at 7:34 AM Prophet, William  
> wrote:
> >
> > Yes, I should have mentioned that I tried this same line of code and I 
> > still got an error.
> >
> >
> > -Original Message-
> > From: Duncan Murdoch 
> > Sent: Wednesday, December 4, 2019 8:32 AM
> > To: Prophet, William ; 
> > r-help@r-project.org
> > Subject: Re: [R] package MCMCpack
> >
> > Sent by an external sender
> >
> > 
> > -- On 04/12/2019 8:47 a.m., Prophet, William wrote:
> > > I am running R on my work computer with the following parameters:
> > >> sessionInfo()
> > > R version 3.5.3 (2019-03-11)
> > > Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 
> > > >=
> > > 8
> > > x64 (build 9200)
> > >
> > >
> > > I am trying to install the "MCMCpack" library. In the process however, I 
> > > receive the message:
> > >
> > >> install.packages("MCMCpack")
> > >
> > > Warning in install.packages :
> > >
> > >package 'MCMCpack' is not available (for R version 3.5.3)
> > >
> > >
> > > I have tried to install earlier versions of the "MCMCpack" library which 
> > > I obtained from the following website:
> > > https://cran.r-project.org/src/contrib/Archive/MCMCpack/
> > >
> > > using the following code:
> > > packageurl <- 
> > > "https://cran.r-project.org/src/contrib/Archive/MCMCpack/MCMCpack_1.2-4.tar.gz";
> > > install.packages(packageurl, type="source")
> >
> > That's not the way to install a tarball.  You should use
> >
> > install.packages(packageurl, type="source", repos=NULL)
> >
> > However, you may still have problems:  when I tried that, the install 
> > failed because of C++ errors.  I don't know if configure options (e.g.
> > specifying a particular version of C++) would have fixed the problems.
> >
> > Duncan Murdoch
> >
> > >
> > > but I get an identical error message:
> > >
> > >> packageurl <- 
> > >> "https://cran.r-project.org/src/contrib/Archive/MCMCpack/MCMCpack_1.2-4.tar.gz";
> > >
> > >> install.packages(packageurl, type="source")
> > >
> > > Warning in install.packages :
> > >
> > >package
> > > 'https://cran.r-project.org/src/contrib/Archive/MCMCpack/MCMCpack_1.
> > > 2- 4.tar.gz' is not available (for R version 3.5.3)
> > >
> > >
> > >
> > > I realize that updat

Re: [R] package MCMCpack

2019-12-04 Thread William Michels via R-help
You can try installing the mcmc package first:

https://cran.r-project.org/web/packages/mcmc/index.html
https://cran.r-project.org/src/contrib/Archive/mcmc/

I've used mcmc_0.9-5 with MCMCpack_1.4-3 under R version 3.3.3.

HTH, Bill.

W. Michels, Ph.D.


On Wed, Dec 4, 2019 at 2:52 PM Prophet, William
 wrote:
>
> Thank you for your reply. I have tried various versions and I get an error in 
> each case. In the case of MCMCpack_1.4-3 although the error may be related to 
> something specific in my configuration. In any case, I get the following 
> error when I try to install that version:
>
> > packageurl <- 
> > "https://cran.r-project.org/src/contrib/Archive/MCMCpack/MCMCpack_1.4-3.tar.gz";
> > install.packages(packageurl, repos=NULL, type="source")
> trying URL 
> 'https://cran.r-project.org/src/contrib/Archive/MCMCpack/MCMCpack_1.4-3.tar.gz'
> Content type 'application/x-gzip' length 688047 bytes (671 KB)
> downloaded 671 KB
>
> ERROR: dependency 'mcmc' is not available for package 'MCMCpack'
> * removing 'C:/R/R-3.5.3/library/MCMCpack'
> In R CMD INSTALL
> Warning in install.packages :
>   installation of package 
> 'C:/Users/prophetw/AppData/Local/Temp/RtmpykZoRh/downloaded_packages/MCMCpack_1.4-3.tar.gz'
>  had non-zero exit status
>
>
>
>
>
> -Original Message-
> From: William Michels 
> Sent: Wednesday, December 4, 2019 3:45 PM
> To: Prophet, William 
> Cc: Duncan Murdoch ; r-help@r-project.org
> Subject: Re: [R] package MCMCpack
>
> Sent by an external sender
>
> --
> Hi William,
>
> It's not clear to me why you need this particular older version of MCMCpack. 
> From the archive I find MCMCpack_1.2-4 dates back to 2012-06-14, and 
> MCMCpack_1.2-4.1 dates back to 2013-04-07:
>
> MCMCpack_1.2-4.1.tar.gz 2013-04-07 00:05 481K MCMCpack_1.2-4.tar.gz 
> 2012-06-14 12:36 482K
>
> Have you tried newer versions of MCMCpack? While the newest version of 
> MCMCpack (1.4-5) may require R (≥ 3.6), I have sessionInfo() logs suggesting 
> that MCMCpack_1.4-3 (2018-05-15 09:54 672K) ran just fine under R version 
> 3.3.3 (2017-03-06) -- "Another Canoe". In fact, an archived version of the 
> MCMCpack_1.4-3 DESCRIPTION_file indicates that
> MCMCpack_1.4-3 only requires  R (>= 2.10.0).
>
> Hope this helps,
>
> Bill.
>
> W. Michels, Ph.D.
>
>
>
>
>
> On Wed, Dec 4, 2019 at 7:34 AM Prophet, William  
> wrote:
> >
> > Yes, I should have mentioned that I tried this same line of code and I 
> > still got an error.
> >
> >
> > -Original Message-
> > From: Duncan Murdoch 
> > Sent: Wednesday, December 4, 2019 8:32 AM
> > To: Prophet, William ;
> > r-help@r-project.org
> > Subject: Re: [R] package MCMCpack
> >
> > Sent by an external sender
> >
> > --
> > On 04/12/2019 8:47 a.m., Prophet, William wrote:
> > > I am running R on my work computer with the following parameters:
> > >> sessionInfo()
> > > R version 3.5.3 (2019-03-11)
> > > Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows >=
> > > 8
> > > x64 (build 9200)
> > >
> > >
> > > I am trying to install the "MCMCpack" library. In the process however, I 
> > > receive the message:
> > >
> > >> install.packages("MCMCpack")
> > >
> > > Warning in install.packages :
> > >
> > >package 'MCMCpack' is not available (for R version 3.5.3)
> > >
> > >
> > > I have tried to install earlier versions of the "MCMCpack" library which 
> > > I obtained from the following website:
> > > https://cran.r-project.org/src/contrib/Archive/MCMCpack/
> > >
> > > using the following code:
> > > packageurl <- 
> > > "https://cran.r-project.org/src/contrib/Archive/MCMCpack/MCMCpack_1.2-4.tar.gz";
> > > install.packages(packageurl, type="source")
> >
> > That's not the way to install a tarball.  You should use
> >
> > install.packages(packageurl, type="source", repos=NULL)
> >
> > However, you may still have problems:  when I tried that, the install 
> > failed because of C++ errors.  I don't know if configure options (e.g.
> > specifying a particular version of C++) would have fixed the problems.
> >
> > Duncan Murdoch
> >
> > >
> > > but I get an identical error message:
> > >
> > >> packageurl <- 
> > >> "https://cran.r-project.org/src/contrib/Archive/MCMCpack/MCMCpack_1.2-4.tar.gz";
> > >
> > >> install.packages(packageurl, type="source")
> > >
> > > Warning in install.packages :
> > >
> > >package
> > > 'https://cran.r-project.org/src/contrib/Archive/MCMCpack/MCMCpack_1.
> > > 2- 4.tar.gz' is not available (for R version 3.5.3)
> > >
> > >
> > >
> > > I realize that updating my R version to 3.6.1 could possibly solve the 
> > > problem, but this would be impractical for me because my version needs to 
> > > be consistent with others on my team. In any case, the fact that I am 
> > > getting errors (detailed above) with *every* version of "MCMCpack" seems 
> > > odd.
> > >
> > > Do you have any suggestions for how I can 

Re: [R] package MCMCpack

2019-12-04 Thread Prophet, William
Thank you for your reply. I have tried various versions and I get an error in 
each case. In the case of MCMCpack_1.4-3 although the error may be related to 
something specific in my configuration. In any case, I get the following error 
when I try to install that version:

> packageurl <- 
> "https://cran.r-project.org/src/contrib/Archive/MCMCpack/MCMCpack_1.4-3.tar.gz";
> install.packages(packageurl, repos=NULL, type="source")
trying URL 
'https://cran.r-project.org/src/contrib/Archive/MCMCpack/MCMCpack_1.4-3.tar.gz'
Content type 'application/x-gzip' length 688047 bytes (671 KB)
downloaded 671 KB

ERROR: dependency 'mcmc' is not available for package 'MCMCpack'
* removing 'C:/R/R-3.5.3/library/MCMCpack'
In R CMD INSTALL
Warning in install.packages :
  installation of package 
'C:/Users/prophetw/AppData/Local/Temp/RtmpykZoRh/downloaded_packages/MCMCpack_1.4-3.tar.gz'
 had non-zero exit status





-Original Message-
From: William Michels  
Sent: Wednesday, December 4, 2019 3:45 PM
To: Prophet, William 
Cc: Duncan Murdoch ; r-help@r-project.org
Subject: Re: [R] package MCMCpack

Sent by an external sender

--
Hi William,

It's not clear to me why you need this particular older version of MCMCpack. 
From the archive I find MCMCpack_1.2-4 dates back to 2012-06-14, and 
MCMCpack_1.2-4.1 dates back to 2013-04-07:

MCMCpack_1.2-4.1.tar.gz 2013-04-07 00:05 481K MCMCpack_1.2-4.tar.gz 2012-06-14 
12:36 482K

Have you tried newer versions of MCMCpack? While the newest version of MCMCpack 
(1.4-5) may require R (≥ 3.6), I have sessionInfo() logs suggesting that 
MCMCpack_1.4-3 (2018-05-15 09:54 672K) ran just fine under R version 3.3.3 
(2017-03-06) -- "Another Canoe". In fact, an archived version of the 
MCMCpack_1.4-3 DESCRIPTION_file indicates that
MCMCpack_1.4-3 only requires  R (>= 2.10.0).

Hope this helps,

Bill.

W. Michels, Ph.D.





On Wed, Dec 4, 2019 at 7:34 AM Prophet, William  
wrote:
>
> Yes, I should have mentioned that I tried this same line of code and I still 
> got an error.
>
>
> -Original Message-
> From: Duncan Murdoch 
> Sent: Wednesday, December 4, 2019 8:32 AM
> To: Prophet, William ; 
> r-help@r-project.org
> Subject: Re: [R] package MCMCpack
>
> Sent by an external sender
>
> --
> On 04/12/2019 8:47 a.m., Prophet, William wrote:
> > I am running R on my work computer with the following parameters:
> >> sessionInfo()
> > R version 3.5.3 (2019-03-11)
> > Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows >= 
> > 8
> > x64 (build 9200)
> >
> >
> > I am trying to install the "MCMCpack" library. In the process however, I 
> > receive the message:
> >
> >> install.packages("MCMCpack")
> >
> > Warning in install.packages :
> >
> >package 'MCMCpack' is not available (for R version 3.5.3)
> >
> >
> > I have tried to install earlier versions of the "MCMCpack" library which I 
> > obtained from the following website:
> > https://cran.r-project.org/src/contrib/Archive/MCMCpack/
> >
> > using the following code:
> > packageurl <- 
> > "https://cran.r-project.org/src/contrib/Archive/MCMCpack/MCMCpack_1.2-4.tar.gz";
> > install.packages(packageurl, type="source")
>
> That's not the way to install a tarball.  You should use
>
> install.packages(packageurl, type="source", repos=NULL)
>
> However, you may still have problems:  when I tried that, the install failed 
> because of C++ errors.  I don't know if configure options (e.g.
> specifying a particular version of C++) would have fixed the problems.
>
> Duncan Murdoch
>
> >
> > but I get an identical error message:
> >
> >> packageurl <- 
> >> "https://cran.r-project.org/src/contrib/Archive/MCMCpack/MCMCpack_1.2-4.tar.gz";
> >
> >> install.packages(packageurl, type="source")
> >
> > Warning in install.packages :
> >
> >package
> > 'https://cran.r-project.org/src/contrib/Archive/MCMCpack/MCMCpack_1.
> > 2- 4.tar.gz' is not available (for R version 3.5.3)
> >
> >
> >
> > I realize that updating my R version to 3.6.1 could possibly solve the 
> > problem, but this would be impractical for me because my version needs to 
> > be consistent with others on my team. In any case, the fact that I am 
> > getting errors (detailed above) with *every* version of "MCMCpack" seems 
> > odd.
> >
> > Do you have any suggestions for how I can install a working version of 
> > "MCMCpack" for my version of R?
> >
> > Thank you,
> > Bill
> >
> >
> >
> >
> >
> >   [[alternative HTML version deleted]]
> >
> > __
> > R-help@r-project.org 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.
> >
>
>
> __
> R-help@r-project.

Re: [R] package MCMCpack

2019-12-04 Thread William Michels via R-help
Hi William,

It's not clear to me why you need this particular older version of
MCMCpack. From the archive I find MCMCpack_1.2-4 dates back to
2012-06-14, and MCMCpack_1.2-4.1 dates back to 2013-04-07:

MCMCpack_1.2-4.1.tar.gz 2013-04-07 00:05 481K
MCMCpack_1.2-4.tar.gz 2012-06-14 12:36 482K

Have you tried newer versions of MCMCpack? While the newest version of
MCMCpack (1.4-5) may require R (≥ 3.6), I have sessionInfo() logs
suggesting that MCMCpack_1.4-3 (2018-05-15 09:54 672K) ran just fine
under R version 3.3.3 (2017-03-06) -- "Another Canoe". In fact, an
archived version of the MCMCpack_1.4-3 DESCRIPTION_file indicates that
MCMCpack_1.4-3 only requires  R (>= 2.10.0).

Hope this helps,

Bill.

W. Michels, Ph.D.





On Wed, Dec 4, 2019 at 7:34 AM Prophet, William
 wrote:
>
> Yes, I should have mentioned that I tried this same line of code and I still 
> got an error.
>
>
> -Original Message-
> From: Duncan Murdoch 
> Sent: Wednesday, December 4, 2019 8:32 AM
> To: Prophet, William ; r-help@r-project.org
> Subject: Re: [R] package MCMCpack
>
> Sent by an external sender
>
> --
> On 04/12/2019 8:47 a.m., Prophet, William wrote:
> > I am running R on my work computer with the following parameters:
> >> sessionInfo()
> > R version 3.5.3 (2019-03-11)
> > Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows >= 8
> > x64 (build 9200)
> >
> >
> > I am trying to install the "MCMCpack" library. In the process however, I 
> > receive the message:
> >
> >> install.packages("MCMCpack")
> >
> > Warning in install.packages :
> >
> >package 'MCMCpack' is not available (for R version 3.5.3)
> >
> >
> > I have tried to install earlier versions of the "MCMCpack" library which I 
> > obtained from the following website:
> > https://cran.r-project.org/src/contrib/Archive/MCMCpack/
> >
> > using the following code:
> > packageurl <- 
> > "https://cran.r-project.org/src/contrib/Archive/MCMCpack/MCMCpack_1.2-4.tar.gz";
> > install.packages(packageurl, type="source")
>
> That's not the way to install a tarball.  You should use
>
> install.packages(packageurl, type="source", repos=NULL)
>
> However, you may still have problems:  when I tried that, the install failed 
> because of C++ errors.  I don't know if configure options (e.g.
> specifying a particular version of C++) would have fixed the problems.
>
> Duncan Murdoch
>
> >
> > but I get an identical error message:
> >
> >> packageurl <- 
> >> "https://cran.r-project.org/src/contrib/Archive/MCMCpack/MCMCpack_1.2-4.tar.gz";
> >
> >> install.packages(packageurl, type="source")
> >
> > Warning in install.packages :
> >
> >package
> > 'https://cran.r-project.org/src/contrib/Archive/MCMCpack/MCMCpack_1.2-
> > 4.tar.gz' is not available (for R version 3.5.3)
> >
> >
> >
> > I realize that updating my R version to 3.6.1 could possibly solve the 
> > problem, but this would be impractical for me because my version needs to 
> > be consistent with others on my team. In any case, the fact that I am 
> > getting errors (detailed above) with *every* version of "MCMCpack" seems 
> > odd.
> >
> > Do you have any suggestions for how I can install a working version of 
> > "MCMCpack" for my version of R?
> >
> > Thank you,
> > Bill
> >
> >
> >
> >
> >
> >   [[alternative HTML version deleted]]
> >
> > __
> > R-help@r-project.org 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.
> >
>
>
> __
> R-help@r-project.org 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.

__
R-help@r-project.org 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.


[R] Lapack routine dgesv: system is exactly singular

2019-12-04 Thread Ana Marija
Hello,

I am sorry for posting this question related to TWMR but it seems I
can nto proceed with this. Hopefully this post now will make sense.

So I am running this code:
https://github.com/eleporcu/TWMR/blob/master/MR.R

I made this change in code so that I can run it like this:
Rscript MR.R ENSG0154803

the change of the beginning of code is this:
cmd_args <- commandArgs(TRUE)
if (length(cmd_args) == 0L) stop("No arguments specified.")
print(cmd_args)
gene<-cmd_args[length(cmd_args)]   ## Last argument is the 'gene'
Ngwas<-239087
N_eQTLs<-32000
out<-c("gene","alpha","SE","P","Nsnps","Ngene")

file<-paste(gene,"matrix",sep=".")
if (!file.exists(file)) stop("File not found: ", file)
filecluster<-read.table(file,header=T,sep=" ",dec=".")
beta<-as.matrix(filecluster[,2:(length(filecluster[1,])-1)])

The error I am getting when I run the code with my data is:
[1] "ENSG0154803"
Error in solve.default(C) :
  Lapack routine dgesv: system is exactly singular: U[15,15] = 0
Calls: solve -> solve.default
Execution halted


I loaded my ENSG0154803.ld file in R as matrix (a) and:

library(matrixcalc)
is.singular.matrix(a, tol = 1e-08)
TRUE

Seems that my matrix is singular. What do you advice in this case?

Thanks
Ana

__
R-help@r-project.org 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.


Re: [R] Error related to matrix system is exactly singular

2019-12-04 Thread Jeff Newmiller
See below

On December 4, 2019 10:04:45 AM PST, Ana Marija  
wrote:
>Hello,

... removed for clarity

>
>Please advise, is it something wrong with the format of my files now?
>
>Thanks
>
>Ana
>
>   [[alternative HTML version deleted]]

... 

>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

You are sabatoging your own efforts to get help by repeatedly posting HTML- 
formatted email on a plain- text-only mailing list.

-- 
Sent from my phone. Please excuse my brevity.

__
R-help@r-project.org 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.


Re: [R] How to use preProcess in Caret?

2019-12-04 Thread William Michels via R-help
Hello,

Have you tried alternative methods of pre-processing your data, such
as simply calling scale()? What is the effect on convergence, for both
the caret package and and the neuralnet package? There's an example
using scale() with the neuralnet package at the link below:

https://datascienceplus.com/fitting-neural-network-in-r/

HTH, Bill.

W. Michels, Ph.D.



On Sun, Dec 1, 2019 at 10:04 AM Burak Kaymakci  wrote:
>
> Hello there,
>
> I am using caret and neuralnet to train a neural network to predict times
> table. I am using 'backprop' algorithm for neuralnet to experiment and
> learn.
>
> Before using caret, I've trained a neuralnet without using caret, I've
> normalized my input & outputs using preProcess with 'range' method. Then I
> predicted my test set, did the multiplication and addition on predictions
> to get the real values. It gave me good results.
>
> What I want to ask is, when I try to train my network using caret, I get an
> error saying algorithm did not converge. I am thinking that I might be
> doing something wrong with my pre-processing,
>
> How would I go about using preProcess in train?
> Do I pass my not-normalized data set to the train function and train
> function handles normalization internally?
>
> You can find my R gist here
> 
>
> Thank you,
> Burak
> __
> R-help@r-project.org 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.

__
R-help@r-project.org 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.


[R] Error related to matrix system is exactly singular

2019-12-04 Thread Ana Marija
Hello,

I was running this software https://github.com/eleporcu/TWMR
via:

Rscript MR.R ENSG0154803
my files are located here:
https://filebin.net/smt1kcw2d9sody67

I got this error:

[1] "ENSG0154803"
Error in solve.default(C) :
  Lapack routine dgesv: system is exactly singular: U[15,15] = 0
Calls: solve -> solve.default
Execution halted

in the original code I changed this:

and I also in order to run it I changed the beginning of the code to be:

cmd_args <- commandArgs(TRUE)if (length(cmd_args) == 0L) stop("No
arguments specified.")
print(cmd_args)
gene<-cmd_args[length(cmd_args)]   ## Last argument is the 'gene'
Ngwas<-239087
N_eQTLs<-32000
out<-c("gene","alpha","SE","P","Nsnps","Ngene")

file<-paste(gene,"matrix",sep=".")if (!file.exists(file)) stop("File
not found: ", file)
filecluster<-read.table(file,header=T,sep=" ",dec=".")
beta<-as.matrix(filecluster[,2:(length(filecluster[1,])-1)])

when I was running it with just 3 columns in .matrix file.

Please advise, is it something wrong with the format of my files now?

Thanks

Ana

[[alternative HTML version deleted]]

__
R-help@r-project.org 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.


Re: [R] Error in FUN(X[[i]], ...) : subscript out of bounds

2019-12-04 Thread William Dunlap via R-help
In your fit_bayes function, you have
   getTrainPerf(mod)[, "TrainRMSE"]
What are the column name of the output of getTrainPerf(mod)?
   print(colnames(getTrainPerf(mod)))
You can home in on the problem faster if you call
   traceback()
immediately after the error.

Bill Dunlap
TIBCO Software
wdunlap tibco.com


On Wed, Dec 4, 2019 at 3:38 AM Neha gupta  wrote:

> Hi , I know nobody will respond to my query as I asked few in the past and
> no answer received for any of my questions. However, I am asking here with
> the hope it will get responded.
>
> I am using bayesian optimization to tune the parameter of mtry for random
> forest but it gives me the error: Error in FUN(X[[i]], ...) : subscript out
> of bounds
>
> I am using the following code:
>
> fit_bayes <- function(mtry) {
>   ## Use the same model code but for a single (C, sigma) pair.
>   mod <- train(Effort ~ ., data = tr,
>method = "rf",
>preProc = c("center", "scale", "zv"),
>metric = "RMSE",
>trControl = ctrl,
>tuneGrid = data.frame(C = 10^(mtry)))
>
>   list(Score = -getTrainPerf(mod)[, "TrainRMSE"], Pred = 0)
> }
>
>
> library(rBayesianOptimization)
>
> bounds <- list(mtry = c(-2,  5)
>
>
> set.seed(8606)
> bo_search <- BayesianOptimization(fit_bayes,
>   bounds = bounds,
>   init_points = 10,
>   n_iter = 100,
>   acq = "ucb",
>   kappa = 1,
>   eps = 0.0)
> bo_search
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org 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.
>

[[alternative HTML version deleted]]

__
R-help@r-project.org 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.


Re: [R] package MCMCpack

2019-12-04 Thread Prophet, William
Yes, I should have mentioned that I tried this same line of code and I still 
got an error. 


-Original Message-
From: Duncan Murdoch  
Sent: Wednesday, December 4, 2019 8:32 AM
To: Prophet, William ; r-help@r-project.org
Subject: Re: [R] package MCMCpack

Sent by an external sender

--
On 04/12/2019 8:47 a.m., Prophet, William wrote:
> I am running R on my work computer with the following parameters:
>> sessionInfo()
> R version 3.5.3 (2019-03-11)
> Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows >= 8 
> x64 (build 9200)
>
>
> I am trying to install the "MCMCpack" library. In the process however, I 
> receive the message:
>
>> install.packages("MCMCpack")
>
> Warning in install.packages :
>
>package 'MCMCpack' is not available (for R version 3.5.3)
>
>
> I have tried to install earlier versions of the "MCMCpack" library which I 
> obtained from the following website:
> https://cran.r-project.org/src/contrib/Archive/MCMCpack/
>
> using the following code:
> packageurl <- 
> "https://cran.r-project.org/src/contrib/Archive/MCMCpack/MCMCpack_1.2-4.tar.gz";
> install.packages(packageurl, type="source")

That's not the way to install a tarball.  You should use

install.packages(packageurl, type="source", repos=NULL)

However, you may still have problems:  when I tried that, the install failed 
because of C++ errors.  I don't know if configure options (e.g.
specifying a particular version of C++) would have fixed the problems.

Duncan Murdoch

>
> but I get an identical error message:
>
>> packageurl <- 
>> "https://cran.r-project.org/src/contrib/Archive/MCMCpack/MCMCpack_1.2-4.tar.gz";
>
>> install.packages(packageurl, type="source")
>
> Warning in install.packages :
>
>package 
> 'https://cran.r-project.org/src/contrib/Archive/MCMCpack/MCMCpack_1.2-
> 4.tar.gz' is not available (for R version 3.5.3)
>
>
>
> I realize that updating my R version to 3.6.1 could possibly solve the 
> problem, but this would be impractical for me because my version needs to be 
> consistent with others on my team. In any case, the fact that I am getting 
> errors (detailed above) with *every* version of "MCMCpack" seems odd.
>
> Do you have any suggestions for how I can install a working version of 
> "MCMCpack" for my version of R?
>
> Thank you,
> Bill
>
>
>
>
>
>   [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org 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.
>


__
R-help@r-project.org 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.


Re: [R] package MCMCpack

2019-12-04 Thread Duncan Murdoch

On 04/12/2019 8:47 a.m., Prophet, William wrote:

I am running R on my work computer with the following parameters:

sessionInfo()

R version 3.5.3 (2019-03-11)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)


I am trying to install the "MCMCpack" library. In the process however, I 
receive the message:


install.packages("MCMCpack")


Warning in install.packages :

   package 'MCMCpack' is not available (for R version 3.5.3)


I have tried to install earlier versions of the "MCMCpack" library which I 
obtained from the following website:
https://cran.r-project.org/src/contrib/Archive/MCMCpack/

using the following code:
packageurl <- 
"https://cran.r-project.org/src/contrib/Archive/MCMCpack/MCMCpack_1.2-4.tar.gz";
install.packages(packageurl, type="source")


That's not the way to install a tarball.  You should use

install.packages(packageurl, type="source", repos=NULL)

However, you may still have problems:  when I tried that, the install 
failed because of C++ errors.  I don't know if configure options (e.g. 
specifying a particular version of C++) would have fixed the problems.


Duncan Murdoch



but I get an identical error message:


packageurl <- 
"https://cran.r-project.org/src/contrib/Archive/MCMCpack/MCMCpack_1.2-4.tar.gz";



install.packages(packageurl, type="source")


Warning in install.packages :

   package 
'https://cran.r-project.org/src/contrib/Archive/MCMCpack/MCMCpack_1.2-4.tar.gz' 
is not available (for R version 3.5.3)



I realize that updating my R version to 3.6.1 could possibly solve the problem, but this 
would be impractical for me because my version needs to be consistent with others on my 
team. In any case, the fact that I am getting errors (detailed above) with *every* 
version of "MCMCpack" seems odd.

Do you have any suggestions for how I can install a working version of 
"MCMCpack" for my version of R?

Thank you,
Bill





[[alternative HTML version deleted]]

__
R-help@r-project.org 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.



__
R-help@r-project.org 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.


[R] package MCMCpack

2019-12-04 Thread Prophet, William
I am running R on my work computer with the following parameters:
> sessionInfo()
R version 3.5.3 (2019-03-11)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)


I am trying to install the "MCMCpack" library. In the process however, I 
receive the message:

> install.packages("MCMCpack")

Warning in install.packages :

  package 'MCMCpack' is not available (for R version 3.5.3)


I have tried to install earlier versions of the "MCMCpack" library which I 
obtained from the following website:
https://cran.r-project.org/src/contrib/Archive/MCMCpack/

using the following code:
packageurl <- 
"https://cran.r-project.org/src/contrib/Archive/MCMCpack/MCMCpack_1.2-4.tar.gz";
install.packages(packageurl, type="source")

but I get an identical error message:

> packageurl <- 
> "https://cran.r-project.org/src/contrib/Archive/MCMCpack/MCMCpack_1.2-4.tar.gz";

> install.packages(packageurl, type="source")

Warning in install.packages :

  package 
'https://cran.r-project.org/src/contrib/Archive/MCMCpack/MCMCpack_1.2-4.tar.gz' 
is not available (for R version 3.5.3)



I realize that updating my R version to 3.6.1 could possibly solve the problem, 
but this would be impractical for me because my version needs to be consistent 
with others on my team. In any case, the fact that I am getting errors 
(detailed above) with *every* version of "MCMCpack" seems odd.

Do you have any suggestions for how I can install a working version of 
"MCMCpack" for my version of R?

Thank you,
Bill





[[alternative HTML version deleted]]

__
R-help@r-project.org 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.


[R] [R-pkgs] ropenblas package

2019-12-04 Thread Pedro Rafael
Dear colleagues,

The *ropenblas*  is a package designed
to facilitate the linking of the library *OpenBLAS*
 with the language *R*
. The package, which works only for Linux
systems, will automatically download the latest source code from the
*OpenBLAS*  library and compile the code. The
package will automatically bind the language *R*
 to use the *OpenBLAS*
 library. Everything will be done automatically
regardless of the Linux distribution you are using.

You can also specify older versions of the *OpenBLAS*
 library. Automatically, if no version is
specified, the *ropenblas*  package
will consider the latest version of the library *OpenBLAS*
.

Considering using the *OpenBLAS*  library rather
than the *BLAS*  may bring extra optimizations
for your code and improved computational performance for your simulations,
since *OpenBLAS*  is an optimized implementation
of the library *BLAS* .

Some of the reasons why it is convenient to link *R*
 language to the use of *BLAS*
 optimized alternatives can be found *here*
. Several other *benchmarks*
 that point to improved
computing performance by considering the library *OpenBLAS*
 can be found on the internet.

Best regards,

Pedro Rafael.

[[alternative HTML version deleted]]

___
R-packages mailing list
r-packa...@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-packages

__
R-help@r-project.org 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.


Re: [R] Error in FUN(X[[i]], ...) : subscript out of bounds

2019-12-04 Thread PIKAL Petr
Hi

I am pretty sure that nobody will be able to answer your question due to
lack of information. 

Missing parentheses  here
bounds <- list(mtry = c(-2,  5)

Use ?debug if the error is from your function. 
If the code is coppied from some help page, use the data from help page and
try to find differences in your data and help data.

Provide reproducible example 

I get this
Error in train(Effort ~ ., data = tr, method = "rf", preProc = c("center",
: 
  could not find function "train"
Timing stopped at: 0 0 0.01

with your code

Cheers
Petr

> -Original Message-
> From: R-help  On Behalf Of Neha gupta
> Sent: Wednesday, December 4, 2019 12:37 PM
> To: r-help@r-project.org
> Subject: [R] Error in FUN(X[[i]], ...) : subscript out of bounds
> 
> Hi , I know nobody will respond to my query as I asked few in the past and
> no answer received for any of my questions. However, I am asking here with
> the hope it will get responded.
> 
> I am using bayesian optimization to tune the parameter of mtry for random
> forest but it gives me the error: Error in FUN(X[[i]], ...) : subscript
out of
> bounds
> 
> I am using the following code:
> 
> fit_bayes <- function(mtry) {
>   ## Use the same model code but for a single (C, sigma) pair.
>   mod <- train(Effort ~ ., data = tr,
>method = "rf",
>preProc = c("center", "scale", "zv"),
>metric = "RMSE",
>trControl = ctrl,
>tuneGrid = data.frame(C = 10^(mtry)))
> 
>   list(Score = -getTrainPerf(mod)[, "TrainRMSE"], Pred = 0) }
> 
> 
> library(rBayesianOptimization)
> 
> bounds <- list(mtry = c(-2,  5)
> 
> 
> set.seed(8606)
> bo_search <- BayesianOptimization(fit_bayes,
>   bounds = bounds,
>   init_points = 10,
>   n_iter = 100,
>   acq = "ucb",
>   kappa = 1,
>   eps = 0.0) bo_search
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org 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.
__
R-help@r-project.org 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.


Re: [R] Two geom_bar with counts to put in the same plot

2019-12-04 Thread Francesca
Hi!
It is not exactly what I wanted but more than I suspected I could get.
Thanks a lot, this is awesome!
Francesca

On Wed, 4 Dec 2019 at 14:04, Rui Barradas  wrote:

> Hello,
>
> Please keep R-Help in the thread.
>
> As for the question, the following divides by facets, participation1/2
> with values 0/1. See if that's what you want.
>
>
> idv <- grep("part", names(DB)[-(3:4)], ignore.case = TRUE, value = TRUE)
> dblong <- reshape2::melt(DB[-(3:4)], id.vars = idv)
> dblong <- reshape2::melt(dblong, id.vars = c("variable", "value"))
> names(dblong) <- c("deltaVar", "delta", "participationVar",
> "participation")
> dblong <- dblong[complete.cases(dblong),]
>
> ggplot(dblong, aes(x = delta, fill = deltaVar)) +
>geom_density(aes(alpha = 0.2)) +
>scale_alpha_continuous(guide = "none") +
>facet_wrap(participationVar ~ participation)
>
>
> Hope this helps,
>
> Rui Barradas
>
> Às 08:25 de 04/12/19, Francesca escreveu:
> > Dear  Rui
> > the code works and the final picture is aesthetical as I wanted(very
> > beautiful indeed), but I probably did not explain that the two
> > distributions that I want to overlap, must be different by participation
> > 1 and participation 2, which are to dummy variables that identify :
> > Participation 1(equivalent to PARTICIPATIONNOPUN): 1 participants, 0 non
> > participants, for the variable delta11_L
> > Participation 2(equivalent to PARTICIPATIONPUN): 1 participants, 0 non
> > participants, for the variable delta2_L
> >
> > The density plots are four in the end rather than 2: I compare delta11_L
> > for Participants1 vsnon participants and delta2_L for Participants 2 vs
> > non Participants 2,
> > I basically want to verify whether the population of Participants vs Non
> > participants, change going from delta11_L to delta2_L
> >
> >
> > Sorry for being unclear.
> > Thanks for any help.
> > Francesca
> >
> > On Wed, 4 Dec 2019 at 09:16, Rui Barradas  > > wrote:
> >
> > Hello,
> >
> > Is it as simple as this? The code below does not separate the
> > participant1 and participant2, only the 'delta' variables.
> >
> >
> > idv <- grep("part", names(DB)[-(3:4)], ignore.case = TRUE, value =
> TRUE)
> > dblong <- reshape2::melt(DB[-(3:4)], id.vars = idv)
> > head(dblong)
> >
> > ggplot(dblong, aes(x = value, fill = variable)) +
> > geom_density(aes(alpha = 0.2)) +
> > scale_alpha_continuous(guide = "none")
> >
> >
> > I will also repost the data, since you have posted a matrix and this
> > code needs a data.frame.
> >
> >
> > DB <-
> > structure(list(participation1 = c(1, 1, 1, 1, 1, 1, 1, 1, 1,
> > 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
> > 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
> > 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1,
> > 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
> > 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
> > 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
> > 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
> > 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, NA,
> > NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
> > NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
> > NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA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2L, 2L, 2L,
> > 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L,
> > 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
> > 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 2L, 1L, 2L, 2L, 1L, 2L, 2L,
> > 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
> > 2L, 2L, 2L, 2L, 2L, 1L, 2L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
> > 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 

[R] Error in FUN(X[[i]], ...) : subscript out of bounds

2019-12-04 Thread Neha gupta
Hi , I know nobody will respond to my query as I asked few in the past and
no answer received for any of my questions. However, I am asking here with
the hope it will get responded.

I am using bayesian optimization to tune the parameter of mtry for random
forest but it gives me the error: Error in FUN(X[[i]], ...) : subscript out
of bounds

I am using the following code:

fit_bayes <- function(mtry) {
  ## Use the same model code but for a single (C, sigma) pair.
  mod <- train(Effort ~ ., data = tr,
   method = "rf",
   preProc = c("center", "scale", "zv"),
   metric = "RMSE",
   trControl = ctrl,
   tuneGrid = data.frame(C = 10^(mtry)))

  list(Score = -getTrainPerf(mod)[, "TrainRMSE"], Pred = 0)
}


library(rBayesianOptimization)

bounds <- list(mtry = c(-2,  5)


set.seed(8606)
bo_search <- BayesianOptimization(fit_bayes,
  bounds = bounds,
  init_points = 10,
  n_iter = 100,
  acq = "ucb",
  kappa = 1,
  eps = 0.0)
bo_search

[[alternative HTML version deleted]]

__
R-help@r-project.org 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.


Re: [R] Combining text files

2019-12-04 Thread Eric Berger
Continuing with Jeff's point: do you know for certain that the serial
number in row 5 of one file corresponds to the 'work order number' in row 5
of a different file?
Ideally this could be verified based on some sort of identifier that
appears as a column in both files and you could match up corresponding rows
in the two files by matching this identifier (or possibly multiple
identifiers.)
This type of matching is called a join and joins are supported in the dplyr
package (which also provides the bind_cols() function you referred to.)
Check out
?dplyr::join

HTH,
Eric



On Wed, Dec 4, 2019 at 7:55 AM Jeff Newmiller 
wrote:

> Do you know for certain that the rows are in the same order? then yes...
> cbind or bind_cols would do it. I would be surprised to find such files...
> but it is possible.
>
> On December 3, 2019 9:37:34 PM PST, Thomas Subia via R-help <
> r-help@r-project.org> wrote:
> >Colleagues,
> >I've got several text files which contain data for each metric I need
> >to report on.One text file contains the serial number data. Another has
> >customer and work order number. Another has test data. All text files
> >have the same number of rows but all have different numbers of columns.
> >
> >I was thinking about using bind_cols() to do this.
> >
> >Am I on the right track here?
> >All the best,
> >Thomas SubiaStatistician / Sr. Quality EngineerIMG Precision Inc.
> >
> >   [[alternative HTML version deleted]]
> >
> >__
> >R-help@r-project.org 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.
>
> --
> Sent from my phone. Please excuse my brevity.
>
> __
> R-help@r-project.org 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.
>

[[alternative HTML version deleted]]

__
R-help@r-project.org 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.


Re: [R] Two geom_bar with counts to put in the same plot

2019-12-04 Thread Rui Barradas

Hello,

Is it as simple as this? The code below does not separate the 
participant1 and participant2, only the 'delta' variables.



idv <- grep("part", names(DB)[-(3:4)], ignore.case = TRUE, value = TRUE)
dblong <- reshape2::melt(DB[-(3:4)], id.vars = idv)
head(dblong)

ggplot(dblong, aes(x = value, fill = variable)) +
  geom_density(aes(alpha = 0.2)) +
  scale_alpha_continuous(guide = "none")


I will also repost the data, since you have posted a matrix and this 
code needs a data.frame.



DB <-
structure(list(participation1 = c(1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0,
1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), participation2 = c(1,
1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1,
0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2L, 2L, 2L, 2L, 2L, 1L, 2L, 2L, 2L,
2L, 2L, 2L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 1L, 2L, 2L, 2L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 2L, 2L,
1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 2L, 2L, 2L, 1L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L), .Label = c("1", "2"), class = "factor"),
delta11_L = c(0, -10, -10, 0, 0, 0, -30, 0, 10, 0, 20, 10,
0, 0, 20, 0, 0, -10, 30, 10, 0, 0, 0, 0, 10, 0, 0, 0, 0,
0, 0, 0, 0, -10, 0, 0, 0, 40, -10, 0, 10, 0, 10, 0, -20,
0, 0, 0, 10, -20, 10, -10, 40, -10, -10, 10, 20, 10, 0, 0,
0, 0, 0, 0, -10, 0, 0, 20, 0, 0, 0, 0, 10, 0, 0, 0, 10, 0,
-10, 10, 0, 0, 10, 10, 10, 0, 0, 0, 0, 0, -10, 0, 0, 0, 20,
0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 10, 0, 10, 0, 0, 0, 20, -20,
0, 0, -10, 0, 0, 0, 0, -10, 10, 0, 20, 0, 0, 0, 0, 0, -10,
0, 0, 0, 0, 0, -10, 0, 0, -10, 0, -10, 30, -10, 0, 0, 10,
-10, 0, -10, -10, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0,
10, 10, 0, 0, -20, -10, 0, 0, 0, 0, 0, 0, 10, 30, 40, 30,
30, 30, 30, 20, 20, 40, 20, 20, 10, 20, 30, 20, 40, 20, 30,
20, 30, 20, 20, 30, 20, 40, 10, 20, 10, 30, 30, 30, 30, 10,
30, 30, 20, 10, 40, 30, 40, 40, 30, 20,