[R] plot.hclust point to older version

Martin Maechler maechler at stat.math.ethz.ch
Thu Nov 27 18:30:12 CET 2014

>>>>> "PP" == PIKAL Petr <petr.pikal at precheza.cz>
>>>>>     on Thu, 27 Nov 2014 13:40:36 +0000 writes:

    PP> Hm
    >> -----Original Message-----
    >> From: Jeff Newmiller [mailto:jdnewmil at dcn.davis.CA.us]
    >> Sent: Wednesday, November 26, 2014 8:09 PM
    >> To: PIKAL Petr; Martin Maechler
    >> Cc: R help
    >> Subject: Re: [R] plot.hclust point to older version
    >> Short answer to your question is "R files" and original data from
    >> external sources.
    >> I tend to keep my projects in separate directories. I make a core R

    PP> I do the same.

    >> file that I can run from beginning to end using source() to generate my
    >> primary analysis objects. I then make another file to keep my source()
    >> function call in, as well as a few exploratory plot commands. Recently
    >> I have been also sourcing the analysis script in Rmd or Rnw files to
    >> "knit" my observations with the output.
    >> Some people complain that their analysis takes too long to be sourcing
    >> it all the time. When I have that problem I set up a variable outside
    >> my analysis script that I test in my analysis script. If the variable
    >> indicates it is time to recalculate, then I do all of that and then
    >> save the data in sn rds or rda file. If the variable indicates that I
    >> should reuse the cached data, then it skips the calculations and just
    >> loads the data. This way I always load the right libraries along with
    >> the data, and I don't accidentally save data that I changed outside the
    >> analysis script... keeping my results reproducible. (Rds files can be
    >> convenient if I have several different slow analyses to compare and I
    >> want to only work on one at a time. I set up one control variable for
    >> each analysis.)

    >> Some people (smarter than me?) like to build their analysis into an
    >> Sweave or knitr file. They can then strip out an analysis R file to use
    >> the way I have described if they choose to do so ("literate
    >> programming") but I have not picked up that habit yet.

I do that occasionally, but in much less than in 50% of my R "hacking"

    >> The key is keeping a record of how every object that is in your save
    >> file was originally created. If you tolerate auto saving and loading of
    >> the environment then you lose that record, and pernicious errors can

    PP> Not exactly. All commands are saved in .Rhistory, which from time to time I rename and keep for further use. And sometimes I also make a separate file with commands used, especially when I am at the end of my work on a project.

Huaah.... Of course "real useRs don't use .Rhistory either !"
As Jeff says:  Use  <name>.R  files - often more than one per

And I did not say one should not use save() and load() or the
*.rds equivalent which is preferable but I still did not get
into the full habit of using... one reason is the mismatch of
saveRDS() and readRDS()  {where as  write <-> read; or save <->
load are the natural word pairs for me}.

So, yes, Jeff indeed is one of the "real useRs .." in my sense ;-)

    >> creep into your environment from who knows where, and you might as well
    >> be using Excel if that is how you work. (Note that this means I hardly
    >> ever copy data straight from Excel via the clipboard as that is not
    >> reproducible. Usually this means Save As CSV in Excel to start my R
    >> analysis if that is the data source.)

    PP> As I understand you do more sophisticated version what I am doing. The key is to keep projects in separate directories and do not polute them with unrelated objects. The problem in my way is when I accidentaly destroy an object and I need to restore it, which can sometimes be tedious work. OTOH it keeps me focused on what I am doing :-)

    PP> Anyway, I shall consider save and saveRDS to keep copy of important objects outside .RData environment, if something went wrong.

    PP> Thanks for idea.

Once you become careful about that and organizing your *.R files
which keep the project  "100% reproducible"  you may start to
see that using .RData is just a hindrance for the discipline of
reproducible { research / data analysis / computational experiments }
using R...

Yes, I'm not sounding very nice, above... Sorry, please apologize.

    PP> Best regards.
    PP> Petr

    >> -----------------------------------------------------------------------
    >> ----
    >> Jeff Newmiller                        The     .....       .....  Go
    >> Live...
    >> DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live
    >> Go...
    >> Live:   OO#.. Dead: OO#..
    >> Playing
    >> Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
    >> /Software/Embedded Controllers)               .OO#.       .OO#.
    >> rocks...1k
    >> -----------------------------------------------------------------------
    >> ----
    >> Sent from my phone. Please excuse my brevity.
    >> On November 26, 2014 2:05:54 AM PST, PIKAL Petr
    >> <petr.pikal at precheza.cz> wrote:
    >> >Hi
    >> >
    >> >You say
    >> >
    >> >> in other words, experienced R users do not let their workspace be
    >> >saved
    >> >> automatically (to '.RData') and hence do not load any .RData
    >> >> automatically at startup.
    >> >
    >> >I save/load .RData for years without any issues (except of not
    >> >installed packages when working on different PCs).I usually keep each
    >> >project in separated .RData (and separated folder, together with all
    >> >stuff belonging to that project), which prevent to mess things
    >> >together.
    >> >
    >> >There is no such warning as "do not use .RData" in books I have
    >> >available.
    >> >
    >> >I wonder how experienced useR keep track of several projects without
    >> >using startup loading .RData?
    >> >What would you recommend for keeping track of commands and created
    >> >objects instead of .RData?
    >> >
    >> >Petr

    PP> ________________________________
    PP> Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou určeny pouze jeho adresátům.
    PP> Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě neprodleně jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie vymažte ze svého systému.
    PP> Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat.
    PP> Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi či zpožděním přenosu e-mailu.

    PP> V případě, že je tento e-mail součástí obchodního jednání:
    PP> - vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření smlouvy, a to z jakéhokoliv důvodu i bez uvedení důvodu.
    PP> - a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně přijmout; Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze strany příjemce s dodatkem či odchylkou.
    PP> - trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve výslovným dosažením shody na všech jejích náležitostech.
    PP> - odesílatel tohoto emailu informuje, že není oprávněn uzavírat za společnost žádné smlouvy s výjimkou případů, kdy k tomu byl písemně zmocněn nebo písemně pověřen a takové pověření nebo plná moc byly adresátovi tohoto emailu případně osobě, kterou adresát zastupuje, předloženy nebo jejich existence je adresátovi či osobě jím zastoupené známá.

    PP> This e-mail and any documents attached to it may be confidential and are intended only for its intended recipients.
    PP> If you received this e-mail by mistake, please immediately inform its sender. Delete the contents of this e-mail with all attachments and its copies from your system.
    PP> If you are not the intended recipient of this e-mail, you are not authorized to use, disseminate, copy or disclose this e-mail in any manner.
    PP> The sender of this e-mail shall not be liable for any possible damage caused by modifications of the e-mail or by delay with transfer of the email.

    PP> In case that this e-mail forms part of business dealings:
    PP> - the sender reserves the right to end negotiations about entering into a contract in any time, for any reason, and without stating any reasoning.
    PP> - if the e-mail contains an offer, the recipient is entitled to immediately accept such offer; The sender of this e-mail (offer) excludes any acceptance of the offer on the part of the recipient containing any amendment or variation.
    PP> - the sender insists on that the respective contract is concluded only upon an express mutual agreement on all its aspects.
    PP> - the sender of this e-mail informs that he/she is not authorized to enter into any contracts on behalf of the company except for cases in which he/she is expressly authorized to do so in writing, and such authorization or power of attorney is submitted to the recipient or the person represented by the recipient, or the existence of such authorization is known to the recipient of the person represented by the recipient.
    PP> ______________________________________________
    PP> R-help at r-project.org mailing list
    PP> https://stat.ethz.ch/mailman/listinfo/r-help
    PP> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
    PP> and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list