[R] optim with upper and lower bounds

2020-08-10 Thread Roy Mendelssohn - NOAA Federal via R-help
I am running a lot of optimization problems, at the moment using 'optim'  
('optim' is actually called by another program).  All of the problems have 
variables with simple upper and lower bounds,  which I can easily transform 
into a form that is unconstrained and solve using 'BFGS'.  But I was wondering 
is if it is more robust to solve the problem this way,  or to use L-BFGS-B 
instead.

Also how much difference can it make using 'optimx' instead 'optim'?  The 
program I am using (KFAS) allows this,  I just have to do some extra 
programming to use it.

Thanks,

-Roy



**
"The contents of this message do not reflect any position of the U.S. 
Government or NOAA."
**
Roy Mendelssohn
Supervisory Operations Research Analyst
NOAA/NMFS
Environmental Research Division
Southwest Fisheries Science Center
***Note new street address***
110 McAllister Way
Santa Cruz, CA 95060
Phone: (831)-420-3666
Fax: (831) 420-3980
e-mail: roy.mendelss...@noaa.gov www: https://www.pfeg.noaa.gov/

"Old age and treachery will overcome youth and skill."
"From those who have been given much, much will be expected" 
"the arc of the moral universe is long, but it bends toward justice" -MLK Jr.

__
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] C stack usage 7970372 is too close to the limit

2020-08-10 Thread Jeff Newmiller
Please take this discussion elsewhere... it is off-topic here. Ivan offered 
options earlier in this regard.

On August 10, 2020 11:14:22 AM PDT, Raj kapoor  wrote:
>Hi John,
>
>Only the particular users getting error john. Please help me
>
>
>
>
>On Mon, 10 Aug 2020, 11:43 pm Raj kapoor, 
>wrote:
>
>> Hi John,
>>
>> I have 10 user in the instance, 9 user is working and access the R
>studio
>> app, but while access the 10th user it's getting stack usage limit
>issues,
>> then we create the new users its working fine.
>>
>> On Mon, 10 Aug 2020, 10:21 pm John Harrold,
>
>> wrote:
>>
>>> Hello Raj,
>>>
>>> I've gotten this type of error in the past when I've done things
>like use
>>> while loops that didn't end. Basically, I think this means you're
>running
>>> out of memory. If you want more users, possibly increase the amount
>of ram
>>> in your machine.
>>>
>>> John
>>>
>>> On Mon, Aug 10, 2020 at 6:43 AM Raj kapoor
>
>>> wrote:
>>>
 Hi Team,

 I have one production instance in aws, in CentoOs linux
>environment, i
 have
 5 user to access the instance for using RStudio, In case R-studio
 working 4
 users running good, while we access 5th users its getting error,

 First issue : C stack usage 7970372 is too close to the limit

 Second Issue :  no stack overflow

 Please provide the solution.

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


Re: [R] How Can I Build a Standalone Binary

2020-08-10 Thread Jeff Newmiller
I specifically said that there are approaches that apply container technology 
to user software... I generally cannot tell whether software I am running on 
Ubuntu is a snap container or a native binary. Windows Store offers a similar 
experience. Your goal of targeting multiple platforms is complicating this 
discussion though... I don't plan to follow you down that rabbit hole. This 
forum is about the R language.

On August 10, 2020 10:37:57 AM PDT, "Knecht, Logan"  
wrote:
>I am an expert user for Docker. Unfortunately this is not a use case
>that will work with Docker.
>
>The goal is to provide a self-contained artifact as a solution so that
>no effort needs to be put into the environment configuration.
>
>If Docker was used, the users would need to download docker and figure
>out how to run the docker image I build.
>
>That is a solution, but it does not fit the deliverable requirements
>I'm shooting for.
>
>Logan
>
>2020/08/07 午後4:37 に、"Jeff Newmiller" 
>を書き込みました:
>
>While I have not attempted to apply this to Shiny apps on the desktop,
>layered container technology (e.g. Docker) is being rolled out for
>desktop app distribution on Linux (snap, flatpak) and Windows (Open
>Packaging Conventions), with which complex filesystem structures can be
>managed in isolated runtime environments. The hardest part is working
>out how the container will interact with the world... which I don't
>know the details of but it is clearly in the realm of "feasible".
>
>On August 7, 2020 2:23:48 PM PDT, Duncan Murdoch
> wrote:
>>I don't think it's feasible to do what you want.  At a very basic
>>level, 
>>R assumes it has files distributed across a file system (mostly below 
>>the R.home() directory).  Faking that in a single standalone
>executable
>>
>>may be possible but wouldn't be easy.
>>
>>If running a server isn't possible, then I'd suggest you work on 
>>automating a regular R installation, and put the things you want to
>run
>>
>>into scripts that make use of it.  Two steps instead of one.
>>
>>Duncan Murdoch
>>
>>
>>
>>On 07/08/2020 5:10 p.m., Knecht, Logan wrote:
>>> Unfortunately, that is not a solution due to the constraints of file
>>sizes associated with the run time operations as well as specific
>>execution workflows.
>>> 
>>> I need to make this a packaged distributable and the only blocker
>for
>>it at the moment is not being able to successfully bundle R as a
>>standalone binary.
>>> 
>>> Warm Regards,
>>> 
>>> Logan Knecht
>>> 
>>> 2020/08/07 午前4:50 に、"Duncan Murdoch" 
>>を書き込みました:
>>> 
>  >>  Wouldn't it be easier to set up a Shiny host system, and just
>>give your
>>>  collaborators a URL to the Shiny app running there?
>>> 
>>>  Duncan Murdoch
>>> 
>>> 
>>>  On 06/08/2020 5:32 p.m., Knecht, Logan wrote:
>>>  > Hello all,
>>>  >
>>>  > = The short version =
>>>  >
>>>  > I am trying to build a standalone version for R so that I can
>>bundle and package a self-hosted environment for a shiny app. There
>are
>>reasons for this decision, but it will only distract from the
>>discussion.
>>>  >
>>>  > The inspiration for this comes from here:
>>>  >
>>https://urldefense.proofpoint.com/v2/url?u=https-3A__www.youtube.com_watch-3Fv-3DARrbbviGvjc&d=DwIDaQ&c=eRAMFD45gAfqt84VtBcfhQ&r=yLJd2IoXkBkWMIBcuv1k7wCSdpKnUqiEZDh_EJHHU08&m=6GL5xCevUT873KGyFsJhVe44s-QATomA_BHxDVctiOA&s=yHknXdnol-gw1NqdlK0Md_dn9jW_NU6DlTZJ0aoKnxc&e=
>>>  > and here
>>>  >
>>https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_dirkschumacher_r-2Dshiny-2Delectron&d=DwIDaQ&c=eRAMFD45gAfqt84VtBcfhQ&r=yLJd2IoXkBkWMIBcuv1k7wCSdpKnUqiEZDh_EJHHU08&m=6GL5xCevUT873KGyFsJhVe44s-QATomA_BHxDVctiOA&s=iCgG_D3ngLrfXykUszOieQIRiwj5prEN3c0gFb8V_1g&e=
>>>  >
>>>  > I have tried these solutions, to no avail as I repeatedly
> >encounter issues with the process. Some issues have been difficulties
>>importing libraries after repeating their steps, others have been
>>issues with missing dynamic libraries that aren't available when I
>>build from source.
>>>  >
>>>  > = Questions =
>>>  >
>>>  > -   How is the R binary at this link created?
>>>  >  -   Link:
>>https://urldefense.proofpoint.com/v2/url?u=https-3A__cloud.r-2Dproject.org_bin_macosx_R-2D4.0.2.pkg&d=DwIDaQ&c=eRAMFD45gAfqt84VtBcfhQ&r=yLJd2IoXkBkWMIBcuv1k7wCSdpKnUqiEZDh_EJHHU08&m=6GL5xCevUT873KGyFsJhVe44s-QATomA_BHxDVctiOA&s=pUj6yAcIF2zy9KcB7dXJD4ezIwluDIhuc3UN05ZcIs4&e=
>>>  > -   How do I include `libgfortran.5.dylib`
>>>  >  -   This distributable, when configured shows a file
>>called `libgfortran.5.dylib`
>>>  >  -   As of this writing, my solution fails because this
>is
>>missing when I run the self-hosted R
>>>  > -   Is there

Re: [R] C stack usage 7970372 is too close to the limit

2020-08-10 Thread Raj kapoor
Hi John,

Only the particular users getting error john. Please help me




On Mon, 10 Aug 2020, 11:43 pm Raj kapoor,  wrote:

> Hi John,
>
> I have 10 user in the instance, 9 user is working and access the R studio
> app, but while access the 10th user it's getting stack usage limit issues,
> then we create the new users its working fine.
>
> On Mon, 10 Aug 2020, 10:21 pm John Harrold, 
> wrote:
>
>> Hello Raj,
>>
>> I've gotten this type of error in the past when I've done things like use
>> while loops that didn't end. Basically, I think this means you're running
>> out of memory. If you want more users, possibly increase the amount of ram
>> in your machine.
>>
>> John
>>
>> On Mon, Aug 10, 2020 at 6:43 AM Raj kapoor 
>> wrote:
>>
>>> Hi Team,
>>>
>>> I have one production instance in aws, in CentoOs linux environment, i
>>> have
>>> 5 user to access the instance for using RStudio, In case R-studio
>>> working 4
>>> users running good, while we access 5th users its getting error,
>>>
>>> First issue : C stack usage 7970372 is too close to the limit
>>>
>>> Second Issue :  no stack overflow
>>>
>>> Please provide the solution.
>>>
>>> [[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
>> :wq
>>
>

[[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] C stack usage 7970372 is too close to the limit

2020-08-10 Thread Raj kapoor
Hi John,

I have 10 user in the instance, 9 user is working and access the R studio
app, but while access the 10th user it's getting stack usage limit issues,
then we create the new users its working fine.

On Mon, 10 Aug 2020, 10:21 pm John Harrold, 
wrote:

> Hello Raj,
>
> I've gotten this type of error in the past when I've done things like use
> while loops that didn't end. Basically, I think this means you're running
> out of memory. If you want more users, possibly increase the amount of ram
> in your machine.
>
> John
>
> On Mon, Aug 10, 2020 at 6:43 AM Raj kapoor 
> wrote:
>
>> Hi Team,
>>
>> I have one production instance in aws, in CentoOs linux environment, i
>> have
>> 5 user to access the instance for using RStudio, In case R-studio working
>> 4
>> users running good, while we access 5th users its getting error,
>>
>> First issue : C stack usage 7970372 is too close to the limit
>>
>> Second Issue :  no stack overflow
>>
>> Please provide the solution.
>>
>> [[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
> :wq
>

[[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] C stack usage 7970372 is too close to the limit

2020-08-10 Thread John Harrold
Hello Raj,

I've gotten this type of error in the past when I've done things like use
while loops that didn't end. Basically, I think this means you're running
out of memory. If you want more users, possibly increase the amount of ram
in your machine.

John

On Mon, Aug 10, 2020 at 6:43 AM Raj kapoor  wrote:

> Hi Team,
>
> I have one production instance in aws, in CentoOs linux environment, i have
> 5 user to access the instance for using RStudio, In case R-studio working 4
> users running good, while we access 5th users its getting error,
>
> First issue : C stack usage 7970372 is too close to the limit
>
> Second Issue :  no stack overflow
>
> Please provide the solution.
>
> [[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
:wq

[[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] Question about PERL lookahead construct in regex's

2020-08-10 Thread Bert Gunter
Folks:

Consider:
> y <- "xx wt"

> grep(" +(?=t)",y, perl = TRUE)
integer(0)
## Unexpected. Lookahead construct does not find "t" after space
## But
> grep(" +(?=.+t)",y, perl = TRUE)
[1] 1
## Expected. Given pattern for **exact** match, lookahead finds it

My concern is:
?regexp says this:
"Patterns (?=...) and (?!...) are zero-width positive and negative lookahead
 *assertions*: they match if an attempt to match the ... forward from the
current position would succeed (or not), but use up no characters in the
string being processed."

But this appears to be imprecise (it confused me, anyway). The usual sense
of "matching" in regex's is "match the pattern somewhere in the string
going forward." But in the perl lookahead construct it apparently must
**exactly** match *everything* in the string that follows.

Questions:
Am I correct about this? If not, what do I misunderstand?
If I am correct, should the regex help be slightly modified to something
like:

"Patterns (?=...) and (?!...) are zero-width positive and negative lookahead
 *assertions*: they match if an attempt to **exactly" match all of ... forward
from the current position would succeed (or not), but use up no characters
in the string being processed."

Thanks.

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 )

[[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] C stack usage 7970372 is too close to the limit

2020-08-10 Thread Ivan Krylov
On Fri, 7 Aug 2020 22:25:32 +0530
Raj kapoor  wrote:

> I have one production instance in aws, in CentoOs linux environment,
> i have 5 user to access the instance for using RStudio, In case
> R-studio working 4 users running good, while we access 5th users its
> getting error,

Sorry, R-Studio support is over there: https://support.rstudio.com/

If you think that the issue is with R and not R-Studio, please show us
how this problem can be reproduced (i.e. include the data and the code
we could run ourselves to trigger the issue). Check out the posting
guide [*] and, in particular, this HOWTO [**] on seeking technical help.

-- 
Best regards,
Ivan

>   [[alternative HTML version deleted]]

P.S. Please post in plain text, not HTML.

[*] https://www.r-project.org/posting-guide.html
The link is appended to every e-mail sent via this list.

[**] http://www.catb.org/~esr/faqs/smart-questions.html

__
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] Add a logo on a plot

2020-08-10 Thread Ivan Krylov
On Fri, 7 Aug 2020 15:56:43 +0200
Pedro páramo  wrote:

> There is a way to add a photo like a free text but images on a plot,
> (hist, chart trough ggplot) to add a logo or any PNG .

See ?rasterImage and the example in ?png::readPNG [*].

-- 
Best regards,
Ivan

[*] png is a CRAN package, https://cran.r-project.org/package=png

__
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] C stack usage 7970372 is too close to the limit

2020-08-10 Thread Raj kapoor
Hi Team,

I have one production instance in aws, in CentoOs linux environment, i have
5 user to access the instance for using RStudio, In case R-studio working 4
users running good, while we access 5th users its getting error,

First issue : C stack usage 7970372 is too close to the limit

Second Issue :  no stack overflow

Please provide the solution.

[[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] Add a logo on a plot

2020-08-10 Thread Pedro páramo
Hi,

There is a way to add a photo like a free text but images on a plot, (hist,
chart trough ggplot) to add a logo or any PNG .

[[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] find end of monotonic part of vector

2020-08-10 Thread PIKAL Petr
Thank you Rui

The problem is that this was just a part of my data and I have many of such
consecutive chunks. So far I have a solution in mind which I will try. 

Set all values above 900 to NA.
Set all values below 600 (or 650) to NA
Find parts which have at least 4 continuous values (values not having NA
within them).
Find position of all minimum values.

Not sure if this approach will work, though.

Cheers
Petr

> -Original Message-
> From: Rui Barradas 
> Sent: Friday, August 7, 2020 5:45 PM
> To: PIKAL Petr ; R-help 
> Subject: Re: [R] find end of monotonic part of vector
> 
> Hello,
> 
> I should have continued, inline.
> 
> Às 15:05 de 07/08/20, Rui Barradas escreveu:
> > Hello,
> >
> > Maybe I'm not understanding but looking at this graph
> >
> >
> > i <- diff(kalo.v$vodiv) > 0
> > plot(kalo.v)
> > lines(kalo.v)
> > points(kalo.v$cas[i], kalo.v$vodiv[i], pch = 16, col = "red")
> >
> >
> > it seems you want the point before the first local minimum?
> >
> >
> > min(which(i)) - 1L
> > #[1] 20
> >
> 
> (k <- min(which(i)) - 1L)
> #[1] 20
> 
> kalo.v[k, ]
> #  cas  vodiv
> #71230 2020-07-27 11:09:00 652.53
> 
> 
> Rui Barradas
> 
> >
> > Hope this helps,
> >
> > Rui Barradas
> >
> >
> > Às 13:05 de 07/08/20, PIKAL Petr escreveu:
> >> Hallo all
> >>
> >> I have such data
> >>> dput(kalo.v)
> >> structure(list(cas = structure(c(1595847000, 1595847060, 1595847120,
> >> 1595847180, 1595847240, 1595847300, 1595847360, 1595847420,
> >> 1595847480, 1595847540, 1595847600, 1595847660, 1595847720,
> >> 1595847780, 1595847840, 1595847900, 1595847960, 1595848020,
> >> 1595848080, 1595848140, 1595848200, 1595848260, 1595848320,
> >> 1595848380, 1595848440, 1595848500, 1595848560, 1595848620,
> >> 1595848680, 1595848740, 1595848800, 1595848860, 1595848920,
> >> 1595848980, 1595849040, 1595849100, 1595849160, 1595849220,
> >> 1595849280, 1595849340, 1595849400, 1595849460, 1595849520,
> >> 1595849580, 1595849640 ), class = c("POSIXct", "POSIXt"), tzone =
> >> "UTC"), vodiv = c(999.9000244, 999.9000244, 999.9000244, 999.9000244,
> >> 999.9000244, 999.9000244, 999.9000244, 999.9000244, 999.9000244,
> >> 999.9000244, 999.9000244, 999.9000244, 991.6404419, 925.2166748,
> >> 864.3446045, 812.1702271, 758.9353027, 722.5073242, 684.5323486,
> >> 652.5300293, 82.18816376, 141.1757813, 402.7521667, 999.9000244,
> >> 959.1779175, 967.0949707, 517.1983643, 50, 50, 524.569458,
> >> 999.9000244, 999.9000244, 999.9000244, 999.9000244, 999.9000244,
> >> 999.9000244, 999.9000244, 977.0491943, 889.9714355, 999.9000244,
> >> 999.9000244, 999.9000244, 999.9000244, 999.9000244, 999.9000244)),
> >> row.names = 71211:71255, class =
> >> "data.frame")
> >>
> >> and I would like to automatically find endpoint of gradually
> >> decreasing part (here point 20, vodiv = 652.).
> >>
> >> Usually I use diff but this is just a chunk of bigger data and diff
> >> seems to be difficult to use. I appreciate any hint.
> >>
> >> Best regards.
> >> Petr
> >>
> >>
> >> __
> >> 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.