Re: [R] Weird (wrong?) result for fft

2021-03-22 Thread Jiefei Wang
Hi Filippo,

Why do you expect these two expressions to produce the same output?
Especially the second expression contains the first expression. There is no
way to have the same result unless the function "fft( * , inverse = TRUE)"
does nothing but multiplies the input by the input's length. It does not
make any sense.

Actually, both results are correct as Jeff said. The first is the result of
discrete Fourier transform and the second is the reverse of the transform.
That's why the second output is the same as your variable "x". There are
some rounding errors in the computation so you might get very
small imaginary numbers after doing the reverse transformation. That's why
you see "0i" in the second output.

Best,
Jiefei

On Tue, Mar 23, 2021 at 12:17 AM Filippo Monari  wrote:

> Hi all,
>
> I am plying around with fft function from the stats package.
> Running the example that is listed in the documentation:
>
> x <- 1:4
> fft(x) #output 1
> fft(fft(x), inverse = TRUE)/length(x) #output 2
>
> I was expecting that output 1 and two were the same but I get:
>
> > fft(x)
> [1] 10+0i -2+2i -2+0i -2-2i
>
> > ft(fft(x), inverse = TRUE)/length(x)
> [1] 1+0i 2+0i 3+0i 4+0i
>
> Am I doing something wrong or is there a bug somewhere?
>
> Regards,
> Filippo
>
> [[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] Can't save files from the Source pane of R Studio

2021-03-22 Thread Bert Gunter
... and moreover, the R Foundation that maintains and releases updates of R
software(open source licensed, free) is a totally separate, non-profit
entity from the RStudio organization, a for profit-company that has built a
support/data science infrastructure based on R(some of which is free and
some of which they charge for).

(Don't feel bad: this is a regular source of confusion on this forum).

Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Mon, Mar 22, 2021 at 11:58 AM Rui Barradas  wrote:

> Hello,
>
> R-Help is for questions on R code.
> RStudio has its own help forum that you can access from the Help menu,
>
> Help > RStudio Community Forum
>
> Hope this helps,
>
> Rui Barradas
>
> Às 18:07 de 22/03/21, Parkhurst, David escreveu:
> > I�m just starting to learn and use R Studio in my Mac.  Now I find if I
> type lines in what I think is called the source pane, and use Save as from
> the menu, nothing gets saved.  That�s true if I add the extension .R or the
> extension .txt.  If I try reopen the file in an empty source pane, it�s
> empty.  And even if I open the file in a text editor, it�s blank.  How can
> I save my work from R Studio?
> >
> >   [[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.
>

[[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] Can't save files from the Source pane of R Studio

2021-03-22 Thread John Kane
Rui is correct but you should also check that you have write--permission to
the directory you are accessing

On Mon, 22 Mar 2021 at 14:28, Parkhurst, David  wrote:

> I’m just starting to learn and use R Studio in my Mac.  Now I find if I
> type lines in what I think is called the source pane, and use Save as from
> the menu, nothing gets saved.  That’s true if I add the extension .R or the
> extension .txt.  If I try reopen the file in an empty source pane, it’s
> empty.  And even if I open the file in a text editor, it’s blank.  How can
> I save my work from R Studio?
>
> [[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.
>


-- 
John Kane
Kingston ON Canada

[[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] Can't save files from the Source pane of R Studio

2021-03-22 Thread Rui Barradas

Hello,

R-Help is for questions on R code.
RStudio has its own help forum that you can access from the Help menu,

Help > RStudio Community Forum

Hope this helps,

Rui Barradas

Às 18:07 de 22/03/21, Parkhurst, David escreveu:

I�m just starting to learn and use R Studio in my Mac.  Now I find if I type 
lines in what I think is called the source pane, and use Save as from the menu, 
nothing gets saved.  That�s true if I add the extension .R or the extension 
.txt.  If I try reopen the file in an empty source pane, it�s empty.  And even 
if I open the file in a text editor, it�s blank.  How can I save my work from R 
Studio?

[[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] Can't save files from the Source pane of R Studio

2021-03-22 Thread Parkhurst, David
I�m just starting to learn and use R Studio in my Mac.  Now I find if I type 
lines in what I think is called the source pane, and use Save as from the menu, 
nothing gets saved.  That�s true if I add the extension .R or the extension 
.txt.  If I try reopen the file in an empty source pane, it�s empty.  And even 
if I open the file in a text editor, it�s blank.  How can I save my work from R 
Studio?

[[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] Thank you 4 Davide

2021-03-22 Thread David Winsemius



On 3/22/21 8:24 AM, francesca brun via R-help wrote:

Hello,
The problem was that version 4.0.4 did not support the package so I tried with 
several old versions until 3.6.2 installs both climtrend and Rcmdr with its 
graphical interface !! solved and thanks again Davide !!Francesca



I'm glad you got success.

However, for anyone viewing this I must note that the proper name of the 
package is 'climtrends'. I'm not sure that you  ever spelled it 
correctly in your two postings to rhelp. R users will get little system 
help for poorly spelled package names. There is some hinting that occurs 
when using Rstudio, but that will only occur for packages that are 
already installed on one's system.



--

David.


(from Italy)


[[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] [Rd] R 4.0.5 scheduled for March 31

2021-03-22 Thread Peter Dalgaard via R-help
Full schedule is available on https://developer.r-project.org (or 
https://svn.r-project.org/R-dev-web/trunk/index.html for the impatient).

(This is a fast-track release, to resolve an issue with Asian character sets 
and another issue with R CMD build, before R 4.1.0)

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd@cbs.dk  Priv: pda...@gmail.com

__
r-de...@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

___
r-annou...@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-announce

__
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] Thank you 4 Davide

2021-03-22 Thread francesca brun via R-help
Hello,
The problem was that version 4.0.4 did not support the package so I tried with 
several old versions until 3.6.2 installs both climtrend and Rcmdr with its 
graphical interface !! solved and thanks again Davide !!Francesca
(from Italy)


[[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] Weird (wrong?) result for fft

2021-03-22 Thread Jeff Newmiller
Neither. The discrete Fourier transform is a complex number operation. R-help 
is per the Posting Guide not an appropriate place to discuss theory in depth, 
and there is plenty of theory in this question and practically no R, but you 
can examine your result more closely with the functions described in ?complex.

On March 22, 2021 9:17:11 AM PDT, Filippo Monari  wrote:
>Hi all,
>
>I am plying around with fft function from the stats package.
>Running the example that is listed in the documentation:
>
>x <- 1:4
>fft(x) #output 1
>fft(fft(x), inverse = TRUE)/length(x) #output 2
>
>I was expecting that output 1 and two were the same but I get:
>
>> fft(x)
>[1] 10+0i -2+2i -2+0i -2-2i
>
>> ft(fft(x), inverse = TRUE)/length(x)
>[1] 1+0i 2+0i 3+0i 4+0i
>
>Am I doing something wrong or is there a bug somewhere?
>
>Regards,
>Filippo
>
>   [[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.


[R] Weird (wrong?) result for fft

2021-03-22 Thread Filippo Monari
Hi all,

I am plying around with fft function from the stats package.
Running the example that is listed in the documentation:

x <- 1:4
fft(x) #output 1
fft(fft(x), inverse = TRUE)/length(x) #output 2

I was expecting that output 1 and two were the same but I get:

> fft(x)
[1] 10+0i -2+2i -2+0i -2-2i

> ft(fft(x), inverse = TRUE)/length(x)
[1] 1+0i 2+0i 3+0i 4+0i

Am I doing something wrong or is there a bug somewhere?

Regards,
Filippo

[[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] Ellipses in factor analysis

2021-03-22 Thread Mahmood Naderan-Tahan
Hi

In the example shown in [1], there is command that adds ellipses in the 
individual map.


fviz_mfa_ind(res.famd,
 habillage = "Label", # color by groups
 palette = c("#00AFBB", "#E7B800", "#FC4E07"),
 addEllipses = TRUE, ellipse.type = "confidence",
 repel = TRUE # Avoid text overlapping
 )

Where can I find more information about what is that ellipse exactly and how 
that is defined? For example, in the at figure, I don't know why 1VAU which is 
in red, is not in the red ellipse. Any note about that?



[1] 
http://www.sthda.com/english/articles/31-principal-component-methods-in-r-practical-guide/115-famd-factor-analysis-of-mixed-data-in-r-essentials/


Regards,
Mahmood

[[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] Help Package 'CLIMTRENDS' from Archive

2021-03-22 Thread David Winsemius



> On Mar 22, 2021, at 4:54 AM, francesca brun via R-help  
> wrote:
> 
> Hello,
> I need to run the 'climtrend' library

It's a package, not a library. Libraries are directory locations and typically 
hold multiple packages.

> which is no longer available, I downloaded and installed it from the archive 
> on my pc but it doesn't work, it says "I can't find the function ..." what 
> should I do? I absolutely need to use it, in addition to installing it, what 
> should I do to use it?
> thank you in advance for your kindness,

If earlier you got a message telling you of successful installation, then the 
most likely error is failure to execute code that loads the packages contents 
into your R workspace. 

library(climtrends) # needs to be done before you will see functions from it in 
you console session.

Of course, it's always possible you misspelled the function name. I see that 
the package uses a lot of camelCase names and R does NOT allow errors in 
spelling (such as your spelling of the package names as CLIMTRENDS. )

On a mac running R 3.6 I got no error installing from source. It did not 
require compiler tools.

-- 
David.

> Francesca
> __
> 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] Rstudio crashed when I try to train a nnet model.

2021-03-22 Thread Duncan Murdoch

On 22/03/2021 8:39 a.m., Jiefei Wang wrote:

Hi Baki,

The crash is very likely due to the bug in nnet. If this is the case, there
is almost nothing you can do. I think you only need to wait for the
response from the package maintainer. You can send your data to the
maintainer and help them to debug the issue.


"Almost nothing"?  Helping to debug the problem would almost certainly 
be a welcome contribution.  If you can reproduce it while running under 
a debugger that would locate the issue, and then Prof Ripley would 
probably be able to fix it easily.


How to do that?  It's a bit easier on other systems than on Windows, but 
it's not very hard in either place.  The steps are:


 Figure out which debugger works on your system.  On macOS, it's lldb; 
I think other systems use gdb (but check the Admin manual, as I could be 
wrong).  macOS also needs a special build of R to allow debugging; see 
the "R for Mac OS X FAQ" question 10.17 for details on how to get it.


 Make sure nnet is built with debugging info.  This is automatic on 
non-Windows systems.  On Windows, reinstall it from source using R command


   install.packages("nnet", type = "source", INSTALL_opts = "--debug")

Run R under the debugger.  On Unix-alikes you start it using

  R -d lldb

or

  R -d gdb

depending on which debugger you're using.  On Windows, I think it's 
usually easiest to start R normally, then start the debugger separately 
and attach it to the R process; if you can't figure out how to do that, 
ask and someone will tell you the details, which I forget.


If R is not running, type "run" in the debugger to start it, and go 
through the process to trigger the crash.  The debugger will print very 
useful information at that point, which will likely suggest exactly what 
went wrong.  Post that here, or send it to Prof Ripley.


Duncan Murdoch



Best,
Jiefei

On Mon, Mar 22, 2021 at 8:20 PM Baki UNAL  wrote:


Hi,

I tried to run the code in another computer in RGui. This time program run
until final iteration. But after the last iteration RGui quit without any
error code. I mailed this issue to Brian Ripley who is the maintainer of
R nnet package. What can I do to solve this problem?

Best regards
Baki

On Monday, March 22, 2021, 06:55:00 AM GMT+3, Jiefei Wang <
szwj...@gmail.com> wrote:


Hi Baki,

This should be a different issue. It looks like there is no problem in the
R terminal. Does the crash happen every time when you run the code in
RStudio? If so, this should be a bug in RStudio and you need to consult
RStudio's mailing list as R and RStudio are maintained by different teams.

Best,
Jiefei

On Mon, Mar 22, 2021 at 12:57 AM Baki UNAL  wrote:

Hi Jiefei

I run the code below in RGui


nn2 <- nnet(TQ~.,data = train, size=c(15,15), linout=T, MaxNWts =4000,

maxit=2000)

But I got the following output:

# weights:  435
initial  value 55650.887782
final  value 55650.887782
converged

Program early converged. Program didn't any calculations.

Best,
Baki

On Sunday, March 21, 2021, 07:35:31 PM GMT+3, Jiefei Wang <
szwj...@gmail.com> wrote:


Hi Baki,

Perhaps out of memory? Would you be able to run your code through the R
terminal? It probably can give us more information to debug the issue.

Best,
Jiefei

On Mon, Mar 22, 2021 at 12:23 AM Baki UNAL via R-help <
r-help@r-project.org> wrote:

Hi,
I tried to train a neural network with following code:
nn2 <- nnet(TQ~.,data = train, size=c(15,15), linout=T, MaxNWts =4000,
maxit=2000)

When I executed the code R studio crashed with following error:
"R Session Aborted
R encountered a fatal error.
The session was terminated.
Start new session"
When I set the hidden layer as c(15) as below the code works fine.
nn2 <- nnet(TQ~.,data = train, size=c(15), linout=T, MaxNWts =4000,
maxit=2000)

What could be the problem?

Best regards.


 [[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.



__
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 Package 'CLIMTRENDS' from Archive

2021-03-22 Thread francesca brun via R-help
Hello,
I need to run the 'climtrend' library which is no longer available, I 
downloaded and installed it from the archive on my pc but it doesn't work, it 
says "I can't find the function ..." what should I do? I absolutely need to use 
it, in addition to installing it, what should I do to use it?
thank you in advance for your kindness,
Regards
Francesca
__
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] Rstudio crashed when I try to train a nnet model.

2021-03-22 Thread Jiefei Wang
Hi Baki,

The crash is very likely due to the bug in nnet. If this is the case, there
is almost nothing you can do. I think you only need to wait for the
response from the package maintainer. You can send your data to the
maintainer and help them to debug the issue.

Best,
Jiefei

On Mon, Mar 22, 2021 at 8:20 PM Baki UNAL  wrote:

> Hi,
>
> I tried to run the code in another computer in RGui. This time program run
> until final iteration. But after the last iteration RGui quit without any
> error code. I mailed this issue to Brian Ripley who is the maintainer of
> R nnet package. What can I do to solve this problem?
>
> Best regards
> Baki
>
> On Monday, March 22, 2021, 06:55:00 AM GMT+3, Jiefei Wang <
> szwj...@gmail.com> wrote:
>
>
> Hi Baki,
>
> This should be a different issue. It looks like there is no problem in the
> R terminal. Does the crash happen every time when you run the code in
> RStudio? If so, this should be a bug in RStudio and you need to consult
> RStudio's mailing list as R and RStudio are maintained by different teams.
>
> Best,
> Jiefei
>
> On Mon, Mar 22, 2021 at 12:57 AM Baki UNAL  wrote:
>
> Hi Jiefei
>
> I run the code below in RGui
>
> > nn2 <- nnet(TQ~.,data = train, size=c(15,15), linout=T, MaxNWts =4000,
> maxit=2000)
>
> But I got the following output:
>
> # weights:  435
> initial  value 55650.887782
> final  value 55650.887782
> converged
>
> Program early converged. Program didn't any calculations.
>
> Best,
> Baki
>
> On Sunday, March 21, 2021, 07:35:31 PM GMT+3, Jiefei Wang <
> szwj...@gmail.com> wrote:
>
>
> Hi Baki,
>
> Perhaps out of memory? Would you be able to run your code through the R
> terminal? It probably can give us more information to debug the issue.
>
> Best,
> Jiefei
>
> On Mon, Mar 22, 2021 at 12:23 AM Baki UNAL via R-help <
> r-help@r-project.org> wrote:
>
> Hi,
> I tried to train a neural network with following code:
> nn2 <- nnet(TQ~.,data = train, size=c(15,15), linout=T, MaxNWts =4000,
> maxit=2000)
>
> When I executed the code R studio crashed with following error:
> "R Session Aborted
> R encountered a fatal error.
> The session was terminated.
> Start new session"
> When I set the hidden layer as c(15) as below the code works fine.
> nn2 <- nnet(TQ~.,data = train, size=c(15), linout=T, MaxNWts =4000,
> maxit=2000)
>
> What could be the problem?
>
> Best regards.
>
>
> [[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] Rstudio crashed when I try to train a nnet model.

2021-03-22 Thread Baki UNAL via R-help
 Hi,
I tried to run the code in another computer in RGui. This time program run 
until final iteration. But after the last iteration RGui quit without any error 
code. I mailed this issue to Brian Ripley who is the maintainer of R nnet 
package. What can I do to solve this problem?
Best regardsBaki
On Monday, March 22, 2021, 06:55:00 AM GMT+3, Jiefei Wang 
 wrote:  
 
 Hi Baki,
This should be a different issue. It looks like there is no problem in the R 
terminal. Does the crash happen every time when you run the code in RStudio? If 
so, this should be a bug in RStudio and you need to consult RStudio's mailing 
list as R and RStudio are maintained by different teams.
Best,Jiefei
On Mon, Mar 22, 2021 at 12:57 AM Baki UNAL  wrote:

 Hi Jiefei
I run the code below in RGui
> nn2 <- nnet(TQ~.,data = train, size=c(15,15), linout=T, MaxNWts =4000, 
> maxit=2000)

But I got the following output:
# weights:  435initial  value 55650.887782 final  value 55650.887782 converged
Program early converged. Program didn't any calculations. 
Best,Baki
On Sunday, March 21, 2021, 07:35:31 PM GMT+3, Jiefei Wang 
 wrote:  
 
 Hi Baki,
Perhaps out of memory? Would you be able to run your code through the R 
terminal? It probably can give us more information to debug the issue. 
Best,Jiefei
On Mon, Mar 22, 2021 at 12:23 AM Baki UNAL via R-help  
wrote:

Hi,
I tried to train a neural network with following code:
nn2 <- nnet(TQ~.,data = train, size=c(15,15), linout=T, MaxNWts =4000, 
maxit=2000)

When I executed the code R studio crashed with following error:
"R Session Aborted
R encountered a fatal error.
The session was terminated.
Start new session"
When I set the hidden layer as c(15) as below the code works fine.
nn2 <- nnet(TQ~.,data = train, size=c(15), linout=T, MaxNWts =4000, maxit=2000)

What could be the problem?

Best regards.


        [[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] forest plot -metafor package

2021-03-22 Thread Viechtbauer, Wolfgang (SP)
Dear Usmle Ck,

This is what the 'slab' argument is for (for adding 'study labels'). For an 
example, see:

https://www.metafor-project.org/doku.php/plots:forest_plot

Best,
Wolfgang

>-Original Message-
>From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Usmle Ck
>Sent: Monday, 22 March, 2021 7:59
>To: r-help@r-project.org
>Subject: [R] forest plot -metafor package
>
>*I am performing a meta-analysis using the metafor package. My data are
>**proportions and I used the Freeman Tukey double arcine (FT)**
>transformation to fit the random effects model. To create a **forest
>plot with my estimates backtransformed to the original scale of
>**proportions i found this post which helped alot>*
>
>https://stat.ethz.ch/pipermail/r-help/2010-December/263286.html
>
>*but i still cant enter the study names/authors to the forest plot?
>can you help *
>
>*thanks in advance*

__
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-es] semana

2021-03-22 Thread Javier Marcuzzi
Estimado José

Hay un problema de interpretación, y estas interpretaciones dan distintas
soluciones. Lo más simple, los 365 días / 7, y los agrupé, pero también
puede ser semana del calendario, ubicando todos los días y sus casos, o
semana del mes, o primer, segunda, tercera semana anual. Todos los
lenguajes informáticos que yo conozco tienen algo para las fechas, y las
fechas expresadas en días, en semanas, en distintas formas. Habría que ver
que es semana para su caso particular y a partir de su necesitad buscar la
alternativa en R. En mi caso particular, prefiero todo en fecha UNIX y
luego divido o agrupo en año, mes, etc.

Javier Rubén Marcuzzi

El lun, 22 mar 2021 a las 8:06, Francisco Rodríguez ()
escribió:

> Como objeto xts se puede resolver, un saludo
>
> 
> De: R-help-es  en nombre de Jose
> Betancourt Bethencourt 
> Enviado: lunes, 22 de marzo de 2021 11:51
> Para: Emilio L. Cano 
> Cc: r-help-es 
> Asunto: Re: [R-es] semana
>
> EStimados
>
> Perdonen pero no logro resolver el problema
>
> Se trata de una serie de tiempo de casos diarios que quiero llevar
> semanales
>
>
> 2021-01-5 2021-01-6 2021-01-0 2021-01-1 2021-01-2
>111625 611
> 2021-01-3 2021-01-4 2021-01-5 2021-01-6 2021-01-0
>25 81221 9
> 2021-01-1 2021-01-2 2021-01-3 2021-01-4 2021-01-5
>2331141143
> 2021-01-6 2021-01-0 2021-01-1 2021-01-2 2021-01-3
> 6 3 4 1 4
> 2021-01-4 2021-01-5 2021-01-6 2021-01-0 2021-01-1
> 323 51543
> 2021-01-2 2021-01-3 2021-01-4 2021-01-5 2021-01-6
>1010 01817
> 2021-01-0 2021-02-1 2021-02-2 2021-02-3 2021-02-4
>33 015 011
> 2021-02-5 2021-02-6 2021-02-0 2021-02-1 2021-02-2
>191618 123
> 2021-02-3 2021-02-4 2021-02-5 2021-02-6 2021-02-0
>1116262143
> 2021-02-1 2021-02-2 2021-02-3 2021-02-4 2021-02-5
>3120402328
> 2021-02-6 2021-02-0 2021-02-1 2021-02-2 2021-02-3
>4549304141
> 2021-02-4 2021-02-5 2021-02-6 2021-02-0 2021-03-1
>8455876068
> 2021-03-2 2021-03-3 2021-03-4 2021-03-5 2021-03-6
>4263443749
> 2021-03-0 2021-03-1 2021-03-2
>414342
>
>
> El 20/3/21, Emilio L. Cano  escribió:
> > Supongo que jose, después de calcular la semana, querrá sumar los datos
> por
> > semana. Si hay datos de más de un año, necesitará una columna año-semana,
> > algo así:
> >
> > Datos %>%
> >   mutate(semana = format(as.Date(fecha), “%Y-%V”) %>%
> >   group_by (semana) %>%
> >   summarise(total semana = sum(variable)
> >
> > Lógicamente, usando los nombres de data frame y variables que
> correspondan.
> >
> > Un saludo,
> > Emilio
> >
> >
> >
> >
> >
> >> El 20 mar 2021, a las 15:18, Carlos Ortega 
> >> escribió:
> >>
> >> Hola,
> >>
> >> ¿Te refieres a encontrar la semana a la que pertenece un día?
> >>
> >> #
> >>> library(lubridate)
> >>
> >> Attaching package: ‘lubridate’
> >>
> >> The following objects are masked from ‘package:base’:
> >>
> >>date, intersect, setdiff, union
> >>
> >>> x <- ymd("2012-03-26")
> >>> week(x)
> >> [1] 13
> >> #
> >>
> >> Gracias,
> >> Carlos.
> >>
> >> El sáb, 20 mar 2021 a las 13:50, Jose Betancourt Bethencourt (<
> >> betans...@gmail.com>) escribió:
> >>
> >>> Estimados
> >>> como convertir una columna de datos diarios a semanales?
> >>> saludos
> >>> --
> >>> Dr. Jose A. Betancourt Bethencourt
> >>> Universidad de Ciencias Medicas Carlos j. Finlay
> >>>
> >>> ___
> >>> R-help-es mailing list
> >>> R-help-es@r-project.org
> >>> https://stat.ethz.ch/mailman/listinfo/r-help-es
> >>>
> >>
> >>
> >> --
> >> Saludos,
> >> Carlos Ortega
> >> www.qualityexcellence.es
> >>
> >>   [[alternative HTML version deleted]]
> >>
> >> ___
> >> R-help-es mailing list
> >> R-help-es@r-project.org
> >> https://stat.ethz.ch/mailman/listinfo/r-help-es
> >
> >
>
>
> --
> Dr. Jose A. Betancourt Bethencourt
> Universidad de Ciencias Medicas Carlos j. Finlay
>
> ___
> R-help-es mailing list
> R-help-es@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-help-es
>
> [[alternative HTML version deleted]]
>
> ___
> R-help-es mailing list
> R-help-es@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-help-es
>

[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org

[R] [R-pkgs] CRAN new release: meedr package provides access to Central Bank of Brazil API

2021-03-22 Thread Fernando da Silva
Hello everyone,

Very happy to announce my first release on CRAN: *meedr. *The goal is to
provide quick and easy access to market expectations data to the main
macroeconomic indicators in the Focus report, made available by the Central
Bank of Brazil through the Expectations System data API. This data comes
from several financial institutions, such as: banks, brokers, funds,
consultancies, etc.

The *meedr* package offers an R interface to the API and other advantages:

   - Use of a caching system with package memoise to speed up repeated
   requests of data;
   - User can utilize all cores of the machine (parallel computing) when
   fetching a large batch of time series.


You can install the released version of meedr from CRAN with:
*install.packages("meedr")*

Best regards,

*Fernando da Silva*
Economist
E-mail: ferna...@fortietwo.com
Website: www.fortietwo.com

[[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.


[R] forest plot -metafor package

2021-03-22 Thread Usmle Ck
*I am performing a meta-analysis using the metafor package. My data are
**proportions and I used the Freeman Tukey double arcine (FT)**
transformation to fit the random effects model. To create a **forest
plot with my estimates backtransformed to the original scale of
**proportions i found this post which helped alot>*

https://stat.ethz.ch/pipermail/r-help/2010-December/263286.html

*but i still cant enter the study names/authors to the forest plot?
can you help *


*thanks in advance*

[[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-es] semana

2021-03-22 Thread Francisco Rodríguez
Como objeto xts se puede resolver, un saludo


De: R-help-es  en nombre de Jose Betancourt 
Bethencourt 
Enviado: lunes, 22 de marzo de 2021 11:51
Para: Emilio L. Cano 
Cc: r-help-es 
Asunto: Re: [R-es] semana

EStimados

Perdonen pero no logro resolver el problema

Se trata de una serie de tiempo de casos diarios que quiero llevar  semanales


2021-01-5 2021-01-6 2021-01-0 2021-01-1 2021-01-2
   111625 611
2021-01-3 2021-01-4 2021-01-5 2021-01-6 2021-01-0
   25 81221 9
2021-01-1 2021-01-2 2021-01-3 2021-01-4 2021-01-5
   2331141143
2021-01-6 2021-01-0 2021-01-1 2021-01-2 2021-01-3
6 3 4 1 4
2021-01-4 2021-01-5 2021-01-6 2021-01-0 2021-01-1
323 51543
2021-01-2 2021-01-3 2021-01-4 2021-01-5 2021-01-6
   1010 01817
2021-01-0 2021-02-1 2021-02-2 2021-02-3 2021-02-4
   33 015 011
2021-02-5 2021-02-6 2021-02-0 2021-02-1 2021-02-2
   191618 123
2021-02-3 2021-02-4 2021-02-5 2021-02-6 2021-02-0
   1116262143
2021-02-1 2021-02-2 2021-02-3 2021-02-4 2021-02-5
   3120402328
2021-02-6 2021-02-0 2021-02-1 2021-02-2 2021-02-3
   4549304141
2021-02-4 2021-02-5 2021-02-6 2021-02-0 2021-03-1
   8455876068
2021-03-2 2021-03-3 2021-03-4 2021-03-5 2021-03-6
   4263443749
2021-03-0 2021-03-1 2021-03-2
   414342


El 20/3/21, Emilio L. Cano  escribi�:
> Supongo que jose, despu�s de calcular la semana, querr� sumar los datos por
> semana. Si hay datos de m�s de un a�o, necesitar� una columna a�o-semana,
> algo as�:
>
> Datos %>%
>   mutate(semana = format(as.Date(fecha), �%Y-%V�) %>%
>   group_by (semana) %>%
>   summarise(total semana = sum(variable)
>
> L�gicamente, usando los nombres de data frame y variables que correspondan.
>
> Un saludo,
> Emilio
>
>
>
>
>
>> El 20 mar 2021, a las 15:18, Carlos Ortega 
>> escribi�:
>>
>> Hola,
>>
>> �Te refieres a encontrar la semana a la que pertenece un d�a?
>>
>> #
>>> library(lubridate)
>>
>> Attaching package: �lubridate�
>>
>> The following objects are masked from �package:base�:
>>
>>date, intersect, setdiff, union
>>
>>> x <- ymd("2012-03-26")
>>> week(x)
>> [1] 13
>> #
>>
>> Gracias,
>> Carlos.
>>
>> El s�b, 20 mar 2021 a las 13:50, Jose Betancourt Bethencourt (<
>> betans...@gmail.com>) escribi�:
>>
>>> Estimados
>>> como convertir una columna de datos diarios a semanales?
>>> saludos
>>> --
>>> Dr. Jose A. Betancourt Bethencourt
>>> Universidad de Ciencias Medicas Carlos j. Finlay
>>>
>>> ___
>>> R-help-es mailing list
>>> R-help-es@r-project.org
>>> https://stat.ethz.ch/mailman/listinfo/r-help-es
>>>
>>
>>
>> --
>> Saludos,
>> Carlos Ortega
>> www.qualityexcellence.es
>>
>>   [[alternative HTML version deleted]]
>>
>> ___
>> R-help-es mailing list
>> R-help-es@r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-help-es
>
>


--
Dr. Jose A. Betancourt Bethencourt
Universidad de Ciencias Medicas Carlos j. Finlay

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

[[alternative HTML version deleted]]

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


Re: [R-es] semana

2021-03-22 Thread Jose Betancourt Bethencourt
EStimados

Perdonen pero no logro resolver el problema

Se trata de una serie de tiempo de casos diarios que quiero llevar  semanales


2021-01-5 2021-01-6 2021-01-0 2021-01-1 2021-01-2
   111625 611
2021-01-3 2021-01-4 2021-01-5 2021-01-6 2021-01-0
   25 81221 9
2021-01-1 2021-01-2 2021-01-3 2021-01-4 2021-01-5
   2331141143
2021-01-6 2021-01-0 2021-01-1 2021-01-2 2021-01-3
6 3 4 1 4
2021-01-4 2021-01-5 2021-01-6 2021-01-0 2021-01-1
323 51543
2021-01-2 2021-01-3 2021-01-4 2021-01-5 2021-01-6
   1010 01817
2021-01-0 2021-02-1 2021-02-2 2021-02-3 2021-02-4
   33 015 011
2021-02-5 2021-02-6 2021-02-0 2021-02-1 2021-02-2
   191618 123
2021-02-3 2021-02-4 2021-02-5 2021-02-6 2021-02-0
   1116262143
2021-02-1 2021-02-2 2021-02-3 2021-02-4 2021-02-5
   3120402328
2021-02-6 2021-02-0 2021-02-1 2021-02-2 2021-02-3
   4549304141
2021-02-4 2021-02-5 2021-02-6 2021-02-0 2021-03-1
   8455876068
2021-03-2 2021-03-3 2021-03-4 2021-03-5 2021-03-6
   4263443749
2021-03-0 2021-03-1 2021-03-2
   414342


El 20/3/21, Emilio L. Cano  escribió:
> Supongo que jose, después de calcular la semana, querrá sumar los datos por
> semana. Si hay datos de más de un año, necesitará una columna año-semana,
> algo así:
>
> Datos %>%
>   mutate(semana = format(as.Date(fecha), “%Y-%V”) %>%
>   group_by (semana) %>%
>   summarise(total semana = sum(variable)
>
> Lógicamente, usando los nombres de data frame y variables que correspondan.
>
> Un saludo,
> Emilio
>
>
>
>
>
>> El 20 mar 2021, a las 15:18, Carlos Ortega 
>> escribió:
>>
>> Hola,
>>
>> ¿Te refieres a encontrar la semana a la que pertenece un día?
>>
>> #
>>> library(lubridate)
>>
>> Attaching package: ‘lubridate’
>>
>> The following objects are masked from ‘package:base’:
>>
>>date, intersect, setdiff, union
>>
>>> x <- ymd("2012-03-26")
>>> week(x)
>> [1] 13
>> #
>>
>> Gracias,
>> Carlos.
>>
>> El sáb, 20 mar 2021 a las 13:50, Jose Betancourt Bethencourt (<
>> betans...@gmail.com>) escribió:
>>
>>> Estimados
>>> como convertir una columna de datos diarios a semanales?
>>> saludos
>>> --
>>> Dr. Jose A. Betancourt Bethencourt
>>> Universidad de Ciencias Medicas Carlos j. Finlay
>>>
>>> ___
>>> R-help-es mailing list
>>> R-help-es@r-project.org
>>> https://stat.ethz.ch/mailman/listinfo/r-help-es
>>>
>>
>>
>> --
>> Saludos,
>> Carlos Ortega
>> www.qualityexcellence.es
>>
>>  [[alternative HTML version deleted]]
>>
>> ___
>> R-help-es mailing list
>> R-help-es@r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-help-es
>
>


-- 
Dr. Jose A. Betancourt Bethencourt
Universidad de Ciencias Medicas Carlos j. Finlay

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


Re: [R] for loop implementation in below problem

2021-03-22 Thread Jim Lemon
No, I am confounded, It does return the value of the expressions
within the respective braces, just like ifelse. Learn something every
day.

Jim

On Mon, Mar 22, 2021 at 9:35 PM Jim Lemon  wrote:
>
> If he's setting PRE to the return value of "if", that is the logical
> value of the expression in the if statement as far as I know. I think
> that the expression within the else clause would be evaluated but not
> assigned to anything and since it is within the loop, would just be
> lost.
>
> PRE<-ifelse(missing(GAY),(GA/GA)*100,(GA/GAY)*100)
>
> would return either value depending upon whether GAY was missing.
> That's what I get from the help pages.
>
> Jim
>
> On Mon, Mar 22, 2021 at 8:34 PM Duncan Murdoch  
> wrote:
> >
> > On 22/03/2021 1:59 a.m., Jim Lemon wrote:
> > > Hi Goyani,
> > > You are setting "PRE" to the return value of "if" which is one of TRUE
> > > (1), FALSE(0) or NULL.
> >
> > That's not true at all.  The statement was
> >
> >  PRE<- if(missing(GAY)){
> >(GA/GA) * 100
> >  } else {
> >(GA/GAY) * 100
> >  }
> >
> > so the result is (GA/GA) * 100 or (GA/GAY)*100.
> >
> > > Because GAY is always missing in your example,
> >
> > If that's true and GA isn't missing, the result will always be 100.
> >
> > Duncan Murdoch
> >
> > > "PRE" is always set to 1. Then you always want to pass 1 in the sample
> > > list, and that will not assign anything to PRE. By correcting the "if"
> > > clause and defining matrices that are unlikely to be singular, I can
> > > run a "for" loop as follows:
> > >
> > > selection.index<- function(ID, phen_mat, gen_mat, weight_mat, GAY){
> > >   p<-as.matrix(phen_mat)
> > >   g<-as.matrix(gen_mat)
> > >   w<-as.matrix(weight_mat)
> > >   bmat<- solve(phen_mat) %*% gen_mat %*% weight_mat
> > >   GA<- 2.063 * t(bmat) %*% g %*% w / (t(bmat) %*% p %*% bmat)^0.5
> > >   if(missing(GAY)) PRE<-(GA/GA) * 100
> > >   else PRE<-(GA/GAY) * 100
> > >   result<-list(ID=ID,b=matrix(round(bmat,4),nrow=1),
> > >GA=round(GA,4),PRE=round(PRE,4))
> > >   return(data.frame(result))
> > > }
> > >
> > > pmat<-matrix(sample(1:16,16),4)
> > > gmat<-matrix(sample(17:32),16,4)
> > > wmat<-matrix(sample(1:4,4),4)
> > >
> > > mi<-combn(1:4,2)
> > > sc<-list()
> > > for(i in 1:ncol(matindx)) {
> > >   as.numeric(ID<-paste0(mi[,i]))
> > >   sc[[i]]<-selection.index(ID,pmat[mi[,i],mi[,i]],gmat[mi[,i],mi[,i]],
> > >wmat[mi[,i]],1)
> > > }
> > >
> > > This produces output for me. Good luck with whatever you are doing with 
> > > this.
> > >
> > > Jim
> > >
> > >
> > >
> > >
> > >
> > > On Mon, Mar 22, 2021 at 2:51 PM Goyani Zankrut  
> > > wrote:
> > >>
> > >> Greetings of the day,
> > >> Thank you for your response, Sir.
> > >> The full problem statement is given below:
> > >>
> > >> In our case, I'm taking 4 traits.
> > >> library(arrangements)
> > >> a<- combinations(4,2) # gives 6 pairwise combinations
> > >> class(a) # it's a "matrix" "array"
> > >>
> > >> now hypothetical data of three matrix for further calculation:
> > >> pmat<- matrix(1:16, nrow = 4)
> > >> gmat<- matrix(17:32, nrow = 4)
> > >> wmat<- matrix(1:4, nrow = 4)
> > >>
> > >> My custom function for further calculations:
> > >> selection.index<- function(ID, phen_mat, gen_mat, weight_mat, GAY){
> > >>ID = toString(ID)
> > >>p<- as.matrix(phen_mat)
> > >>g<- as.matrix(gen_mat)
> > >>w<- as.matrix(weight_mat)
> > >>bmat<- solve(phen_mat) %*% gen_mat %*% weight_mat
> > >>GA<- 2.063 * t(bmat) %*% g %*% w / (t(bmat) %*% p %*% bmat)^0.5
> > >>PRE<- if(missing(GAY)){
> > >>  (GA/GA) * 100
> > >>} else {
> > >>  (GA/GAY) * 100
> > >>}
> > >>result<- list("ID" = ID, "b" = matrix(round(bmat,4), nrow = 1), "GA" 
> > >> = round(GA,4), "PRE" = round(PRE,4))
> > >>return(data.frame(result))
> > >> }
> > >>
> > >> Now I want to store this data into a list for further calculation:
> > >> sc<- list()
> > >> sc[[1]]<- selection.index(ID = 12, phen_mat = pmat[c(1,2),c(1,2)], 
> > >> gen_mat = gmat[c(1,2),c(1,2)], weight_mat = wmat[c(1,2),1])
> > >> sc[[2]]<- selection.index(ID = 13, phen_mat = pmat[c(1,3),c(1,3)], 
> > >> gen_mat = gmat[c(1,3),c(1,3)], weight_mat = wmat[c(1,3),1])
> > >> sc[[3]]<- selection.index(ID = 14, phen_mat = pmat[c(1,4),c(1,4)], 
> > >> gen_mat = gmat[c(1,4),c(1,4)], weight_mat = wmat[c(1,4),1])
> > >> sc[[4]]<- selection.index(ID = 23, phen_mat = pmat[c(2,3),c(2,3)], 
> > >> gen_mat = gmat[c(2,3),c(2,3)], weight_mat = wmat[c(2,3),1])
> > >> sc[[5]]<- selection.index(ID = 24, phen_mat = pmat[c(2,4),c(2,4)], 
> > >> gen_mat = gmat[c(2,4),c(2,4)], weight_mat = wmat[c(2,4),1])
> > >> sc[[6]]<- selection.index(ID = 34, phen_mat = pmat[c(3,4),c(3,4)], 
> > >> gen_mat = gmat[c(3,4),c(3,4)], weight_mat = wmat[c(3,4),1])
> > >> above list code is monotonous and time consuming for large data 
> > >> combination cycles like (7,2) = 21 combinations, (10,2) = 45 
> > >> combinations. So I want to use the matrix a's each row as a vector in 
> > >> the 

Re: [R] for loop implementation in below problem

2021-03-22 Thread Jim Lemon
If he's setting PRE to the return value of "if", that is the logical
value of the expression in the if statement as far as I know. I think
that the expression within the else clause would be evaluated but not
assigned to anything and since it is within the loop, would just be
lost.

PRE<-ifelse(missing(GAY),(GA/GA)*100,(GA/GAY)*100)

would return either value depending upon whether GAY was missing.
That's what I get from the help pages.

Jim

On Mon, Mar 22, 2021 at 8:34 PM Duncan Murdoch  wrote:
>
> On 22/03/2021 1:59 a.m., Jim Lemon wrote:
> > Hi Goyani,
> > You are setting "PRE" to the return value of "if" which is one of TRUE
> > (1), FALSE(0) or NULL.
>
> That's not true at all.  The statement was
>
>  PRE<- if(missing(GAY)){
>(GA/GA) * 100
>  } else {
>(GA/GAY) * 100
>  }
>
> so the result is (GA/GA) * 100 or (GA/GAY)*100.
>
> > Because GAY is always missing in your example,
>
> If that's true and GA isn't missing, the result will always be 100.
>
> Duncan Murdoch
>
> > "PRE" is always set to 1. Then you always want to pass 1 in the sample
> > list, and that will not assign anything to PRE. By correcting the "if"
> > clause and defining matrices that are unlikely to be singular, I can
> > run a "for" loop as follows:
> >
> > selection.index<- function(ID, phen_mat, gen_mat, weight_mat, GAY){
> >   p<-as.matrix(phen_mat)
> >   g<-as.matrix(gen_mat)
> >   w<-as.matrix(weight_mat)
> >   bmat<- solve(phen_mat) %*% gen_mat %*% weight_mat
> >   GA<- 2.063 * t(bmat) %*% g %*% w / (t(bmat) %*% p %*% bmat)^0.5
> >   if(missing(GAY)) PRE<-(GA/GA) * 100
> >   else PRE<-(GA/GAY) * 100
> >   result<-list(ID=ID,b=matrix(round(bmat,4),nrow=1),
> >GA=round(GA,4),PRE=round(PRE,4))
> >   return(data.frame(result))
> > }
> >
> > pmat<-matrix(sample(1:16,16),4)
> > gmat<-matrix(sample(17:32),16,4)
> > wmat<-matrix(sample(1:4,4),4)
> >
> > mi<-combn(1:4,2)
> > sc<-list()
> > for(i in 1:ncol(matindx)) {
> >   as.numeric(ID<-paste0(mi[,i]))
> >   sc[[i]]<-selection.index(ID,pmat[mi[,i],mi[,i]],gmat[mi[,i],mi[,i]],
> >wmat[mi[,i]],1)
> > }
> >
> > This produces output for me. Good luck with whatever you are doing with 
> > this.
> >
> > Jim
> >
> >
> >
> >
> >
> > On Mon, Mar 22, 2021 at 2:51 PM Goyani Zankrut  wrote:
> >>
> >> Greetings of the day,
> >> Thank you for your response, Sir.
> >> The full problem statement is given below:
> >>
> >> In our case, I'm taking 4 traits.
> >> library(arrangements)
> >> a<- combinations(4,2) # gives 6 pairwise combinations
> >> class(a) # it's a "matrix" "array"
> >>
> >> now hypothetical data of three matrix for further calculation:
> >> pmat<- matrix(1:16, nrow = 4)
> >> gmat<- matrix(17:32, nrow = 4)
> >> wmat<- matrix(1:4, nrow = 4)
> >>
> >> My custom function for further calculations:
> >> selection.index<- function(ID, phen_mat, gen_mat, weight_mat, GAY){
> >>ID = toString(ID)
> >>p<- as.matrix(phen_mat)
> >>g<- as.matrix(gen_mat)
> >>w<- as.matrix(weight_mat)
> >>bmat<- solve(phen_mat) %*% gen_mat %*% weight_mat
> >>GA<- 2.063 * t(bmat) %*% g %*% w / (t(bmat) %*% p %*% bmat)^0.5
> >>PRE<- if(missing(GAY)){
> >>  (GA/GA) * 100
> >>} else {
> >>  (GA/GAY) * 100
> >>}
> >>result<- list("ID" = ID, "b" = matrix(round(bmat,4), nrow = 1), "GA" = 
> >> round(GA,4), "PRE" = round(PRE,4))
> >>return(data.frame(result))
> >> }
> >>
> >> Now I want to store this data into a list for further calculation:
> >> sc<- list()
> >> sc[[1]]<- selection.index(ID = 12, phen_mat = pmat[c(1,2),c(1,2)], gen_mat 
> >> = gmat[c(1,2),c(1,2)], weight_mat = wmat[c(1,2),1])
> >> sc[[2]]<- selection.index(ID = 13, phen_mat = pmat[c(1,3),c(1,3)], gen_mat 
> >> = gmat[c(1,3),c(1,3)], weight_mat = wmat[c(1,3),1])
> >> sc[[3]]<- selection.index(ID = 14, phen_mat = pmat[c(1,4),c(1,4)], gen_mat 
> >> = gmat[c(1,4),c(1,4)], weight_mat = wmat[c(1,4),1])
> >> sc[[4]]<- selection.index(ID = 23, phen_mat = pmat[c(2,3),c(2,3)], gen_mat 
> >> = gmat[c(2,3),c(2,3)], weight_mat = wmat[c(2,3),1])
> >> sc[[5]]<- selection.index(ID = 24, phen_mat = pmat[c(2,4),c(2,4)], gen_mat 
> >> = gmat[c(2,4),c(2,4)], weight_mat = wmat[c(2,4),1])
> >> sc[[6]]<- selection.index(ID = 34, phen_mat = pmat[c(3,4),c(3,4)], gen_mat 
> >> = gmat[c(3,4),c(3,4)], weight_mat = wmat[c(3,4),1])
> >> above list code is monotonous and time consuming for large data 
> >> combination cycles like (7,2) = 21 combinations, (10,2) = 45 combinations. 
> >> So I want to use the matrix a's each row as a vector in the 
> >> selection.index function and result stores in a list.
> >>
> >> I hope now you will understand the full problem. I have checked the 
> >> selection.index which has no issues and works well.
> >> Thank you.
> >>
> >
> > __
> > 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 

Re: [R] for loop implementation in below problem

2021-03-22 Thread Duncan Murdoch

On 22/03/2021 1:59 a.m., Jim Lemon wrote:

Hi Goyani,
You are setting "PRE" to the return value of "if" which is one of TRUE
(1), FALSE(0) or NULL. 


That's not true at all.  The statement was

PRE<- if(missing(GAY)){
  (GA/GA) * 100
} else {
  (GA/GAY) * 100
}

so the result is (GA/GA) * 100 or (GA/GAY)*100.


Because GAY is always missing in your example,


If that's true and GA isn't missing, the result will always be 100.

Duncan Murdoch


"PRE" is always set to 1. Then you always want to pass 1 in the sample
list, and that will not assign anything to PRE. By correcting the "if"
clause and defining matrices that are unlikely to be singular, I can
run a "for" loop as follows:

selection.index<- function(ID, phen_mat, gen_mat, weight_mat, GAY){
  p<-as.matrix(phen_mat)
  g<-as.matrix(gen_mat)
  w<-as.matrix(weight_mat)
  bmat<- solve(phen_mat) %*% gen_mat %*% weight_mat
  GA<- 2.063 * t(bmat) %*% g %*% w / (t(bmat) %*% p %*% bmat)^0.5
  if(missing(GAY)) PRE<-(GA/GA) * 100
  else PRE<-(GA/GAY) * 100
  result<-list(ID=ID,b=matrix(round(bmat,4),nrow=1),
   GA=round(GA,4),PRE=round(PRE,4))
  return(data.frame(result))
}

pmat<-matrix(sample(1:16,16),4)
gmat<-matrix(sample(17:32),16,4)
wmat<-matrix(sample(1:4,4),4)

mi<-combn(1:4,2)
sc<-list()
for(i in 1:ncol(matindx)) {
  as.numeric(ID<-paste0(mi[,i]))
  sc[[i]]<-selection.index(ID,pmat[mi[,i],mi[,i]],gmat[mi[,i],mi[,i]],
   wmat[mi[,i]],1)
}

This produces output for me. Good luck with whatever you are doing with this.

Jim





On Mon, Mar 22, 2021 at 2:51 PM Goyani Zankrut  wrote:


Greetings of the day,
Thank you for your response, Sir.
The full problem statement is given below:

In our case, I'm taking 4 traits.
library(arrangements)
a<- combinations(4,2) # gives 6 pairwise combinations
class(a) # it's a "matrix" "array"

now hypothetical data of three matrix for further calculation:
pmat<- matrix(1:16, nrow = 4)
gmat<- matrix(17:32, nrow = 4)
wmat<- matrix(1:4, nrow = 4)

My custom function for further calculations:
selection.index<- function(ID, phen_mat, gen_mat, weight_mat, GAY){
   ID = toString(ID)
   p<- as.matrix(phen_mat)
   g<- as.matrix(gen_mat)
   w<- as.matrix(weight_mat)
   bmat<- solve(phen_mat) %*% gen_mat %*% weight_mat
   GA<- 2.063 * t(bmat) %*% g %*% w / (t(bmat) %*% p %*% bmat)^0.5
   PRE<- if(missing(GAY)){
 (GA/GA) * 100
   } else {
 (GA/GAY) * 100
   }
   result<- list("ID" = ID, "b" = matrix(round(bmat,4), nrow = 1), "GA" = round(GA,4), 
"PRE" = round(PRE,4))
   return(data.frame(result))
}

Now I want to store this data into a list for further calculation:
sc<- list()
sc[[1]]<- selection.index(ID = 12, phen_mat = pmat[c(1,2),c(1,2)], gen_mat = 
gmat[c(1,2),c(1,2)], weight_mat = wmat[c(1,2),1])
sc[[2]]<- selection.index(ID = 13, phen_mat = pmat[c(1,3),c(1,3)], gen_mat = 
gmat[c(1,3),c(1,3)], weight_mat = wmat[c(1,3),1])
sc[[3]]<- selection.index(ID = 14, phen_mat = pmat[c(1,4),c(1,4)], gen_mat = 
gmat[c(1,4),c(1,4)], weight_mat = wmat[c(1,4),1])
sc[[4]]<- selection.index(ID = 23, phen_mat = pmat[c(2,3),c(2,3)], gen_mat = 
gmat[c(2,3),c(2,3)], weight_mat = wmat[c(2,3),1])
sc[[5]]<- selection.index(ID = 24, phen_mat = pmat[c(2,4),c(2,4)], gen_mat = 
gmat[c(2,4),c(2,4)], weight_mat = wmat[c(2,4),1])
sc[[6]]<- selection.index(ID = 34, phen_mat = pmat[c(3,4),c(3,4)], gen_mat = 
gmat[c(3,4),c(3,4)], weight_mat = wmat[c(3,4),1])
above list code is monotonous and time consuming for large data combination 
cycles like (7,2) = 21 combinations, (10,2) = 45 combinations. So I want to use 
the matrix a's each row as a vector in the selection.index function and result 
stores in a list.

I hope now you will understand the full problem. I have checked the 
selection.index which has no issues and works well.
Thank you.



__
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] How to average minutes per hour per month in the form of '# hours #minutes'

2021-03-22 Thread PIKAL Petr
Hallo

Sorry I cannot help you in tidyverse. I would use aggregate together with format

aggregate(whatever, list(format(datum, "%Y")), sum)
aggregate(whatever, list(format(datum, "%m")), sum)

Cheers
Petr

> -Original Message-
> From: R-help  On Behalf Of Dr Eberhard W
> Lisse
> Sent: Sunday, March 21, 2021 3:31 PM
> To: r-help@r-project.org
> Subject: [R] How to average minutes per hour per month in the form of '# hours
> #minutes'
> 
> Hi,
> 
> I have minutes worked by day (with some more information)
> 
> which when using
> 
>   library(tidyverse)
>   library(lubridate)
> 
> run through
> 
>   CONSMINUTES %>%
>   select(datum, dauer) %>%
>   arrange(desc(datum))
> 
> look somewhat like
> 
>   # A tibble: 142 x 2
>  datum  dauer
>   
>1 2021-03-1830
>2 2021-03-1730
>3 2021-03-1630
>4 2021-03-1630
>5 2021-03-1630
>6 2021-03-1630
>7 2021-03-1130
>8 2021-03-1130
>9 2021-03-1130
>   10 2021-03-1130
>   # … with 132 more rows
> 
> I can extract minutes per hour
> 
>   CONSMINUTES %>%
>   select(datum, dauer) %>%
>   group_by(week = format(datum, '%Y %V'))%>%
>   summarise_if(is.numeric, sum)
> 
> and minutes per month
> 
>   CONSMINUTES %>%
>   select(datum, dauer) %>%
>   group_by(month = format(datum, '%Y %m'))%>%
>   summarise_if(is.numeric, sum)
> 
> I need to show the time worked per week per month in the format of
> 
>   '# hours # minutes'
> 
> and would like to also be able to show the average time per week per month.
> 
> How can I do that (preferably with tidyverse :-)-O)?
> 
> greetings, el
> 
> __
> 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] About fviz_famd_ind()

2021-03-22 Thread PIKAL Petr
Hallo

However sometimes it could be easier to fine tune simple biplot function.

fit <- prcomp(iris[,-5])
biplot(fit, col=c("white", "grey"), xlim=c(-.15,.15), ylim=c(-0.05, .05),
expand=1)
points(fit$x[,1:2]*3, pch=c(17, 19)[as.numeric(iris$Sepal.Length<6)+1],
col=c(2,4)[as.numeric(iris$Petal.Length<5)+1], cex=2)
box()

You could use various pch, col and cex for points. You could annotate points
with text function. You could add legends.

Cheers.
Petr

> -Original Message-
> From: R-help  On Behalf Of Sarah Goslee
> Sent: Sunday, March 21, 2021 8:30 PM
> To: Mahmood Naderan-Tahan 
> Cc: r-help@r-project.org
> Subject: Re: [R] About fviz_famd_ind()
> 
> The way to start is looking at the help for that function, which includes:
> 
> ... Arguments to be passed to the function fviz()
> 
> so you may have more low-level control through those arguments. If
> fviz() itself doesn't do what you want, it also allows you to pass
additional
> arguments to its lower-level functions. If you go down far enough, you
should
> be able to control everything.
> 
> Sarah
> 
> On Sun, Mar 21, 2021 at 1:12 PM Mahmood Naderan-Tahan
>  wrote:
> >
> > Hi
> >
> > I use fviz_famd_ind() from factoextra and I would like to know
> >
> > 1) How can I decrease the font size?
> >
> > 2) How to increase max.overlaps?
> >
> >
> > ind <- get_famd_ind(res.famd)
> > fviz_famd_ind(res.famd, col.ind = "cos2",
> >   gradient.cols = c("#00AFBB", "#E7B800", "#FC4E07"),
> >   repel = TRUE)
> >
> >
> > Regards,
> > Mahmood
> >
> > [[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.
> 
> 
> 
> --
> Sarah Goslee (she/her)
> http://www.numberwright.com
> 
> __
> 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.