R maintains old values

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

R maintains old values

R help mailing list-2
Hello,

I have a strange side-effect from executing R-scripts using R and RServe.

I am executing an R-Script from a Java file using RServe in R. I also have RStudio installed, but it's not running at the time. The R-script reads a CSV file and does various statistical things. RServe enables me to run each line of the R script using "eval()" line by line.

All this works fine for a correctly-formatted CSV file. It's great.

But, if the CSV file isn't correctly formatted, AND the last CSV file did correctly get run, then, with the incorrect CSV as input, the output is what ran last time. Somehow, the last correct run is persisted and returned if there is some problem with the current CSV input.

This data persistence is maintained across reboots.

I'm thus baffled how R is maintaining these old values, but more to the point, I need to know how to clear these old values so if the CSV input is incorrect, I get nothing back, not the old CSV values from a correctly formatted file.

Hope this description is clear.

Thanks in advance to all.

- M

Sent from [ProtonMail](https://protonmail.com), Swiss-based encrypted email.
        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: R maintains old values

R help mailing list-2
Do you have a ".RData" file in your home directory or the current working
directory?   If so, R will load it at startup.  It can be made by you
answering 'yes' to the 'Save workspace image?' question when you quit R.

Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Mon, Jul 2, 2018 at 5:02 AM, Morkus via R-help <[hidden email]>
wrote:

> Hello,
>
> I have a strange side-effect from executing R-scripts using R and RServe.
>
> I am executing an R-Script from a Java file using RServe in R. I also have
> RStudio installed, but it's not running at the time. The R-script reads a
> CSV file and does various statistical things. RServe enables me to run each
> line of the R script using "eval()" line by line.
>
> All this works fine for a correctly-formatted CSV file. It's great.
>
> But, if the CSV file isn't correctly formatted, AND the last CSV file did
> correctly get run, then, with the incorrect CSV as input, the output is
> what ran last time. Somehow, the last correct run is persisted and returned
> if there is some problem with the current CSV input.
>
> This data persistence is maintained across reboots.
>
> I'm thus baffled how R is maintaining these old values, but more to the
> point, I need to know how to clear these old values so if the CSV input is
> incorrect, I get nothing back, not the old CSV values from a correctly
> formatted file.
>
> Hope this description is clear.
>
> Thanks in advance to all.
>
> - M
>
> Sent from [ProtonMail](https://protonmail.com), Swiss-based encrypted
> email.
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/
> posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: R maintains old values

PIKAL Petr
In reply to this post by R help mailing list-2
Hi

Without code it is just fishing in murky waters. Could the problem you face be that in each run you assingn the result to some object and if the CSV is wrong your code fails but the object from previous run persists?

If this is the case just initialize your objects in the beginning (e.g. make them NULL at the beginning) and only if code delivers result the value of the result is returned otherwise NULL is returned.

Cheers
Petr

Osobní údaje: Informace o zpracování a ochraně osobních údajů obchodních partnerů PRECHEZA a.s. jsou zveřejněny na: https://www.precheza.cz/zasady-ochrany-osobnich-udaju/ | Information about processing and protection of business partner's personal data are available on website: https://www.precheza.cz/en/personal-data-protection-principles/
Důvěrnost: Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a podléhají tomuto právně závaznému prohlášení o vyloučení odpovědnosti: https://www.precheza.cz/01-dovetek/ | This email and any documents attached to it may be confidential and are subject to the legally binding disclaimer: https://www.precheza.cz/en/01-disclaimer/

> -----Original Message-----
> From: R-help [mailto:[hidden email]] On Behalf Of Morkus via R-
> help
> Sent: Monday, July 2, 2018 2:02 PM
> To: [hidden email]
> Subject: [R] R maintains old values
>
> Hello,
>
> I have a strange side-effect from executing R-scripts using R and RServe.
>
> I am executing an R-Script from a Java file using RServe in R. I also have RStudio
> installed, but it's not running at the time. The R-script reads a CSV file and does
> various statistical things. RServe enables me to run each line of the R script
> using "eval()" line by line.
>
> All this works fine for a correctly-formatted CSV file. It's great.
>
> But, if the CSV file isn't correctly formatted, AND the last CSV file did correctly
> get run, then, with the incorrect CSV as input, the output is what ran last time.
> Somehow, the last correct run is persisted and returned if there is some
> problem with the current CSV input.
>
> This data persistence is maintained across reboots.
>
> I'm thus baffled how R is maintaining these old values, but more to the point, I
> need to know how to clear these old values so if the CSV input is incorrect, I get
> nothing back, not the old CSV values from a correctly formatted file.
>
> Hope this description is clear.
>
> Thanks in advance to all.
>
> - M
>
> Sent from [ProtonMail](https://protonmail.com), Swiss-based encrypted email.
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: R maintains old values

Eric Berger
If you want a "fresh" R session when you start to run the script you could
consider putting as the first line

rm(list=ls())

This will remove objects from your environment (variables, functions, ..)

HTH,
Eric


On Mon, Jul 2, 2018 at 5:34 PM, PIKAL Petr <[hidden email]> wrote:

> Hi
>
> Without code it is just fishing in murky waters. Could the problem you
> face be that in each run you assingn the result to some object and if the
> CSV is wrong your code fails but the object from previous run persists?
>
> If this is the case just initialize your objects in the beginning (e.g.
> make them NULL at the beginning) and only if code delivers result the value
> of the result is returned otherwise NULL is returned.
>
> Cheers
> Petr
>
> Osobní údaje: Informace o zpracování a ochraně osobních údajů obchodních
> partnerů PRECHEZA a.s. jsou zveřejněny na: https://www.precheza.cz/
> zasady-ochrany-osobnich-udaju/ | Information about processing and
> protection of business partner's personal data are available on website:
> https://www.precheza.cz/en/personal-data-protection-principles/
> Důvěrnost: Tento e-mail a jakékoliv k němu připojené dokumenty jsou
> důvěrné a podléhají tomuto právně závaznému prohlášení o vyloučení
> odpovědnosti: https://www.precheza.cz/01-dovetek/ | This email and any
> documents attached to it may be confidential and are subject to the legally
> binding disclaimer: https://www.precheza.cz/en/01-disclaimer/
>
> > -----Original Message-----
> > From: R-help [mailto:[hidden email]] On Behalf Of Morkus
> via R-
> > help
> > Sent: Monday, July 2, 2018 2:02 PM
> > To: [hidden email]
> > Subject: [R] R maintains old values
> >
> > Hello,
> >
> > I have a strange side-effect from executing R-scripts using R and RServe.
> >
> > I am executing an R-Script from a Java file using RServe in R. I also
> have RStudio
> > installed, but it's not running at the time. The R-script reads a CSV
> file and does
> > various statistical things. RServe enables me to run each line of the R
> script
> > using "eval()" line by line.
> >
> > All this works fine for a correctly-formatted CSV file. It's great.
> >
> > But, if the CSV file isn't correctly formatted, AND the last CSV file
> did correctly
> > get run, then, with the incorrect CSV as input, the output is what ran
> last time.
> > Somehow, the last correct run is persisted and returned if there is some
> > problem with the current CSV input.
> >
> > This data persistence is maintained across reboots.
> >
> > I'm thus baffled how R is maintaining these old values, but more to the
> point, I
> > need to know how to clear these old values so if the CSV input is
> incorrect, I get
> > nothing back, not the old CSV values from a correctly formatted file.
> >
> > Hope this description is clear.
> >
> > Thanks in advance to all.
> >
> > - M
> >
> > Sent from [ProtonMail](https://protonmail.com), Swiss-based encrypted
> email.
> >       [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/
> posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/
> posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: R maintains old values

Bert Gunter-2
... or perhaps

rm( list = ls(all = TRUE))
## see ?ls  for details.

However, see ?Startup for how to start a R in a "clean" environment, e.g.
with the --no-restore option.

Cheers,
Bert


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, Jul 2, 2018 at 7:47 AM, Eric Berger <[hidden email]> wrote:

> If you want a "fresh" R session when you start to run the script you could
> consider putting as the first line
>
> rm(list=ls())
>
> This will remove objects from your environment (variables, functions, ..)
>
> HTH,
> Eric
>
>
> On Mon, Jul 2, 2018 at 5:34 PM, PIKAL Petr <[hidden email]> wrote:
>
> > Hi
> >
> > Without code it is just fishing in murky waters. Could the problem you
> > face be that in each run you assingn the result to some object and if the
> > CSV is wrong your code fails but the object from previous run persists?
> >
> > If this is the case just initialize your objects in the beginning (e.g.
> > make them NULL at the beginning) and only if code delivers result the
> value
> > of the result is returned otherwise NULL is returned.
> >
> > Cheers
> > Petr
> >
> > Osobní údaje: Informace o zpracování a ochraně osobních údajů obchodních
> > partnerů PRECHEZA a.s. jsou zveřejněny na: https://www.precheza.cz/
> > zasady-ochrany-osobnich-udaju/ | Information about processing and
> > protection of business partner's personal data are available on website:
> > https://www.precheza.cz/en/personal-data-protection-principles/
> > Důvěrnost: Tento e-mail a jakékoliv k němu připojené dokumenty jsou
> > důvěrné a podléhají tomuto právně závaznému prohlášení o vyloučení
> > odpovědnosti: https://www.precheza.cz/01-dovetek/ | This email and any
> > documents attached to it may be confidential and are subject to the
> legally
> > binding disclaimer: https://www.precheza.cz/en/01-disclaimer/
> >
> > > -----Original Message-----
> > > From: R-help [mailto:[hidden email]] On Behalf Of Morkus
> > via R-
> > > help
> > > Sent: Monday, July 2, 2018 2:02 PM
> > > To: [hidden email]
> > > Subject: [R] R maintains old values
> > >
> > > Hello,
> > >
> > > I have a strange side-effect from executing R-scripts using R and
> RServe.
> > >
> > > I am executing an R-Script from a Java file using RServe in R. I also
> > have RStudio
> > > installed, but it's not running at the time. The R-script reads a CSV
> > file and does
> > > various statistical things. RServe enables me to run each line of the R
> > script
> > > using "eval()" line by line.
> > >
> > > All this works fine for a correctly-formatted CSV file. It's great.
> > >
> > > But, if the CSV file isn't correctly formatted, AND the last CSV file
> > did correctly
> > > get run, then, with the incorrect CSV as input, the output is what ran
> > last time.
> > > Somehow, the last correct run is persisted and returned if there is
> some
> > > problem with the current CSV input.
> > >
> > > This data persistence is maintained across reboots.
> > >
> > > I'm thus baffled how R is maintaining these old values, but more to the
> > point, I
> > > need to know how to clear these old values so if the CSV input is
> > incorrect, I get
> > > nothing back, not the old CSV values from a correctly formatted file.
> > >
> > > Hope this description is clear.
> > >
> > > Thanks in advance to all.
> > >
> > > - M
> > >
> > > Sent from [ProtonMail](https://protonmail.com), Swiss-based encrypted
> > email.
> > >       [[alternative HTML version deleted]]
> > >
> > > ______________________________________________
> > > [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> > > https://stat.ethz.ch/mailman/listinfo/r-help
> > > PLEASE do read the posting guide http://www.R-project.org/
> > posting-guide.html
> > > and provide commented, minimal, self-contained, reproducible code.
> >
> > ______________________________________________
> > [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/
> > posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/
> posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: R maintains old values

Peter Dalgaard-2
Also beware the traveling arsonist, Jenny Bryan:

https://www.tidyverse.org/articles/2017/12/workflow-vs-script/


-pd

> On 2 Jul 2018, at 17:11 , Bert Gunter <[hidden email]> wrote:
>
> ... or perhaps
>
> rm( list = ls(all = TRUE))
> ## see ?ls  for details.
>
> However, see ?Startup for how to start a R in a "clean" environment, e.g.
> with the --no-restore option.
>
> Cheers,
> Bert
>
>
> 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, Jul 2, 2018 at 7:47 AM, Eric Berger <[hidden email]> wrote:
>
>> If you want a "fresh" R session when you start to run the script you could
>> consider putting as the first line
>>
>> rm(list=ls())
>>
>> This will remove objects from your environment (variables, functions, ..)
>>
>> HTH,
>> Eric
>>
>>
>> On Mon, Jul 2, 2018 at 5:34 PM, PIKAL Petr <[hidden email]> wrote:
>>
>>> Hi
>>>
>>> Without code it is just fishing in murky waters. Could the problem you
>>> face be that in each run you assingn the result to some object and if the
>>> CSV is wrong your code fails but the object from previous run persists?
>>>
>>> If this is the case just initialize your objects in the beginning (e.g.
>>> make them NULL at the beginning) and only if code delivers result the
>> value
>>> of the result is returned otherwise NULL is returned.
>>>
>>> Cheers
>>> Petr
>>>
>>> Osobní údaje: Informace o zpracování a ochraně osobních údajů obchodních
>>> partnerů PRECHEZA a.s. jsou zveřejněny na: https://www.precheza.cz/
>>> zasady-ochrany-osobnich-udaju/ | Information about processing and
>>> protection of business partner's personal data are available on website:
>>> https://www.precheza.cz/en/personal-data-protection-principles/
>>> Důvěrnost: Tento e-mail a jakékoliv k němu připojené dokumenty jsou
>>> důvěrné a podléhají tomuto právně závaznému prohlášení o vyloučení
>>> odpovědnosti: https://www.precheza.cz/01-dovetek/ | This email and any
>>> documents attached to it may be confidential and are subject to the
>> legally
>>> binding disclaimer: https://www.precheza.cz/en/01-disclaimer/
>>>
>>>> -----Original Message-----
>>>> From: R-help [mailto:[hidden email]] On Behalf Of Morkus
>>> via R-
>>>> help
>>>> Sent: Monday, July 2, 2018 2:02 PM
>>>> To: [hidden email]
>>>> Subject: [R] R maintains old values
>>>>
>>>> Hello,
>>>>
>>>> I have a strange side-effect from executing R-scripts using R and
>> RServe.
>>>>
>>>> I am executing an R-Script from a Java file using RServe in R. I also
>>> have RStudio
>>>> installed, but it's not running at the time. The R-script reads a CSV
>>> file and does
>>>> various statistical things. RServe enables me to run each line of the R
>>> script
>>>> using "eval()" line by line.
>>>>
>>>> All this works fine for a correctly-formatted CSV file. It's great.
>>>>
>>>> But, if the CSV file isn't correctly formatted, AND the last CSV file
>>> did correctly
>>>> get run, then, with the incorrect CSV as input, the output is what ran
>>> last time.
>>>> Somehow, the last correct run is persisted and returned if there is
>> some
>>>> problem with the current CSV input.
>>>>
>>>> This data persistence is maintained across reboots.
>>>>
>>>> I'm thus baffled how R is maintaining these old values, but more to the
>>> point, I
>>>> need to know how to clear these old values so if the CSV input is
>>> incorrect, I get
>>>> nothing back, not the old CSV values from a correctly formatted file.
>>>>
>>>> Hope this description is clear.
>>>>
>>>> Thanks in advance to all.
>>>>
>>>> - M
>>>>
>>>> Sent from [ProtonMail](https://protonmail.com), Swiss-based encrypted
>>> email.
>>>>      [[alternative HTML version deleted]]
>>>>
>>>> ______________________________________________
>>>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>> PLEASE do read the posting guide http://www.R-project.org/
>>> posting-guide.html
>>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>> ______________________________________________
>>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide http://www.R-project.org/
>>> posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>
>>        [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/
>> posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

--
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: [hidden email]  Priv: [hidden email]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: R maintains old values

J C Nash
For the sake of those who didn't see the link, Jenny objects strongly to startup
lines that either set a personal path or clear the workspace.

While I agree both of these are anti-social to the point of pathology for scripts
that are distributed, I have found it VERY important when testing things to actually
clear the workspace etc. Too many times I've got a result that nobody else would get
because I'm often loading some of my own packages or there are "useful" variables
lurking.

As usual, context is critical. Distributed scripts vs. developmental ones.

Now, to add to the controversy, how do you set a computer on fire?

JN

On 2018-07-03 03:52 AM, peter dalgaard wrote:

> Also beware the traveling arsonist, Jenny Bryan:
>
> https://www.tidyverse.org/articles/2017/12/workflow-vs-script/
>
>
> -pd
>
>> On 2 Jul 2018, at 17:11 , Bert Gunter <[hidden email]> wrote:
>>
>> ... or perhaps
>>
>> rm( list = ls(all = TRUE))
>> ## see ?ls  for details.
>>
>> However, see ?Startup for how to start a R in a "clean" environment, e.g.
>> with the --no-restore option.
>>
>> Cheers,
>> Bert
>>
>>
>> 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, Jul 2, 2018 at 7:47 AM, Eric Berger <[hidden email]> wrote:
>>
>>> If you want a "fresh" R session when you start to run the script you could
>>> consider putting as the first line
>>>
>>> rm(list=ls())
>>>
>>> This will remove objects from your environment (variables, functions, ..)
>>>
>>> HTH,
>>> Eric
>>>
>>>
>>> On Mon, Jul 2, 2018 at 5:34 PM, PIKAL Petr <[hidden email]> wrote:
>>>
>>>> Hi
>>>>
>>>> Without code it is just fishing in murky waters. Could the problem you
>>>> face be that in each run you assingn the result to some object and if the
>>>> CSV is wrong your code fails but the object from previous run persists?
>>>>
>>>> If this is the case just initialize your objects in the beginning (e.g.
>>>> make them NULL at the beginning) and only if code delivers result the
>>> value
>>>> of the result is returned otherwise NULL is returned.
>>>>
>>>> Cheers
>>>> Petr
>>>>
>>>> Osobní údaje: Informace o zpracování a ochraně osobních údajů obchodních
>>>> partnerů PRECHEZA a.s. jsou zveřejněny na: https://www.precheza.cz/
>>>> zasady-ochrany-osobnich-udaju/ | Information about processing and
>>>> protection of business partner's personal data are available on website:
>>>> https://www.precheza.cz/en/personal-data-protection-principles/
>>>> Důvěrnost: Tento e-mail a jakékoliv k němu připojené dokumenty jsou
>>>> důvěrné a podléhají tomuto právně závaznému prohlášení o vyloučení
>>>> odpovědnosti: https://www.precheza.cz/01-dovetek/ | This email and any
>>>> documents attached to it may be confidential and are subject to the
>>> legally
>>>> binding disclaimer: https://www.precheza.cz/en/01-disclaimer/
>>>>
>>>>> -----Original Message-----
>>>>> From: R-help [mailto:[hidden email]] On Behalf Of Morkus
>>>> via R-
>>>>> help
>>>>> Sent: Monday, July 2, 2018 2:02 PM
>>>>> To: [hidden email]
>>>>> Subject: [R] R maintains old values
>>>>>
>>>>> Hello,
>>>>>
>>>>> I have a strange side-effect from executing R-scripts using R and
>>> RServe.
>>>>>
>>>>> I am executing an R-Script from a Java file using RServe in R. I also
>>>> have RStudio
>>>>> installed, but it's not running at the time. The R-script reads a CSV
>>>> file and does
>>>>> various statistical things. RServe enables me to run each line of the R
>>>> script
>>>>> using "eval()" line by line.
>>>>>
>>>>> All this works fine for a correctly-formatted CSV file. It's great.
>>>>>
>>>>> But, if the CSV file isn't correctly formatted, AND the last CSV file
>>>> did correctly
>>>>> get run, then, with the incorrect CSV as input, the output is what ran
>>>> last time.
>>>>> Somehow, the last correct run is persisted and returned if there is
>>> some
>>>>> problem with the current CSV input.
>>>>>
>>>>> This data persistence is maintained across reboots.
>>>>>
>>>>> I'm thus baffled how R is maintaining these old values, but more to the
>>>> point, I
>>>>> need to know how to clear these old values so if the CSV input is
>>>> incorrect, I get
>>>>> nothing back, not the old CSV values from a correctly formatted file.
>>>>>
>>>>> Hope this description is clear.
>>>>>
>>>>> Thanks in advance to all.
>>>>>
>>>>> - M
>>>>>
>>>>> Sent from [ProtonMail](https://protonmail.com), Swiss-based encrypted
>>>> email.
>>>>>      [[alternative HTML version deleted]]
>>>>>
>>>>> ______________________________________________
>>>>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>>> PLEASE do read the posting guide http://www.R-project.org/
>>>> posting-guide.html
>>>>> and provide commented, minimal, self-contained, reproducible code.
>>>>
>>>> ______________________________________________
>>>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>> PLEASE do read the posting guide http://www.R-project.org/
>>>> posting-guide.html
>>>> and provide commented, minimal, self-contained, reproducible code.
>>>>
>>>
>>>        [[alternative HTML version deleted]]
>>>
>>> ______________________________________________
>>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide http://www.R-project.org/
>>> posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>
>> [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
JRG
Reply | Threaded
Open this post in threaded view
|

Re: R maintains old values

JRG

On 07/03/2018 09:25 AM, J C Nash wrote:

> For the sake of those who didn't see the link, Jenny objects strongly to startup
> lines that either set a personal path or clear the workspace.
>
> While I agree both of these are anti-social to the point of pathology for scripts
> that are distributed, I have found it VERY important when testing things to actually
> clear the workspace etc. Too many times I've got a result that nobody else would get
> because I'm often loading some of my own packages or there are "useful" variables
> lurking.
>
> As usual, context is critical. Distributed scripts vs. developmental ones.


Agreed!

>
> Now, to add to the controversy, how do you set a computer on fire?

One of the Boring Company's  Not A Flamethrowers ??


---JRG

John R. Gleason

>
> JN
>
> On 2018-07-03 03:52 AM, peter dalgaard wrote:
>> Also beware the traveling arsonist, Jenny Bryan:
>>
>> https://www.tidyverse.org/articles/2017/12/workflow-vs-script/
>>
>>
>> -pd
>>
>>> On 2 Jul 2018, at 17:11 , Bert Gunter <[hidden email]> wrote:
>>>
>>> ... or perhaps
>>>
>>> rm( list = ls(all = TRUE))
>>> ## see ?ls  for details.
>>>
>>> However, see ?Startup for how to start a R in a "clean" environment, e.g.
>>> with the --no-restore option.
>>>
>>> Cheers,
>>> Bert
>>>
>>>
>>> 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, Jul 2, 2018 at 7:47 AM, Eric Berger <[hidden email]> wrote:
>>>
>>>> If you want a "fresh" R session when you start to run the script you could
>>>> consider putting as the first line
>>>>
>>>> rm(list=ls())
>>>>
>>>> This will remove objects from your environment (variables, functions, ..)
>>>>
>>>> HTH,
>>>> Eric
>>>>
>>>>
>>>> On Mon, Jul 2, 2018 at 5:34 PM, PIKAL Petr <[hidden email]> wrote:
>>>>
>>>>> Hi
>>>>>
>>>>> Without code it is just fishing in murky waters. Could the problem you
>>>>> face be that in each run you assingn the result to some object and if the
>>>>> CSV is wrong your code fails but the object from previous run persists?
>>>>>
>>>>> If this is the case just initialize your objects in the beginning (e.g.
>>>>> make them NULL at the beginning) and only if code delivers result the
>>>> value
>>>>> of the result is returned otherwise NULL is returned.
>>>>>
>>>>> Cheers
>>>>> Petr
>>>>>
>>>>> Osobní údaje: Informace o zpracování a ochraně osobních údajů obchodních
>>>>> partnerů PRECHEZA a.s. jsou zveřejněny na: https://www.precheza.cz/
>>>>> zasady-ochrany-osobnich-udaju/ | Information about processing and
>>>>> protection of business partner's personal data are available on website:
>>>>> https://www.precheza.cz/en/personal-data-protection-principles/
>>>>> Důvěrnost: Tento e-mail a jakékoliv k němu připojené dokumenty jsou
>>>>> důvěrné a podléhají tomuto právně závaznému prohlášení o vyloučení
>>>>> odpovědnosti: https://www.precheza.cz/01-dovetek/ | This email and any
>>>>> documents attached to it may be confidential and are subject to the
>>>> legally
>>>>> binding disclaimer: https://www.precheza.cz/en/01-disclaimer/
>>>>>
>>>>>> -----Original Message-----
>>>>>> From: R-help [mailto:[hidden email]] On Behalf Of Morkus
>>>>> via R-
>>>>>> help
>>>>>> Sent: Monday, July 2, 2018 2:02 PM
>>>>>> To: [hidden email]
>>>>>> Subject: [R] R maintains old values
>>>>>>
>>>>>> Hello,
>>>>>>
>>>>>> I have a strange side-effect from executing R-scripts using R and
>>>> RServe.
>>>>>>
>>>>>> I am executing an R-Script from a Java file using RServe in R. I also
>>>>> have RStudio
>>>>>> installed, but it's not running at the time. The R-script reads a CSV
>>>>> file and does
>>>>>> various statistical things. RServe enables me to run each line of the R
>>>>> script
>>>>>> using "eval()" line by line.
>>>>>>
>>>>>> All this works fine for a correctly-formatted CSV file. It's great.
>>>>>>
>>>>>> But, if the CSV file isn't correctly formatted, AND the last CSV file
>>>>> did correctly
>>>>>> get run, then, with the incorrect CSV as input, the output is what ran
>>>>> last time.
>>>>>> Somehow, the last correct run is persisted and returned if there is
>>>> some
>>>>>> problem with the current CSV input.
>>>>>>
>>>>>> This data persistence is maintained across reboots.
>>>>>>
>>>>>> I'm thus baffled how R is maintaining these old values, but more to the
>>>>> point, I
>>>>>> need to know how to clear these old values so if the CSV input is
>>>>> incorrect, I get
>>>>>> nothing back, not the old CSV values from a correctly formatted file.
>>>>>>
>>>>>> Hope this description is clear.
>>>>>>
>>>>>> Thanks in advance to all.
>>>>>>
>>>>>> - M
>>>>>>
>>>>>> Sent from [ProtonMail](https://protonmail.com), Swiss-based encrypted
>>>>> email.
>>>>>>      [[alternative HTML version deleted]]
>>>>>>
>>>>>> ______________________________________________
>>>>>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>>>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>>>> PLEASE do read the posting guide http://www.R-project.org/
>>>>> posting-guide.html
>>>>>> and provide commented, minimal, self-contained, reproducible code.
>>>>>
>>>>> ______________________________________________
>>>>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>>> PLEASE do read the posting guide http://www.R-project.org/
>>>>> posting-guide.html
>>>>> and provide commented, minimal, self-contained, reproducible code.
>>>>>
>>>>
>>>>        [[alternative HTML version deleted]]
>>>>
>>>> ______________________________________________
>>>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>> PLEASE do read the posting guide http://www.R-project.org/
>>>> posting-guide.html
>>>> and provide commented, minimal, self-contained, reproducible code.
>>>>
>>>
>>> [[alternative HTML version deleted]]
>>>
>>> ______________________________________________
>>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: R maintains old values

Peter Dalgaard-2
In reply to this post by J C Nash


> On 3 Jul 2018, at 15:25 , J C Nash <[hidden email]> wrote:
>
> For the sake of those who didn't see the link, Jenny objects strongly to startup
> lines that either set a personal path or clear the workspace.
>
> While I agree both of these are anti-social to the point of pathology for scripts
> that are distributed, I have found it VERY important when testing things to actually
> clear the workspace etc. Too many times I've got a result that nobody else would get
> because I'm often loading some of my own packages or there are "useful" variables
> lurking.


I think Jenny's point is more that rm(ls... is the wrong _method_ to clear the workspace, because it only does part of the job and you may end up missing require() statements, etc.  

>
> As usual, context is critical. Distributed scripts vs. developmental ones.
>
> Now, to add to the controversy, how do you set a computer on fire?


Short the lithium battery?

-pd

>
> JN
>
> On 2018-07-03 03:52 AM, peter dalgaard wrote:
>> Also beware the traveling arsonist, Jenny Bryan:
>>
>> https://www.tidyverse.org/articles/2017/12/workflow-vs-script/
>>
>>
>> -pd
>>
>>> On 2 Jul 2018, at 17:11 , Bert Gunter <[hidden email]> wrote:
>>>
>>> ... or perhaps
>>>
>>> rm( list = ls(all = TRUE))
>>> ## see ?ls  for details.
>>>
>>> However, see ?Startup for how to start a R in a "clean" environment, e.g.
>>> with the --no-restore option.
>>>
>>> Cheers,
>>> Bert
>>>
>>>
>>> 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, Jul 2, 2018 at 7:47 AM, Eric Berger <[hidden email]> wrote:
>>>
>>>> If you want a "fresh" R session when you start to run the script you could
>>>> consider putting as the first line
>>>>
>>>> rm(list=ls())
>>>>
>>>> This will remove objects from your environment (variables, functions, ..)
>>>>
>>>> HTH,
>>>> Eric
>>>>
>>>>
>>>> On Mon, Jul 2, 2018 at 5:34 PM, PIKAL Petr <[hidden email]> wrote:
>>>>
>>>>> Hi
>>>>>
>>>>> Without code it is just fishing in murky waters. Could the problem you
>>>>> face be that in each run you assingn the result to some object and if the
>>>>> CSV is wrong your code fails but the object from previous run persists?
>>>>>
>>>>> If this is the case just initialize your objects in the beginning (e.g.
>>>>> make them NULL at the beginning) and only if code delivers result the
>>>> value
>>>>> of the result is returned otherwise NULL is returned.
>>>>>
>>>>> Cheers
>>>>> Petr
>>>>>
>>>>> Osobní údaje: Informace o zpracování a ochraně osobních údajů obchodních
>>>>> partnerů PRECHEZA a.s. jsou zveřejněny na: https://www.precheza.cz/
>>>>> zasady-ochrany-osobnich-udaju/ | Information about processing and
>>>>> protection of business partner's personal data are available on website:
>>>>> https://www.precheza.cz/en/personal-data-protection-principles/
>>>>> Důvěrnost: Tento e-mail a jakékoliv k němu připojené dokumenty jsou
>>>>> důvěrné a podléhají tomuto právně závaznému prohlášení o vyloučení
>>>>> odpovědnosti: https://www.precheza.cz/01-dovetek/ | This email and any
>>>>> documents attached to it may be confidential and are subject to the
>>>> legally
>>>>> binding disclaimer: https://www.precheza.cz/en/01-disclaimer/
>>>>>
>>>>>> -----Original Message-----
>>>>>> From: R-help [mailto:[hidden email]] On Behalf Of Morkus
>>>>> via R-
>>>>>> help
>>>>>> Sent: Monday, July 2, 2018 2:02 PM
>>>>>> To: [hidden email]
>>>>>> Subject: [R] R maintains old values
>>>>>>
>>>>>> Hello,
>>>>>>
>>>>>> I have a strange side-effect from executing R-scripts using R and
>>>> RServe.
>>>>>>
>>>>>> I am executing an R-Script from a Java file using RServe in R. I also
>>>>> have RStudio
>>>>>> installed, but it's not running at the time. The R-script reads a CSV
>>>>> file and does
>>>>>> various statistical things. RServe enables me to run each line of the R
>>>>> script
>>>>>> using "eval()" line by line.
>>>>>>
>>>>>> All this works fine for a correctly-formatted CSV file. It's great.
>>>>>>
>>>>>> But, if the CSV file isn't correctly formatted, AND the last CSV file
>>>>> did correctly
>>>>>> get run, then, with the incorrect CSV as input, the output is what ran
>>>>> last time.
>>>>>> Somehow, the last correct run is persisted and returned if there is
>>>> some
>>>>>> problem with the current CSV input.
>>>>>>
>>>>>> This data persistence is maintained across reboots.
>>>>>>
>>>>>> I'm thus baffled how R is maintaining these old values, but more to the
>>>>> point, I
>>>>>> need to know how to clear these old values so if the CSV input is
>>>>> incorrect, I get
>>>>>> nothing back, not the old CSV values from a correctly formatted file.
>>>>>>
>>>>>> Hope this description is clear.
>>>>>>
>>>>>> Thanks in advance to all.
>>>>>>
>>>>>> - M
>>>>>>
>>>>>> Sent from [ProtonMail](https://protonmail.com), Swiss-based encrypted
>>>>> email.
>>>>>>     [[alternative HTML version deleted]]
>>>>>>
>>>>>> ______________________________________________
>>>>>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>>>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>>>> PLEASE do read the posting guide http://www.R-project.org/
>>>>> posting-guide.html
>>>>>> and provide commented, minimal, self-contained, reproducible code.
>>>>>
>>>>> ______________________________________________
>>>>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>>> PLEASE do read the posting guide http://www.R-project.org/
>>>>> posting-guide.html
>>>>> and provide commented, minimal, self-contained, reproducible code.
>>>>>
>>>>
>>>>       [[alternative HTML version deleted]]
>>>>
>>>> ______________________________________________
>>>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>> PLEASE do read the posting guide http://www.R-project.org/
>>>> posting-guide.html
>>>> and provide commented, minimal, self-contained, reproducible code.
>>>>
>>>
>>> [[alternative HTML version deleted]]
>>>
>>> ______________________________________________
>>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

--
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: [hidden email]  Priv: [hidden email]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: R maintains old values

Christopher W. Ryan
In reply to this post by J C Nash
This TV series might have some advice on that.

https://www.imdb.com/title/tt2543312/

--Chris Ryan

On Tue, Jul 3, 2018 at 9:25 AM, J C Nash <[hidden email]> wrote:

> . . . Now, to add to the controversy, how do you set a computer on fire?
>
> JN
>
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: R maintains old values

Ted Harding
On Tue, Jul 3, 2018 at 9:25 AM, J C Nash <[hidden email]> wrote:
>
> > . . . Now, to add to the controversy, how do you set a computer on fire?
> >
> > JN

Perhaps by exploring the context of this thread,
where new values strike a match with old values???

Ted

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: R maintains old values

Berry, Charles
In reply to this post by J C Nash


> On Jul 3, 2018, at 6:25 AM, J C Nash <[hidden email]> wrote:
>
> Now, to add to the controversy, how do you set a computer on fire?

From the bash prompt:

stuxnet --overload=cpu,disk,network,gpu --fan=off --no-warnings <your_computer_id>

HTH,

Chuck
______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.